Page MenuHome

Fix T49187: inconsistent Normal Map node output for backfacing polygons.
ClosedPublic

Authored by Alexander Gavrilov (angavrilov) on Aug 29 2016, 12:10 PM.

Details

Summary

There basically are two issues here: in smooth mode (and all non-tangent
normal map types) it doesn't invert the normal for backfacing polys;
on the other hand for flat shaded tangent type it is inverted too soon.

This fix does a brute force correction by checking the backfacing flag.

Diff Detail

Repository
rB Blender

Event Timeline

Alexander Gavrilov (angavrilov) retitled this revision from to Fix T49187: inconsistent Normal Map node output for backfacing polygons..
Alexander Gavrilov (angavrilov) updated this object.

Code and results look correct to me.

Although not entirely related to the original issue, maybe we should use faceforward() on the resulting normal, as it doesn't make much sense to have a normal pointing into the surface, but not sure if that's a good idea or not.

Looks good, just one comment.

intern/cycles/kernel/svm/svm_tex_coord.h
280

Use (ccl_fetch(sd, flag) & SD_BACKFACING) == 0 in case SD_BACKFACING doesn't fit in bool. It does now but best to be safe.

This revision is now accepted and ready to land.Aug 29 2016, 11:51 PM
This revision was automatically updated to reflect the committed changes.