Home Technical Talk

object space normal maps in 3DS max 2009

hi all,


I've been trying to display object space normal maps in 3DS max 2009. It's not as easy as it sounds. the images are of the same model with standard shader. They have spec, diffuse, and normals.

in viewport.

rifleviewport-2.jpg

in render.
rifleviewport-1.jpg

So I'm inclined to think there's something wrong with my object space normals, but why would they display in the render so happily? I've updated my drivers.


I have nvidia geforce 8600 GT. 256 mgb of ramm. I'm running windows Vista, so I cant get the MAXTREME drivers to work on here :(


any suggestions would be appreciated.

Replies

  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    Did you make sure to set the shader to use object-space normalmaps instead of tangent-space? Most shaders by default use tangent-space maps so if you haven't changed it manually then that is what you should do.

    However, if you have changed it manually in the shader settings to display object-space maps, then your shader is probably broken. I doubt it's driver problems, it's more likely the shader not set up right, since it seems to be displaying all the textures, but just getting the lighting wrong.

    If that's the case, try looking for a different shader.
  • dolemite
    thanks MoP



    I've got the settings right in the standard shader. I tried using a DX shader and it still is displaying the same errors.

    I'm thinking about reinstalling max. Just seems so weird that it would display everything fine except object space normal maps.
  • [Deleted User]
    Does the stuff that's black in the viewport happen to be mirrored on the UV map?
  • dolemite
    nope. All unique UVs. Good thinking though.
  • Eric Chadwick
    You probably just need a shader that specifically supports an object- or local-space normalmap. The default Max FX shaders only support tangent-space IIRC.
  • dolemite
    riflewip-2.jpg


    here's a new clue. It looks like this when I rotate it to the left. The magazine, front grip and top rail seem to be opposite of the body, barrel, silencer. Also the seam along the handle is highlighted.

    How do I load a shader other than that which ships with 3DS max? Can you suggest a shader?
  • EarthQuake
    yeah looks like its loading it as a tangent space map.
  • dolemite
    Yeh I think you are correct. When I go into the shader properties and change the "local xyz" back to "tangent" and render it off, it looks the same in render as in view port.


    When I set it to "local xyz" it looks correct in render, but like above in view port. I have a similar machine at work. Just for kicks im going to take it to work and see if it will display correctly.


    thanks all for the feedback!
  • dolemite
    RTTNormalMap.fx

    I used this shader in the Direct X shaders and it worked correctly, but this shader doesn't provide slots for spec maps. :(



    Can anyone recommend a shader that works with object space normal maps and has slots for diffuse, spec, etc.?
  • odium
    Offline / Send Message
    odium polycounter lvl 18
    Why not just use tangent space...? I know that may sound like a half arsed answer, but if you plan on animating this weapon it will make life a little easier...?
  • dolemite
    I was using tangent space, I got a tip from a friend that object space works a lot better. I have to admit there's a lot less junk with the object space map. Shapes are more accurate.


    I'm finishing this off with tangent space for now. I kind of want to put this one to bed and get started on something else. I'll probably experiment with object space again next time around.


    thanks for all the help!
  • butt_sahib
    Offline / Send Message
    butt_sahib polycounter lvl 11
    Well, generally, tangent normals are used when the object is to be animated and object normals used when its a world object,where theres no need for animation.

    But i believe alot of people including EQ used object normal maps when we had that FPS weapon competition....So that begs the question....to WHAT extent does the model have to be deformed/animated for tangent normals to overtake object ones? i mean, animations in guns really don't need any major deformations, just some transformations? gavin's got me thinking like crazy :P good point tho
  • ivars
    Offline / Send Message
    ivars polycounter lvl 17
    Animated transforms works well with object space.
    When you start deforming your object, you'll need tangent space.
  • butt_sahib
    Offline / Send Message
    butt_sahib polycounter lvl 11
    Ah so the line is usually crossed from object to tanget if there's ANY possibilty of "organic" defomation?
    For example, if you had a hand model. and you had to have fingers rotate in the horizontal plane, will it be possible/beter to use object space? but the vertical and horizontal deformations would be the same thing right? So basically, you shouldnt use object space normals when the obect your animating is physically attached to another part of the model? So if i had a robot with seperate objects as fingers (e..g. box's for fingers) would it be adviseable to use object space normals?
  • EarthQuake
    ivars wrote: »
    Animated transforms works well with object space.
    When you start deforming your object, you'll need tangent space.

    Incorrect. One of the battle field games used object space maps for their *characters*. There aren't any problems animating/deforming object space maps, its a pretty common misconception tho. I think the shader may be a *slight* bit more complex to do so, but rendering a object space map is actually a little less complex in the first place, so it evens out.

    The real problems with object space maps are these:

    1. Mirroring is impossible with a standard implimentation, tho there are some clever folks around here who have ways of doing it(crazybutcher).

    2. Adding bump map detail can be very tricky, there are some ways to do it, but not nearly as easy/reliably as tangent space maps.

    3. You cannot rotate objects in your 3d app unless you have some way to keep track of the transforms, so if your app is just treating everything as standard mesh data, your lighting will be all fucked up. Now if you actually have a level editor where you place props as objects, its not a problem.

    So for those reasons most people like to stick to tangent space maps(or like many believe you cant animate them =P). But object space maps provide a good
  • ivars
    Offline / Send Message
    ivars polycounter lvl 17
    Do you have any more info on using object space maps on deformable objects? Wouldn't you still need to know the surface tangent in order to render it correctly?

    At least Maya can render object space normals on transformed objects in the viewport.
  • butt_sahib
    Offline / Send Message
    butt_sahib polycounter lvl 11
    So animating an object with object space is pretty much the same as is with tanget space (leaving out the shader complexity ofcourse). Wonder why this misconception is so widespread (must be like the "triangles screw everythign up in zbrush" issue lagging on), people must have just heard about it and never actually tried it i guess :/

    Wanted to see more info on what EQ pointed out (thanks :)) nd found this.The read is pretty easy:-
    Advantages to using Object Space :
    It's simpler to implement and I find it more straightforward to think about. The normal map contains the normals pointing in their actual directions (for an unrotated model at least.) You get to forget about per vertex normals, tangents, and binormals ( which I'll call n/t/b for short. ) This means less initial calculations, and you don't have to worry about poorly behaved n/t/b causing distortion. It's also slightly faster because you don't have to rotate the n/t/b with your model, or convert light vectors to tangent space. Level of detail algorithms or anything else that reduces and changes the vertices in your model can easily run fine. (In tangent space the changing n/t/b interpolations caused by removed vertices would probably distort the mesh normals, although I'm not sure if it will be noticeable. ) Object space may have less noticeable seems at texture uv boundaries than tangent space, but this depends greatly on the meshes and implementation.
    Disadvantages (as opposed to Tangent Space) :
    You can't reuse texture coordinates for symmetric parts of the model. If you had a model that is completely symmetric along an axis, and 1 MB normal map, that means 0.5 MBs of it is redundant information. If this bothers you, keep in mind this is only for something rendered as one piece. In the case mentioned above you could render the model in two halves, each using the same normal map, but one rendered with the light vector x component reversed ( or y or z depending on the axis of symmetry. ) Which is a tiny bit of extra work, but this is what I do myself. (My skeletal meshes have always had a chunk system, and flags settable per chunk, so flip x,y,z can be set to re-use parts of the texture.)
    Another main disadvantage to not using tangent space is that you can't use a detail normal map for fine close-up detail in addition to the one that approximates the high resolution mesh. (You can add details into the object space normal map when generating it, however, a detail normal map would be highly repeating, thus offering much greater resolution than just using the one normal map.)
    Also Tangent Space normal maps can be more easily compressed by storing only the X,Y channels. Since the normals are unit vectors, and the Z channel is always in the same direction, the Z channel can be computed this way: Normal.z = sqrt( 1.0 - Normal.x*Normal.x - Normal.y*Normal.y );
    A small issue to be aware of is that using mipmaping with normal maps can sometimes cause visible seems when downsampling causes the uv coordinates to align improperly with the texture. To fix this you can extend the edges on the normal map texture, or use fewer or no mipmaps. In tangent space mis-aligned UVs don't matter as much, since the texture is mostly blue (z-component).

    Source


    That bolded part...very sneaky on his end....sneaky monkey....
  • butt_sahib
    Offline / Send Message
    butt_sahib polycounter lvl 11
    "Wouldn't you still need to know the surface tangent in order to render it correctly?"

    .....seems like you dont.....
  • ivars
    Offline / Send Message
    ivars polycounter lvl 17
    butt_sahib: That text doesn't say anything about deformable geometry... :P

    I'm gonna do some searching now, see if I can find something....
  • butt_sahib
    Offline / Send Message
    butt_sahib polycounter lvl 11
    hehe XD well i thought didnt need tangets generally, whether or not deformable :P

    ill be here waiting for ya to see what you can come up with :D
  • Ninjas
    Offline / Send Message
    Ninjas polycounter lvl 18
    EarthQuake wrote: »

    2. Adding bump map detail can be very tricky, there are some ways to do it, but not nearly as easy/reliably as tangent space maps.


    I have been getting around this by adding micro detail to the high mesh in Mudbox 09. The results are not exactly the same, because they don't match up perfectly with a color overlay, but better in some ways (like being able to get real AO).
Sign In or Register to comment.