From a3183fb95f4d94376ee8993b5fef848ba8af4063 Mon Sep 17 00:00:00 2001 From: Alaska Date: Mon, 5 Feb 2024 13:56:18 +0100 Subject: [PATCH] Fix #117771: Incorrect Cycles texture position on emissive triangles Pull Request: https://projects.blender.org/blender/blender/pulls/117801 --- intern/cycles/kernel/light/triangle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intern/cycles/kernel/light/triangle.h b/intern/cycles/kernel/light/triangle.h index 509f1a5885d..50475b223eb 100644 --- a/intern/cycles/kernel/light/triangle.h +++ b/intern/cycles/kernel/light/triangle.h @@ -237,7 +237,7 @@ ccl_device_forceinline bool triangle_light_sample(KernelGlobals kg, } const float t = 1.0f - u - v; - ls->P = u * V[0] + v * V[1] + t * V[2]; + ls->P = t * V[0] + u * V[1] + v * V[2]; /* compute incoming direction, distance and pdf */ ls->D = normalize_len(ls->P - P, &ls->t); ls->pdf = triangle_light_pdf_area_sampling(ls->Ng, -ls->D, ls->t) / area;