Page MenuHome

Normal Map Baking Doesn't Flip Back Faces
Confirmed, NormalPublicBUG

Description

When baking with "selected to active", Cycles fails to detect when it's hit a back face and needs to flip the normal. This is important since it's the nature of baking low-poly objects from high-poly ones that polygon intersections happen, which leads to flipped normals in the final map. Offsetting the cage vertices along their normals (the "cage" option") to avoid intersections gives visual errors on fine concave features like mouth corners, noses, etc.

I wrote an OSL shader to bake out normals maps with properly flipped normals. Here is a comparison of a normal map baked with a tweaked cage offset (top) and the shader (bottom).

On a related note, it might be a good idea to flip all baked normals greater than 90 degrees to the original surface normal for tangent space baking.

Event Timeline

Here's the normal map osl shader.

For anyone who tries the shader, you have to bake in "Combined" with "View Transform" under Color Management set to "Raw."

I'm not sure if this is a bug or a request for modified/improved behavior.

For user requests and feedback, please use other channels: https://wiki.blender.org/wiki/Communication/Contact#User_Feedback_and_Requests

For more information on what is considered a bug, visit: https://wiki.blender.org/wiki/Reference/Not_a_bug

Germano Cavalcante (mano-wii) changed the task status from Needs Triage to Needs Information from User.Mon, Mar 9, 6:56 PM

In this case we need a simple .blend file showing the problem (as explained in our submission template and guidelines).
Also explained here: https://www.youtube.com/watch?v=JTD0OJq_rF4

(But I'm still not sure if inverted normal should be seen as a bug)

It's definitely a bug, here's an example image.

And here's a file. Just press "bake"

Here's a file with the OSL shader to demonstrate proper behavior (same as before, just press bake):

Thanks.

Germano Cavalcante (mano-wii) changed the task status from Needs Information from User to Needs Triage.Tue, Mar 17, 8:29 PM

I get

Blender.app/Contents/Resources/2.83/scripts/addons/cycles/ui.py:1912
rna_uiItemR: property not found: BakeSettings.use_pass_subsurface

and

Circular dependency for image "Head2B_Normals.png" from object "Topology"
Uninitialized image "Head2B_Normals.png" from object "Topology"

Germano Cavalcante (mano-wii) changed the task status from Needs Triage to Confirmed.Thu, Mar 19, 4:08 PM
Germano Cavalcante (mano-wii) changed the subtype of this task from "Report" to "Bug".

Marking it as a bug.
Needs a closer look to see if flipping would break other things but is worth investigating.