Home Technical Talk

problems with tangents...

polycounter lvl 13
Offline / Send Message
artquest polycounter lvl 13
Hello all, I'm working on creating assets for a game and in order to convert the models to the game's proprietary format they need to be in .xsi format. Since I use maya I thought this wouldn't be much of a problem because I can just use crosswalk to go between software packages then just save as a .xsi.

The problem is that I can't seem to get my model to keep the same tangents as It had in maya and as a result my normal map has seams along the uv regions in the game. It seems to be somehow changing the tangents somewhere along the way. Anyone have any ideas of where to start looking?

Since I learned pretty much everything I know about tangents and bitangents here on PC I figured it was the best place to get some advice :D

Thanks in advance,

-artquest

Replies

  • bugo
    Offline / Send Message
    bugo polycounter lvl 17
    Nothing you can do on that matter. Or you bake in the software you are exporting, or you lose the vertex tangency. It happens when I export in between Maya/Max.

    The easier way is to bake in XSI if you are exporting from it.
  • Surfa
    Offline / Send Message
    Surfa polycounter lvl 12
    Try exporting to a .fbx making sure you embed the tangent and bi-tangent data then import into xsi.
  • artquest
    Offline / Send Message
    artquest polycounter lvl 13
    bugo wrote: »
    Nothing you can do on that matter. Or you bake in the software you are exporting, or you lose the vertex tangency. It happens when I export in between Maya/Max.

    The easier way is to bake in XSI if you are exporting from it.

    I will probably do this moving forward.. however it did take awhile to bake the maps the first time around so for this one id rather not have to explode the model + bake it and learn how to do all of that in XSI for the first time when the deadline for this asset is already here. But if it comes to that... any good tutorials for XSI that you know of?

    Surfa wrote: »
    Try exporting to a .fbx making sure you embed the tangent and bi-tangent data then import into xsi.

    I tried this but when I convert to the game format converter spits out all my tangents with the value of 0.0. It seems to only recognize that the model has tangents when I use the "get property> tangent" option in XSI.
  • EarthQuake
    Well the important aspect isn't syncing up maya and XSI, its syncing your bake to your engine. Your tangents in X baker need to match up exactly to your engine's tangents, or you'll get seams and smoothing errors.

    So, you should work with your tech team on setting up a synchronized workflow. Whether the bakes are in Maya, XSI, Xnormal, it doesn't matter, as long as it all plays nicely with your engine.
  • keres
    Offline / Send Message
    keres polycounter lvl 12
    Ah, you need edge padding on your bake! :D It'll stretch the pixels around the UV borders by a certain number of pixels, avoiding the seams.

    Try baking with a larger edge padding and see if that works. :)
  • artquest
    Offline / Send Message
    artquest polycounter lvl 13
    EarthQuake wrote: »
    Well the important aspect isn't syncing up maya and XSI, its syncing your bake to your engine. Your tangents in X baker need to match up exactly to your engine's tangents, or you'll get seams and smoothing errors.

    So, you should work with your tech team on setting up a synchronized workflow. Whether the bakes are in Maya, XSI, Xnormal, it doesn't matter, as long as it all plays nicely with your engine.

    All the old assets are done in XSI or in maya then exported as .obj and finished in XSI so I was assuming if I could get it right in XSI then everything would be fine in engine. As I understand it now(from looking at both the code for the model files and the shader), the game is expecting vectors for the tangents to be stored in the model file. Then it passes the tangents to the shader to compute the bitangents. So if that is correct, isn't the problem in going from maya to XSI?

    keres wrote: »
    Ah, you need edge padding on your bake! :D It'll stretch the pixels around the UV borders by a certain number of pixels, avoiding the seams.

    Try baking with a larger edge padding and see if that works. :)

    It's a different kind of seam :( They match up perfectly, just the lighting displays different across the uv shells making it appear "hard edged."


    Thanks for your input everyone :) I knew I could count on PC for help.
  • Eric Chadwick
    A lot of game exporters simply create their own tangents, using code like nvidia's meshmender, or microsoft's example code, or their own custom thing. Like EarthQuake says, you should talk to whomever wrote the game exporter, find out what they're expecting.
  • artquest
    Offline / Send Message
    artquest polycounter lvl 13
    A lot of game exporters simply create their own tangents, using code like nvidia's meshmender, or microsoft's example code, or their own custom thing. Like EarthQuake says, you should talk to whomever wrote the game exporter, find out what they're expecting.

    From the documentation on the exporter:
    "hasValidTangents: This tells the engine whether the mesh already
    has valid tangents or not. If a mesh doesn’t provide valid tangents
    they will be generated by DirectX. This is not preferred as 3D packages
    tend to do a better job."

    So yup, it is using XSI's generated tangents. I confirmed this by opening up the file in notepad++ and finding that this option is marked as "TRUE" on my mesh after exporting. So the exporter is using tangents from XSI. I also applied the normal map in XSI and It looks exactly the same as it does in game.

    So my question is, if I set up my mesh to display it correctly in XSI before exporting, wont it look correct in game too? I'm assuming there has to be a way to do this, otherwise how would you use normal maps generated in zbrush or other sculpting packages with XSI.
  • Eric Chadwick
    artquest wrote: »
    if I set up my mesh to display it correctly in XSI before exporting, wont it look correct in game too?
    probably, yes. test it and see!
  • Surfa
    Offline / Send Message
    Surfa polycounter lvl 12
    What your exporter is doing is embedding the tangent data that is in xsi into the mesh and therefore the engine takes this data and uses it instead of calculating its own tangent space. Now when you bake in xsi the baker uses generates tangents that are the same as you export and therefore your normal map is calculated using the same tangents the engine uses. This means that if your bake it set up properly you will have the ideal result from your normal maps.

    If your baker and engine aren't set up properly you need to minimize the difference in tangents that are calculated. The reason you apply hard edges to uv seams is so when the engine/baker calculated tangents/bitangents it doesn't think there is a triangle that passed through two different uv islands.
  • artquest
    Offline / Send Message
    artquest polycounter lvl 13
    artquest wrote: »
    if I set up my mesh to display it correctly in XSI before exporting, wont it look correct in game too?
    probably, yes. test it and see!

    Since I'm new to XSI... anyone have an documentation on how to do this?

    Surfa wrote: »
    What your exporter is doing is embedding the tangent data that is in xsi into the mesh and therefore the engine takes this data and uses it instead of calculating its own tangent space. Now when you bake in xsi the baker uses generates tangents that are the same as you export and therefore your normal map is calculated using the same tangents the engine uses. This means that if your bake it set up properly you will have the ideal result from your normal maps.

    If your baker and engine aren't set up properly you need to minimize the difference in tangents that are calculated. The reason you apply hard edges to uv seams is so when the engine/baker calculated tangents/bitangents it doesn't think there is a triangle that passed through two different uv islands.

    correct, I was hoping for a away around re-baking the maps using XSI, however I guess I may have to do that after all.
  • Surfa
    Offline / Send Message
    Surfa polycounter lvl 12
    Well if you can find a fileformat that allows you to embed the tangents into it and carry them over properly from maya to xsi then you shouldn't have to bake the map out again as the engine will load up the tangents from maya.
  • bugo
    Offline / Send Message
    bugo polycounter lvl 17
    EarthQuake wrote: »
    Well the important aspect isn't syncing up maya and XSI, its syncing your bake to your engine. Your tangents in X baker need to match up exactly to your engine's tangents, or you'll get seams and smoothing errors.

    So, you should work with your tech team on setting up a synchronized workflow. Whether the bakes are in Maya, XSI, Xnormal, it doesn't matter, as long as it all plays nicely with your engine.


    Very true. Forgot to mention that whatever u bake in XSI/Maya/Max it gotta match what your engine does.
    Try exporting to a .fbx making sure you embed the tangent and bi-tangent data then import into xsi.

    That didn't work for me manytimes, unless new FBX versions are fixed.
  • artquest
    Offline / Send Message
    artquest polycounter lvl 13
    bugo wrote: »
    Very true. Forgot to mention that whatever u bake in XSI/Maya/Max it gotta match what your engine does.



    That didn't work for me manytimes, unless new FBX versions are fixed.
    Yeah I haven't had much luck with FBX keeping the tangents either. Seems like the engine is meant to match with XSI's tangent calculations. Just out of curiosity.. does anyone know how XSI generates it's tangents?
Sign In or Register to comment.