[Bf-blender-cvs] [07e6e5edfb9] blender2.8: Eevee: Fix extinction of Light parallel to views.

Clément Foucault noreply at git.blender.org
Tue Sep 12 16:18:24 CEST 2017


Commit: 07e6e5edfb9fc14f4951d495871605f48d431709
Author: Clément Foucault
Date:   Tue Sep 12 16:18:18 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB07e6e5edfb9fc14f4951d495871605f48d431709

Eevee: Fix extinction of Light parallel to views.

This was a problem with orthographic views and lights without rotations. This introduce a small bias that should fix most cases.

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

M	source/blender/draw/engines/eevee/shaders/ltc_lib.glsl

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

diff --git a/source/blender/draw/engines/eevee/shaders/ltc_lib.glsl b/source/blender/draw/engines/eevee/shaders/ltc_lib.glsl
index f296eedc3ee..ffaa81c3638 100644
--- a/source/blender/draw/engines/eevee/shaders/ltc_lib.glsl
+++ b/source/blender/draw/engines/eevee/shaders/ltc_lib.glsl
@@ -161,9 +161,12 @@ mat3 ltc_matrix(vec4 lut)
 
 float ltc_evaluate(vec3 N, vec3 V, mat3 Minv, vec3 corners[4])
 {
+	/* Avoid dot(N, V) == 1 in ortho mode, leading T1 normalize to fail. */
+	V = normalize(V + 1e-8);
+
 	/* construct orthonormal basis around N */
 	vec3 T1, T2;
-	T1 = normalize(V - N*dot(V, N));
+	T1 = normalize(V - N * dot(N, V));
 	T2 = cross(N, T1);
 
 	/* rotate area light in (T1, T2, R) basis */
@@ -206,9 +209,12 @@ float ltc_evaluate(vec3 N, vec3 V, mat3 Minv, vec3 corners[4])
 #define LTC_CIRCLE_RES 8
 float ltc_evaluate_circle(vec3 N, vec3 V, mat3 Minv, vec3 p[LTC_CIRCLE_RES])
 {
+	/* Avoid dot(N, V) == 1 in ortho mode, leading T1 normalize to fail. */
+	V = normalize(V + 1e-8);
+
 	/* construct orthonormal basis around N */
 	vec3 T1, T2;
-	T1 = normalize(V - N*dot(V, N));
+	T1 = normalize(V - N * dot(V, N));
 	T2 = cross(N, T1);
 
 	/* rotate area light in (T1, T2, R) basis */



More information about the Bf-blender-cvs mailing list