Home Technical Talk

Tangent basis in various apps

Is there anywhere I can find a comprehensive list of what tangent basis various apps use for rendering normal maps? If not, could we create one here?

For instance, I know 3ds Max uses +X and -Y, which is different from some other apps. With all the programs I use, it can become slightly confusing trying to remember if I need to flip the green channel or not. Any insight is appreciated.

Replies

  • SpeCter
    Options
    Offline / Send Message
    SpeCter polycounter lvl 14
    I think it would be wiser to point out how the most common engines handle that.
    Every program for rendering normal maps lets you decide how you want that.
  • m4dcow
    Options
    Offline / Send Message
    m4dcow interpolator
    Maya renders +y by default (right handed), but you can change this behaviour as you go. However tangent basis != handedness which is what you are looking for in your post.
  • Sean VanGorder
    Options
    Offline / Send Message
    Good point, tangent basis isn't really the same thing as handedness. I guess I had assumed that the handedness was derived from the tangent basis. Or maybe I'm just completely off track.
  • leechdemon
    Options
    Offline / Send Message
    leechdemon polycounter lvl 11
    (If this is maintained, a simple "Software - Orienation" list would make life easier. Also, a Wiki Page might make more sense..)

    AFAIK, xNormals uses the same basis as Max; if you're saying Max is +X/-Y, then xNormals is the same thing. I believe the Photoshop plugin defaults to the +X/+Y. So,
    Max : +X, -Y
    Maya: +X, +Y
    xNormals : +X, -Y
    Photoshop nVidia Plugin : +X, +Y
    Like m4dcow mentioned, there's a way to change this setting in each of these programs; this is mostly helpful in making sure your settings match across your pipeline.

    Some other good reading on how the Tangent Basis is calculated in several different packages (in case your developer starts shaking his fist at you): http://www.polycount.com/forum/showthread.php?t=84616
  • leechdemon
    Options
    Offline / Send Message
    leechdemon polycounter lvl 11
    SeanEG wrote: »
    I guess I had assumed that the handedness was derived from the tangent basis.

    If Handedness = Polygon Winding direction, then I believe it depends. Our software derives tangents from the winding direction, but I guess that's not always standard, which freaks my devs out whenever they run across it (sort of like calling the sky Green or something).
  • almighty_gir
    Options
    Offline / Send Message
    almighty_gir ngon master
    what Perna said.

    like, if i remember rightly, i read on the UDN site some time that they used an in-house app for generating their normals (makes sense), but that means that potentially there is no app on earth that would generate normals the same way Epic do.

    which is of course, a problem.

    edit:
    http://udn.epicgames.com/Three/ImportingStaticMeshTutorial.html

    apparently the tool they used is called "SHTools".
  • leechdemon
    Options
    Offline / Send Message
    leechdemon polycounter lvl 11
    ... sure, but assuming you're not using in-house software, it's possible to take a Normal Map generated in xNormals (or whatever) and view it correctly in Max (or whatever). A Tangent-Space Normal Map relies on accurate normals, tangents, and axis inversion all working in unison. Assuming you've got the first two, the second is an easy toggle; I think the OP was just asking for a list of what to flip to and when.

    Alternatively, if, say, Maya tangent generation differs from Max tangent generation, then that would still be a good thing to have a list of somewhere. A list of tangent/inversion compatibilities.
  • sprunghunt
    Options
    Offline / Send Message
    sprunghunt polycounter

    edit:
    http://udn.epicgames.com/Three/ImportingStaticMeshTutorial.html

    apparently the tool they used is called "SHTools".

    I've used SHTools a long time ago. We don't use it anymore even for unreal games.

    I believe it was developed when epic was first using normalmaps because you couldn't bake normalmaps in max. It was that long ago.
  • bugo
    Options
    Offline / Send Message
    bugo polycounter lvl 17
    I had to use that, sucks ass, there's no antialiasing.
  • metalliandy
    Options
    Offline / Send Message
    metalliandy interpolator
    Off the top of my head...

    Max X+Y-Z+
    Maya X+Y+Z+
    ZBrush X-Y+Z+ (not 100% sure)
    UDK X+Y-Z+
    Marmoset X+Y+Z+
    IDTech X+Y+Z+
    CryEngine 3 X+Y-Z+
    Blender 2.4x+ X-Y-Z+
    Blender 2.57+ X+Y+Z+ (now uses mikktspace by default)
    xNormal X+Y+Z+ (also uses mikktspace by default)
    CrazyBump X+Y+Z+
    Nvidia Filter X+Y-Z+
    PixPlant X+Y-Z+
    nDo2 X+Y+Z+

    Feel free to correct them, if i got any wrong :)

    While the axis that different programs use are insignificant when compared to the other complications, i still think it would be a good idea to get these on the Wiki, as when i was first starting out it used to drive me crazy trying to find them all out.
  • passerby
    Options
    Offline / Send Message
    passerby polycounter lvl 12
    you forgot ue3/udk X+Y-Z+
  • SpeCter
    Options
    Offline / Send Message
    SpeCter polycounter lvl 14
    @passerby:
    Fifth row, take a good look and try again ;)
  • passerby
    Options
    Offline / Send Message
    passerby polycounter lvl 12
    blah im stupid today
  • metalliandy
    Options
    Offline / Send Message
    metalliandy interpolator
    I updated my post to include CryEngine 3, which uses X+Y-Z+ :)
  • Ace-Angel
    Options
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    We seriously need a standard...
  • Scruples
    Options
    Offline / Send Message
    Scruples polycounter lvl 10
    Inverting the Green channel results in a percieved increase in quality for compressed normal maps, this is why it's all over the place.

    Also...isn't tangent basis something completely different?, isn't this swizzle coordinates?.
  • bugo
    Options
    Offline / Send Message
    bugo polycounter lvl 17
    Right Scruples, my question is, why are you guys worried about the XYZ negatives and positives if tangent basis doesn't mean that at all? For me tangent basis always meant the amount of angle the vertex normal converts the tangent of the surface, not the RGB info on the map. Am I wrong here?

    We also had a long conversation about this not so long ago, comparing different tangent basis inbetween softwares here: http://www.polycount.com/forum/showthread.php?t=68173
  • Sean VanGorder
    Options
    Offline / Send Message
    Yeah, tangent basis wasn't the best term to use when creating the thread. I had assumed the "handedness", or direction of the Y axis, was derived from the tangent basis. Mods can feel free to change the thread title.
  • throttlekitty
    Options
    Offline / Send Message
    Scruples wrote: »
    Inverting the Green channel results in a percieved increase in quality for compressed normal maps, this is why it's all over the place.
    Not quite, try again.
    Also...isn't tangent basis something completely different?, isn't this swizzle coordinates?.
    Swizzling (as it applies to images) is swapping color channels around when exporting said image, such as DXT5NM

    @metalliandy, Blender pushing for a tangent space standard is pretty cool :)
  • kodde
    Options
    Offline / Send Message
    kodde polycounter lvl 19
    Isn't tangent basis how you calculate the bitangent/binormal and tangent components that come along with the vertex normals?
  • r_fletch_r
    Options
    Offline / Send Message
    r_fletch_r polycounter lvl 9
    kodde wrote: »
    Isn't tangent basis how you calculate the bitangent/binormal and tangent components that come along with the vertex normals?

    that was my understanding. folks seem to be mixing it up with every other normal map buzz word.
  • metalliandy
    Options
    Offline / Send Message
    metalliandy interpolator
    Scruples wrote: »
    Inverting the Green channel results in a percieved increase in quality for compressed normal maps, this is why it's all over the place.

    Also...isn't tangent basis something completely different?, isn't this swizzle coordinates?.
    The direction of the axis has absolutely no effect on the quality of the results you get. The only reason there is a difference, is because some shaders are coded to use a preferred set up :)
    bugo wrote: »
    Right Scruples, my question is, why are you guys worried about the XYZ negatives and positives if tangent basis doesn't mean that at all? For me tangent basis always meant the amount of angle the vertex normal converts the tangent of the surface, not the RGB info on the map. Am I wrong here?

    We also had a long conversation about this not so long ago, comparing different tangent basis inbetween softwares here: http://www.polycount.com/forum/showthread.php?t=68173
    SeanEG wrote: »
    Yeah, tangent basis wasn't the best term to use when creating the thread. I had assumed the "handedness", or direction of the Y axis, was derived from the tangent basis. Mods can feel free to change the thread title.

    Yea Axis and Tangent space are different. I posted the axis values, because i knew what Sean meant and its good to finally get a list of these down somewhere :)
    He corrected himself in post 4 too :)

    @Sean, maybe message a mod to change the thread title and edit your first post?

    @metalliandy, Blender pushing for a tangent space standard is pretty cool :)

    Yea, its a move in the right direction :)
Sign In or Register to comment.