Error in GMT exporter - bad tangent vectors

Discussion in 'Technical Archives' started by K Szczech, Sep 19, 2012.

  1. K Szczech

    K Szczech Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,720
    Likes Received:
    45
    feels3 contacted me yesterday with some weird lighting problems on his Croft circuit during sunsets / sunrises. Look at those yellow highlights on grass - they're not supposed to be there:

    [​IMG]


    Problem occured with shader:
    L2BUMPSPECULARMAPT0LERPT1XT2VERTEXALPHAMASKT0T1BUMPCH0

    Here's what mesh exported from 3D Studio looks like:

    [​IMG]

    Red lines are normals (all ok here), while green and blue lines are tangents and binormals - note these two areas marked in yellow. Angle between tangent and binormal is weird.
    Also note that vertex between marked ones - it has tangents pointing in opposite direction to other vertices.
    This explains bad lighting.



    I've used my own tool to generate tangents from first UV set and here's what I got:

    [​IMG]

    The whole area is just grass with planar texture mapping. It's clearily visible on my generated tangents that they all face the same way, which is expected from this kind of UV mapping.


    This L2.....BUMPCH0 shader has normalmap in 5th texture unit, but uses first UV set for it.
    Seems like exporter is not aware of that and generates tangents based on wrong UV channel.

    I believe this will not be the only shader with such issue.
     
    Last edited by a moderator: Sep 19, 2012
  2. Jka

    Jka Member Staff Member

    Joined:
    Jan 31, 2011
    Messages:
    954
    Likes Received:
    213
    Guys, you make my day...:cool:

    I have bang my head to the concrete wall long time with very similar problem, but some reason I didn't realize that this could be a bug with exporter... I just blamed my modelling and modding skills...:D

    Cheers!
     
  3. 88mphTim

    88mphTim racesimcentral.net

    Joined:
    Sep 23, 2010
    Messages:
    10,840
    Likes Received:
    314
    Reported, thanks.
     

Share This Page