diff options
author | Brecht Van Lommel <brecht@blender.org> | 2021-10-04 13:19:18 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-10-04 14:58:37 +0300 |
commit | a80a2f07b7f824383b8df03f11055fc1bf6a6bd9 (patch) | |
tree | 7c4fbc18fb035deb0cace8e0dc3ebf09fe5be04a /intern/cycles/kernel/osl | |
parent | 76238af213d44349821612db6a43f3a89d9be5f4 (diff) |
Fix T90815: wrong Cycles OSL normal map render after recent optimization
Diffstat (limited to 'intern/cycles/kernel/osl')
-rw-r--r-- | intern/cycles/kernel/osl/osl_services.cpp | 13 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/osl_services.h | 1 |
2 files changed, 13 insertions, 1 deletions
diff --git a/intern/cycles/kernel/osl/osl_services.cpp b/intern/cycles/kernel/osl/osl_services.cpp index 4fc46a255a8..2c7f5eb4948 100644 --- a/intern/cycles/kernel/osl/osl_services.cpp +++ b/intern/cycles/kernel/osl/osl_services.cpp @@ -110,6 +110,7 @@ ustring OSLRenderServices::u_curve_thickness("geom:curve_thickness"); ustring OSLRenderServices::u_curve_length("geom:curve_length"); ustring OSLRenderServices::u_curve_tangent_normal("geom:curve_tangent_normal"); ustring OSLRenderServices::u_curve_random("geom:curve_random"); +ustring OSLRenderServices::u_normal_map_normal("geom:normal_map_normal"); ustring OSLRenderServices::u_path_ray_length("path:ray_length"); ustring OSLRenderServices::u_path_ray_depth("path:ray_depth"); ustring OSLRenderServices::u_path_diffuse_depth("path:diffuse_depth"); @@ -985,8 +986,18 @@ bool OSLRenderServices::get_object_standard_attribute(const KernelGlobals *kg, float3 f = curve_tangent_normal(kg, sd); return set_attribute_float3(f, type, derivatives, val); } - else + else if (name == u_normal_map_normal) { + if (sd->type & PRIMITIVE_ALL_TRIANGLE) { + float3 f = triangle_smooth_normal_unnormalized(kg, sd, sd->Ng, sd->prim, sd->u, sd->v); + return set_attribute_float3(f, type, derivatives, val); + } + else { + return false; + } + } + else { return false; + } } bool OSLRenderServices::get_background_attribute(const KernelGlobals *kg, diff --git a/intern/cycles/kernel/osl/osl_services.h b/intern/cycles/kernel/osl/osl_services.h index 2a5400282b3..a9671485eda 100644 --- a/intern/cycles/kernel/osl/osl_services.h +++ b/intern/cycles/kernel/osl/osl_services.h @@ -297,6 +297,7 @@ class OSLRenderServices : public OSL::RendererServices { static ustring u_curve_length; static ustring u_curve_tangent_normal; static ustring u_curve_random; + static ustring u_normal_map_normal; static ustring u_path_ray_length; static ustring u_path_ray_depth; static ustring u_path_diffuse_depth; |