Home Technical Talk

Recomended ways to texture a normal mapped model?

polycounter lvl 18
Offline / Send Message
spacemonkey polycounter lvl 18
Hi guys, I'm looking to find out how you go about texturing your low poly models when they have their normal maps/bump/spec applied.. ?
I've been trying to use max but I find it a pain in the arse as I dont get a clear view of what things look like until I render the scene. Can anyone recomend ar alternative??
The max view port will display the normal map (in a low rez manner) but obviously I need to see the combination of bump/spec etc so that I can make changes as needed.

Replies

  • pogonip
    Options
    Offline / Send Message
    pogonip polycounter lvl 18
    Build a room in Doom 3 with lighting applied and put your character in it . Update as you go then you can see your progress real-time and in an engine that updates with all 4 maps applied . It's the only way I can think to do it at the moment but im sure there are other ways . If you keep Doom 3 open and work on the diffuse/spec/bump as you go everytime you save your work from photoshop or whatever it will update in engine automatically so this should solve your problem . I don't know that Max can do what your asking but I think lightwave can ?
  • Rick Stirling
    Options
    Offline / Send Message
    Rick Stirling polycounter lvl 18
    Thats assuming spacemonkey has doom3. I know he has Max, so I'm working from there (assuming version 7!).

    Are you running direct X as your display driver? If so you can turn on direct X shared for the material and see it in real time.

    You need a DX 9 (Or is it 8?) enabled gfx card.

    However - this is not great because
    a) slow
    b) it'd not the same as it will display in game, depending on the game lighting.
  • EarthQuake
    Options
    Offline / Send Message
    You can use the metalbump9 directx thing, but it washes the textures out and dosent look very good.. D3 is your best bet for realtime because its pretty easy to use.
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    DX9 Viewport shader works pretty well for me, although the normal-map is also gouraud shaded, so it looks a little weird like Rick says, not quite how it'd look in-game. I don't find it slow, but it does seem to really screw over the Undo function sometimes.

    I haven't noticed the Metal Bump shader washing out my textures, although again, like the viewport shader, the normal-map doesn't display as well as it should.

    You could try turning a viewport to ActiveShade, not as fast as a viewport, but better than a full render, I reckon.

    Apart from that and Doom3, I think you'll just have to wait until you can use UE3's UnrealEd? :P
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    Hmm, good point on the Doom3 demo. And yeah, Max's viewport shaders are erratic at best. Sometimes even just closing a file and re-opening it can screw up the lighting and texture display, even if it was working perfectly before. They should fix that!
    However, does the Doom3 display have much control over specular maps and such?
  • spacemonkey
    Options
    Offline / Send Message
    spacemonkey polycounter lvl 18
    hmmn, I have been using the direct x manager to display the textures.. but the normal maping shows up allot lower res than it actually is and the display does occasionally screw up. I doesnt seem capable of displaying a height map and normal map at the same time. I'll have get doom3 installed and give it a try. Is there a quick/simple way to get the mesh into doom3?
  • ScoobyDoofus
    Options
    Offline / Send Message
    ScoobyDoofus polycounter lvl 19
    Im just going to chime in and say that, yes. Max's realtime shader display is pretty terrible for me.
    I didnt realize that Doom3 would be able to update without restarting the application every time changes are made...

    Im assuming there is some sort of console command to update the scene?
  • KDR_11k
    Options
    Offline / Send Message
    KDR_11k polycounter lvl 18
    Doom 3 has those various reloadX commands, use listcmds or type reload and press tab. Though Pogonip's post sounds like it'll detect the changes and reload the texture automatically.

    However, does the Doom3 display have much control over specular maps and such?

    Um, what control do you mean? All it does is take your spec map and apply it to the model, the spec map can be full color. Your map obviously has to do the rest but I doubt any engine will offer you more control than that.
  • sinistergfx
    Options
    Offline / Send Message
    sinistergfx polycounter lvl 18
    It won't reload automatically, you'll have to use the reloadimages console command whenever you want to see changes. Bind it to a key and it'll be even better!
  • poopinmymouth
    Options
    Offline / Send Message
    poopinmymouth polycounter lvl 19
    Try the Ben Cloward shaders. They update automatically and use whatever map size you're using, even if it's huge (1024, 2048)

    Only problem with it is that it doesn't have a slot for specular maps, just a color and a value. But for doing the color and normal, it's great!
  • sinistergfx
    Options
    Offline / Send Message
    sinistergfx polycounter lvl 18
    and the link poop forgot to supply:
    http://www.monitorstudios.com/bcloward/resources_shaders.html

    edit: and it looks like his normal map specular shader does have a slot for a specular map, but only through the diffuse texture's alpha channel. So no color specular map frown.gif.
  • pior
    Options
    Offline / Send Message
    pior grand marshal polycounter
    Hey people!

    One problem you'll get with previewing your maps straight in doom3 is that, its, well, doom3. And it won't give you the shading you might expect from your normalmap as it only shades properly nmaps that have been generated BY doom3.

    There is, however, that one free viewer by Derton that allows you to use MD5s and ASEs and it will combine your maps in the exact same way doom3 does, except that it will work with 'classic' normalmaps wich is what you want.

    Funny thing, I'm working on a tutorial about all that right at the moment laugh.gif

    I personnally like to use Max's normalrender (or whatever its called!) in the bump slot. It's not realtime but gives you full access to everything, diffuse, bump, normal, spec. I also like to use the same 3point light setup for all my models so that I am sure they are painted the same way. In the end you'll obviously need to adjust gammas to make it work in the particular engine you are using but it's a necessary step anyways (wich is often just a matter of darkening the specmap ALOT!)

    More words about that as soon as I have that tut done wink.gif
  • spacemonkey
    Options
    Offline / Send Message
    spacemonkey polycounter lvl 18
    thanks guys I will check out the Shader, it sounds better than the default directX one.

    Pior, I'll be looking out for that tutorial wink.gif
  • sinistergfx
    Options
    Offline / Send Message
    sinistergfx polycounter lvl 18
    I haven't had any problems with Doom3's normal map display, you just have to make sure whatever normal map generation method you use (nvidia filter, lights in your 3d software, max's normal map generation, whatever...) follows the same conventions as Doom3's renderer uses.

    These conventions are:

    Red channel - Black = facing left, White = facing right

    Green channel - Black = facing up, White = facing down


    You'll have to set up your normal map generation tool/method to take this into account and you should have no problems. I've found that on both models and flats, Doom3 and Max would generate identical normal maps (except for filtering differences, of course).

    But then again, there may be specific instances where there are differences. Any examples, Pior? We might be able to work around them.
  • ElysiumGX
    Options
    Offline / Send Message
    ElysiumGX polycounter lvl 18
    An alternative? Create your high and low poly objects. Select the low poly mesh and select Get > Property > GPUSurfaceFX2. From there select your high polymesh, and the surface data you want exported. Select your preview method and hardware, and generate your data. For easy previewing, select your DirectX or Cg realtime viewport, and load a shader preset from the NetView that includes color, specular (with color), and bump, and normal. Load each image into the specific nodes. Adjust your settings and lights to your preference, and Tada!

    This is all in XSI btw. Sorry.
  • Ben Cloward
    Options
    Offline / Send Message
    Ben Cloward polycounter lvl 18
    sinistergfx,

    Would you like a version of my shader that uses a color specular map? I think I could do that. Any other features you'd like?
  • sinistergfx
    Options
    Offline / Send Message
    sinistergfx polycounter lvl 18
    Ben: sounds good to me! I'm sure plenty of artists out there would appreciate it. Can't think of anything else right now that would be needed. I'll give it some thought. Thanks.

    Welcome to the board.
  • KDR_11k
    Options
    Offline / Send Message
    KDR_11k polycounter lvl 18
    The coloring in the normalmap is the smaller problem, each normal map renderer has different approaches for the actual rendering. Throwing an ORB normalmap at Doom 3 will produce more visible seams and stuff, an Ati-made normal map will look plain awful. The Doom 3-made normalmaps look best in Doom 3 and I suppose the way they are implemented in D3 is the one that will be the most common one with future games.
  • pior
    Options
    Offline / Send Message
    pior grand marshal polycounter
    Well I guess a extra bump slot would be cool too?

    As for the Doom3/Max differences :

    A Max rtt:

    nmap_classic.jpg

    And a map out of doom3 generated with the same source meshes :

    nmap_doom3.jpg

    I can spot differences where the lowpolyedges are supposed to be, its really obvious on the arms... I think it's just Doom3's way to counter balance some harsh gouraud or something, but its not realted to X or Y swithch as they are both using the Nvidia's convention and not ati's.

    The weird thing is that Doom3 seems to be the only engine relying on that!

    Any idea?
  • sinistergfx
    Options
    Offline / Send Message
    sinistergfx polycounter lvl 18
    Hmmm, that's pretty damn funky. Seems that they're doing something different with the normals of the low poly.

    Dunno which is "correct" though, I would assume Doom's generation method should be better suited for its renderer, but I've made a pretty good amount of Doom3 assets using Max 's rtt and haven't noticed any lighting abnormalities.

    Also, Doom3 renderbump takes too long when supersampling, and I prefer more control over my projection cage. (Also helps to generate all of your bakes in Max so they all match up)

    Thanks for the insight, Pior.
  • KDR_11k
    Options
    Offline / Send Message
    KDR_11k polycounter lvl 18
    Extra bump slot:

    bumpmap addnormals(*normalmap*, heightmap(*bumpmap*, *bump intensity*));

    If you change your material file you have to use reloadDecls but that can be bound to another key.
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    Ben Cloward: Thanks for those DX Shaders, I didn't know about them - they seem very handy, I've given a few of them a spin. Your normal-map shader handles UV-mirroring much better than Max7's viewport manager shader, it displays perfectly!

    The 3-light Normal-Map shader crashes Max7 for me, though - I've got a Radeon 9800 Pro, that should be enough to handle it, right? The other normal map shaders all seem to work fine.

    I also discovered that the Y-axis (green channel) in your standard normal-map/spec shader is flipped compared to the output Max7's normal-mapper outputs by default - having an option/checkbox to choose which style of normal-mapping to use would be awesome.

    I'd also love to see a shader that allowed a coloured specular bitmap!

    Also, any ideas on why the 3-light normal map shader is crashing Max would be much appreciated. Thanks for all the effort, I'll definitely be using these shaders in future!

    I also discovered that the DX9 shader "RTTNormalMap.fx" that ships with Max, actually displays normal-maps in the viewport much better than the DX9 manager synced to a standard material - however, it doesn't support specular mapping, so Ben's shader seems to be the best choice...
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    Ben Cloward: I hope you don't mind, I'm no programmer, so I just hacked around with your existing Normal Map/Specular .fx file to make it use opacity-mapping too, since I need that for something I'm currently working on, and your shader displays normal/spec in the viewport so much better than the standard 3dsmax shaders!

    This one takes the opacity-map from the alpha channel of a 32-bit diffuse texture.

    It's essentially all Ben Cloward's work, so I left all his info in the top of the file, I guess if anyone needs this they can use it until he releases a "real" version, which I'm sure will be much improved my version smile.gif

    http://www.spearmint.pwp.blueyonder.co.uk/normal_map_spec_opac.fx is where you'll find it...

    Ben: If this isn't kosher, I'll take it down...

    MoP
  • Silva_Spoon
    Options
    Offline / Send Message
    Silva_Spoon polycounter lvl 18
    "Apart from that and Doom3, I think you'll just have to wait until you can use UE3's UnrealEd? :P " - MoP

    Im using the Unreal Engine 3 and its unfortunate that you cant just save your maps and see them update in realtime. you have to re import your maps to your package everytime you make a change. :[
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    Ah... someone should get on the programmers' asses about that wink.gif
  • spacemonkey
    Options
    Offline / Send Message
    spacemonkey polycounter lvl 18
    big thanks to Ben C, your shader is much better than the default max stuff.
  • Ben Cloward
    Options
    Offline / Send Message
    Ben Cloward polycounter lvl 18
    I'm glad that you guys like my shaders. I've written a few more that I haven't added to my web site yet, but I did post them on CGTalk in this thread:

    http://www.cgtalk.com/showthread.php?t=244102

    MoP: My normal map shader handles the mirror issue better than Max's but it's still not quite right. If you apply it to a sphere, cut the sphere in half and mirror it, you'll see what I mean. Put a point light close to the mirrored side and you'll see that the vertex lighting is correct, but the normal mapping bumps are still going in the wrong direction. There's nothing I can do about it. It's a Max thing. - But yeah, it's better.

    Nice job on figuring out how to get transparency to work! I don't mind you doing that at all. I posted those for people to use so it's good to see that thet're getting some use - and especially cool that you've gone so far as to figure out how to add features!

    The only problem is that in that shader the diffuse texture alpha channel is now being used for a specular mask AND for transparency.

    When I make the shader that uses a color map for a specular mask (hopefully tonight if I get some time) that will free up the diffuse alpha channel so it will work correctly for transparency. I hope to be able to post that tomorrow sometime.

    The three light shader crashes Max because it's using pixel shader 2.0a (because it calls for lots of instructions) and ATi cards don't support that profile. I didn't know that when I posted it. ATi cards do support pixel shader 2.0b though. Try this:

    Find two lines toward the bottom of the shaders that look like this:

    "PixelShader = compile ps_2_a"

    and change them so they look this this:

    "PixelShader = compile ps_2_b"

    If "b" doesn't work then try "c." I'd test it myself but I don't have an ATi card. Does it work?
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    Hey Ben, thanks ... I didn't realise the Diffuse alpha channel was a specular mask map in your shader! Ah well smile.gif

    I tried altering the ps_2_a to b and then c, but with ps_2_b, it crashed the same way as with A, and C gave me this:

    "unsupported compiler target 'ps_2_c'"

    I guess it's just my graphics card then... shame, I'd have liked more than 1 light on my preview.

    If you write the transparency thing into your shader which utilises the separate coloured specular map, that would be awesome... I noticed with mine that if you have overlapping opacity-mapped planes with the shader, they sometimes display weirdly (sorting issues, i guess), but I don't know if there's a way round that in the shader, or if it's just an inherent problem with the way the viewports work, or something.

    Keep up the great work, man, these shaders are a huge bonus! smile.gif

    MoP
  • Ben Cloward
    Options
    Offline / Send Message
    Ben Cloward polycounter lvl 18
    Rats, I was hoping the B thing would fix it. It's really my fault for not know the limitations of the various graphics cards. What I really need to do is convert it to a multi-pass shader so each light uses its own pass. That would allow it to run on ATi cards - but it would take awhile. I'll put it on my "to do" list for later.

    The overlapping opacity sorting thing is also a Max issue. There's nothing I can do about the sort order.

    If you guys make something cool that uses my shaders, be sure to post it and/or let me know. I'd love to see it.
  • Ben Cloward
    Options
    Offline / Send Message
    Ben Cloward polycounter lvl 18
    I finished the new version of my shader that you guys asked for. I really liked your suggestions so I just overwrote the old version of my Normal Map Specular 3 Lights shader with this new version. Here's the new stuff:

    The shader now works with ATi cards! It turns out it wasn't all that hard to break it up into three passes - so now it can just use pixel shader 2 instead of 2a.

    I added a color specular mask so you can control the color of the specular highlight per-pixel.

    I added a check box that allows the shader to support poth positive and negative Y normal map formats (Good idea, MoP!)

    You can grab the new version of the shader here:

    http://www.monitorstudios.com/bcloward/shaders_NormalMapSpecular3lights.html

    I tried adding transparency to it also, but I ran into a few problems with it. I'm going to talk to some of the programmers at work today and see if they can help me get the transparency working. In the mean time, tell me what you think.
  • CrazyButcher
    Options
    Offline / Send Message
    CrazyButcher polycounter lvl 18
    for transparency:

    turn on AlphaBlend in first pass, and do
    srcblend = ALPHA
    destblend = ONE_MINUS_ALPHA

    for the others make
    srcblend = ALPHA
    destblend = ONE

    make sure your colorout.alpha is always the one from the texture which defines transparency

    I am not familiar with .fx so well, mostly doing OpenGL stuff so some terms might be different.
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    Great stuff, Ben. Thanks! smile.gif
  • pior
    Options
    Offline / Send Message
    pior grand marshal polycounter
    That makes sense!

    But that makes me also wonder why the ID techs decided to go for an 'alternate' (lets call it this way) nmap read/generation by default, while the 'classic' nmaps we see generated everywhere else work quite well already?

    Or maybe the cmd line I used was not the actual one used by ID, don't know, I just followed Vahl's tut haha laugh.gif But then I *think* I remember than the original Imp model, while loaded and rendered in Max, rendered quite strangely normalmapwise.

    It's so weird, I don't feel like Doom3 with the 'alternate' nmaps looks better than any other nextgen engine available... Or maybe it behaves better with very lowpoly models? I have the feeling D3s models are quite lighter than the UT2007 ones for instance. Maybe the alternate Nmaps allow for better rendering in case like 4 sided cylinders or something. Strange to see it has not been discussed further already?

    Interesting.
  • sinistergfx
    Options
    Offline / Send Message
    sinistergfx polycounter lvl 18
  • Ben Cloward
    Options
    Offline / Send Message
    Ben Cloward polycounter lvl 18
    CrazyButcher - thanks for your help. Your transparency tips worked great! I've done transparency with one pass shaders, but I've never tried it on multi-pass shaders. Getting the render states set up correctly was messing me up. Now it works.

    You can now download a transparency version of my 3 Lights Normal Map shader. It's on the same page (URL above) as the regular version.
  • pior
    Options
    Offline / Send Message
    pior grand marshal polycounter
    Per, my sweetheart!

    That makes, again, complete sense smile.gif Whatever state you ears are in you are 100% clear to me, I've been wondering about that thing for so long. And I think it also explains the artifacts I've seen on six-sided shapes, arms and the like. Good good. Carmack is as smart as he used to be laugh.gif
Sign In or Register to comment.