[Bf-blender-cvs] [d082b18d877] blender2.8: Eevee: Optimisation: Bypass light power calculation when not needed
Clément Foucault
noreply at git.blender.org
Thu Nov 15 18:17:32 CET 2018
Commit: d082b18d877f2da661ee2a48fdf3c69d67406e86
Author: Clément Foucault
Date: Wed Nov 14 16:03:24 2018 +0100
Branches: blender2.8
https://developer.blender.org/rBd082b18d877f2da661ee2a48fdf3c69d67406e86
Eevee: Optimisation: Bypass light power calculation when not needed
This makes quite a big improvement in my case 1.8ms vs 2.3ms for a single
area light.
This will make even more difference with light attenuation.
===================================================================
M source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl
===================================================================
diff --git a/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl b/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl
index 091709ebdd1..5631957ca31 100644
--- a/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl
+++ b/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl
@@ -215,7 +215,12 @@ void CLOSURE_NAME(
l_vector.xyz = ld.l_position - worldPosition;
l_vector.w = length(l_vector.xyz);
- vec3 l_color_vis = ld.l_color * light_visibility(ld, worldPosition, viewPosition, viewNormal, l_vector);
+ float l_vis = light_visibility(ld, worldPosition, viewPosition, viewNormal, l_vector);
+
+ if (l_vis < 1e-8)
+ continue;
+
+ vec3 l_color_vis = ld.l_color * l_vis;
#ifdef CLOSURE_DIFFUSE
out_diff += l_color_vis * light_diffuse(ld, N, V, l_vector);
More information about the Bf-blender-cvs
mailing list