diff options
author | Brecht Van Lommel <brecht@blender.org> | 2022-07-26 17:07:50 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2022-07-27 22:03:33 +0300 |
commit | 38af5b0501005d8ee84a59f027417bf6a31fcc5e (patch) | |
tree | 0856dd31787e59abe9300a8d4b3c6b37be3cfbc8 /intern/cycles/kernel/light | |
parent | 69f2732a1391680d252c86365b2df62b084ceeb8 (diff) |
Cycles: switch Cycles triangle barycentric convention to match Embree/OptiX
Simplifies intersection code a little and slightly improves precision regarding
self intersection.
The parametric texture coordinate in shader nodes is still the same as before
for compatibility.
Diffstat (limited to 'intern/cycles/kernel/light')
-rw-r--r-- | intern/cycles/kernel/light/sample.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/intern/cycles/kernel/light/sample.h b/intern/cycles/kernel/light/sample.h index 210bb1b35c2..2e309cee43f 100644 --- a/intern/cycles/kernel/light/sample.h +++ b/intern/cycles/kernel/light/sample.h @@ -137,8 +137,9 @@ ccl_device_inline float3 shadow_ray_smooth_surface_offset( triangle_vertices_and_normals(kg, sd->prim, V, N); } - const float u = sd->u, v = sd->v; - const float w = 1 - u - v; + const float u = 1.0f - sd->u - sd->v; + const float v = sd->u; + const float w = sd->v; float3 P = V[0] * u + V[1] * v + V[2] * w; /* Local space */ float3 n = N[0] * u + N[1] * v + N[2] * w; /* We get away without normalization */ |