Home Technical Talk

Normals are inverted when bend over corner ... sometimes

polycounter lvl 7
Offline / Send Message
gestoryscht polycounter lvl 7

Hi guys,

I do have a serious problem with normal maps, trimsheets and some shading errors.

I modelled a modular house, added some trimsheets for it and I thought, well, I am done. But sadly, I am not and I totally do not understand why, because the problem is not consistent and reproducable - at least for me. But what is the problem?

As you can see, the normal map is kind of inverted when it is bend over a corner. This could be somehow logical, for someone who does know more about shading, but the strange thing here is, that it's not happning all the time. The center on is behaving correctly (beside the fact, that it's entirley flipped)

Well, I guessed it's the UV orientation, but sadly ... it's not. For illustration purpose, I exported to be safe this model from Unreal back into Blender, and checked the UVs. As you can see, they do have the same orientatin. On the X and Y axis. So what is the probleme here?


This is all what I did so far: flipped the UVs (X&Y), did a reset on mesh vectors, checked the normal orientation, checked the normal map itself, performed several transform freezes, deleted all possible overlapping geometry and also, as an act of despair, performed a reorder of the vertex order.

I actually do not know what is happening here...

As said, I thought it could be a problem with the mesh itself, because due to their angles, it's consistent but no ... it also happens on flat surfaces:


Any help is really appreciated - this is really annoying me.

PS: It happens in both applications - Unreal and Blender. So it's not a bug on one side.


EDIT: Here is a view of the normal matcap. There is nothing flipped :/


Replies

  • Eric Chadwick
    Options
    Offline / Send Message

    What does the normal map look like?

  • gestoryscht
    Options
    Offline / Send Message
    gestoryscht polycounter lvl 7

    It looks like this, but actually with the help of "Luos - Yoeri Vleer" on the Unreal Slackers Discors Server, I have found the solution.


    The orientation of the uv islands of the first channel caused the problem. My setup was the following:

    UV00 - Global UVs for baking stuff like AO and hand painted maps or so.

    UV01 - The Texel Channel, with correct Texel Density and orientation.

    UV02 - The Trimsheet Channel.


    The problem was, that the UV00 Channel was tightly packed with various different rotations. Every island was as efficiently packed as possible. This is in this case a bad idea, because the first channel computes the tangents of the asset and affects the shading of the normal map mapped to the channel two channels later. So the solution was, in my case, to switch UV00 and UV01 and it works.

    Conclusion: The orientation of UV islands off channel 00, should match with the trimsheet channel.



  • rollin
    Options
    Offline / Send Message
    rollin polycounter

    Cool thx for posting the solution.

    Commenting here so I can find this post in the future :D

  • poopipe
    Options
    Offline / Send Message
    poopipe grand marshal polycounter


    it is possible to force computation of tangents for second/third/etc UV sets in a material - its not a particularly cheap operation so mileage may vary - if i remember correctly there's a node for it in unreal


    if you do not recompute tangents :

    rotation and non-uniform scaling (including mirroring) of uvs between sets will provoke this sort of artefact. You'll also potentially have trouble if you split/combine UV shells

    simple translation and uniform scaling are safe



    generally you want to make the most important uv set (in this case the trims) your primary and repack the same UVs without rotation to build your unique bake sets. in maya you can repack without rotation using a button, not sure what blender does

  • gestoryscht
    Options
    Offline / Send Message
    gestoryscht polycounter lvl 7

    @rollin - you are welcome :)

    @poopipe You can also untick in the asset inspector the "compute tangents" option and for one asset it was good enough (actually do not know why), but the best solution (and so did I for all) is to make proper oriented UVs.

    I always thought the most common way is what I did, to add an additional UV set, because the trimsheets are also somehow additional ... but yeah. I was wrong :D

    For now, it works to move the texel channel to UV00 ... when I run into other problems I consider making the trimsheet channel as the primary.

    Thanks for the input :)

Sign In or Register to comment.