[Bf-blender-cvs] [1b216fc2370] blender-v3.3-release: Fix T100814: Cycles wrong area light parametric texture coordinates

Brecht Van Lommel noreply at git.blender.org
Mon Sep 5 15:07:37 CEST 2022


Commit: 1b216fc237073ad9090e94b840867d35ec958eb8
Author: Brecht Van Lommel
Date:   Mon Sep 5 13:24:36 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rB1b216fc237073ad9090e94b840867d35ec958eb8

Fix T100814: Cycles wrong area light parametric texture coordinates

The fix from cefd6140f322 was for light intersection, but light sampling also
needs it.

Differential Revision: https://developer.blender.org/D15879

===================================================================

M	intern/cycles/kernel/light/light.h

===================================================================

diff --git a/intern/cycles/kernel/light/light.h b/intern/cycles/kernel/light/light.h
index b939489bb18..236819ac4b6 100644
--- a/intern/cycles/kernel/light/light.h
+++ b/intern/cycles/kernel/light/light.h
@@ -202,8 +202,12 @@ ccl_device_inline bool light_sample(KernelGlobals kg,
         inplane = ls->P - inplane;
       }
 
-      ls->u = dot(inplane, axisu) * (1.0f / dot(axisu, axisu)) + 0.5f;
-      ls->v = dot(inplane, axisv) * (1.0f / dot(axisv, axisv)) + 0.5f;
+      const float light_u = dot(inplane, axisu) * (1.0f / dot(axisu, axisu));
+      const float light_v = dot(inplane, axisv) * (1.0f / dot(axisv, axisv));
+
+      /* NOTE: Return barycentric coordinates in the same notation as Embree and OptiX. */
+      ls->u = light_v + 0.5f;
+      ls->v = -light_u - light_v;
 
       ls->Ng = Ng;
       ls->D = normalize_len(ls->P - P, &ls->t);



More information about the Bf-blender-cvs mailing list