Fix T41219: Cycles backface detection doesn't work properly

Root of the issue goes back to the on-fly normals commit and the
latest fix for it wasn't actually correct. I've mixed two fixes
in there.

So the idea here goes back to storing negative scaled object flag
and flip runtime-calculated normal if this flag is set, which is
pretty much the same as the original fix for the issue from me.

The issue with motion blur wasn't caused by the rumtime normals
patch and it had issues before, because it already did runtime
normals calculation. Now made it so motion triangles takes the
negative scale flag into account.

This actually makes code more clean imo and avoids rather confusing
flipping code in mesh.cpp.
This commit is contained in:
Sergey Sharybin
2014-08-13 16:19:12 +06:00
parent 8d801c3afd
commit bfaf4f2d0d
8 changed files with 21 additions and 22 deletions

View File

@@ -215,7 +215,7 @@ ccl_device void kernel_bake_evaluate(KernelGlobals *kg, ccl_global uint4 *input,
int shader;
float3 P, Ng;
triangle_point_normal(kg, prim, u, v, &P, &Ng, &shader);
triangle_point_normal(kg, object, prim, u, v, &P, &Ng, &shader);
/* dummy initilizations copied from SHADER_EVAL_DISPLACE */
float3 I = Ng;