Home Technical Talk

Baking a normal map from one UV set to another but preserving the original's tangents

polycounter lvl 10
Offline / Send Message
circle of friends polycounter lvl 10
Hi guys. I have a head that is mapped to UV0. I've created an overlay texture mapped to UV1 that is going to be a hair cap that blends with the head's skin material. 

I created a quick height->normal map from the hair cap diffuse in xnormal and applied it, but when I use this in Unity the normals are wrong and there are big seams and lighting issues because unity is calculating both the skin and the hair cap's normal maps based on UV0's tangents.

So what I need to do is rebake my UV1's normal map but based on UV0's tangents.

I tried exporting the head with both uv0 and uv1 to max, adding the uv1 haircap normal map as a normal map on uv1 mesh and did a render to texture bake on to the uv0 mesh so I effectively had the hair cap's normal map mapped to uv0 (skin), in the aim of then rendering it back to uv1 and hopefully preserving uv0's tangents. This worked as far as re-rendering the normal map, but the tangents appear to be based on uv1. 

Is there any way that I can bake out a normal map from one low to the other but preserve the tangents of the first one's uv channel? 



This is the original normal map on UV1 that was created with a simple height->normal.

I tried baking it to UV0's layout with max:



Which seems to work ok, but then when I bake it back again it just looks exactly like the first image again. I was hoping to get a much different result, taking in to account uv0's tangents.

Thanks for any help, or even just to call me an idiot. All appreciated.


Replies

  • circle of friends
    Offline / Send Message
    circle of friends polycounter lvl 10
    Here's a quick video to hopefully highlight the problem a bit more.

    https://files.facepunch.com/mattisaac/1b3111b1/2018-01-31_21-29-49.mp4

    I've managed to get it baking with Xnormal now too but I think when it uses the normals as a base to bake on to a different set of UV's it uses the new mesh/low poly's tangents - where as I want to bake the new mesh/low poly with the high poly mesh's tangents if that makes sense. I don't even know if this is possible?!


  • Thanez
    Offline / Send Message
    Thanez interpolator
    I'm having trouble understanding your issue but from what I can understand, either of these should solve your issue:
    1. Make sure the tangent normal map is applied as such and with the correct Y (green channel) orientation when you're baking. 
    2. Instead of transferring tangent normals, bake object space normals, then transfer those to the head mesh with handplane, with tangent normals as result. Object space normals ignores the surface normals of the source mesh, so only the original mesh's normals are transfered.
    3. Instead of transferring tangent normals, bake the haircap's height map over to the head and convert height->normals last.

  • circle of friends
    Offline / Send Message
    circle of friends polycounter lvl 10
    Hi thanks for your reply. It's basically this problem: 

    https://forums.unrealengine.com/development-discussion/rendering/18046-multiple-normal-maps-on-separate-uv-channels

    So its fixable in the shader. I think your solutions are for copying over a normal map which I can do. But because I'm trying to blend 2 normalo maps together in a shader, the tangents on uv1 are different to uv2's normal map so I get the seam as you can see in the video.

    I was wondering if basically there's some way to bake out a normal map for uv1 with uv0's tangents.

    I've tried adding seams to my uv1 so they uv elements are split the same but it still looks like in the video.

    I guess I'll have to combine them in the shader. 
Sign In or Register to comment.