Fix T41147: Static BVH shading problem
Fix T41079: Solid black render of object with negative scale and smooth shading In both cases the issue was caused by negative scaled objects with single mesh users for which scale gets applied when using static BVH. Since the on-fly normals calculation land normals for such cases weren't flipped leading them to point to a wrong direction. Added a special object flag for this, which is a bit of a bummer because now we've got less bits for real useful things, but this is the only way to get proper normals without adding more complexity in the on-fly calculations.
This commit is contained in:
@@ -86,7 +86,7 @@ ccl_device void shader_setup_from_ray(KernelGlobals *kg, ShaderData *sd,
|
||||
#endif
|
||||
if(sd->type & PRIMITIVE_TRIANGLE) {
|
||||
/* static triangle */
|
||||
float3 Ng = triangle_normal(kg, sd->prim);
|
||||
float3 Ng = triangle_normal(kg, sd);
|
||||
sd->shader = __float_as_int(kernel_tex_fetch(__tri_shader, sd->prim));
|
||||
|
||||
/* vectors */
|
||||
@@ -165,7 +165,7 @@ ccl_device_inline void shader_setup_from_subsurface(KernelGlobals *kg, ShaderDat
|
||||
|
||||
/* fetch triangle data */
|
||||
if(sd->type == PRIMITIVE_TRIANGLE) {
|
||||
float3 Ng = triangle_normal(kg, sd->prim);
|
||||
float3 Ng = triangle_normal(kg, sd);
|
||||
sd->shader = __float_as_int(kernel_tex_fetch(__tri_shader, sd->prim));
|
||||
|
||||
/* static triangle */
|
||||
|
Reference in New Issue
Block a user