diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2017-11-24 08:15:42 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2017-11-24 08:37:37 +0300 |
commit | 2302ba2245f1e65dde7870cc9ab610ded5abc364 (patch) | |
tree | f504f772ab4a6e5dee5bbada56b5b421e8a2b842 /source/blender/draw/engines/eevee/shaders/lamps_lib.glsl | |
parent | 16a28021493d5a54efff5e6aade39f7b015366cd (diff) |
Eevee: Refactor of lit_surface_frag.glsl
This cleanup removes the need of gigantic code duplication for each closure.
This also make some preformance improvement since it removes some branches and duplicated loops.
It also fix some mismatch (between cycles and eevee) with the principled shader.
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/lamps_lib.glsl')
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/lamps_lib.glsl | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/lamps_lib.glsl b/source/blender/draw/engines/eevee/shaders/lamps_lib.glsl index 1b4addaa4ed..933f056c401 100644 --- a/source/blender/draw/engines/eevee/shaders/lamps_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/lamps_lib.glsl @@ -296,9 +296,13 @@ vec3 sss_profile(float s) { vec3 light_translucent(LightData ld, vec3 W, vec3 N, vec4 l_vector, float scale) { - vec3 vis = vec3(1.0); +#if !defined(USE_TRANSLUCENCY) || defined(VOLUMETRICS) + return vec3(0.0); +#endif #ifndef VOLUMETRICS + vec3 vis = vec3(1.0); + /* Only shadowed light can produce translucency */ if (ld.l_shadowid >= 0.0) { ShadowData data = shadows_data[int(ld.l_shadowid)]; @@ -410,9 +414,9 @@ vec3 light_translucent(LightData ld, vec3 W, vec3 N, vec4 l_vector, float scale) else { vis = vec3(0.0); } -#endif return vis; +#endif } #ifdef HAIR_SHADER |