diff options
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders')
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/common_uniforms_lib.glsl | 2 | ||||
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/volumetric_lib.glsl | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/common_uniforms_lib.glsl b/source/blender/draw/engines/eevee/shaders/common_uniforms_lib.glsl index b3174afc799..d7996ab4bd1 100644 --- a/source/blender/draw/engines/eevee/shaders/common_uniforms_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/common_uniforms_lib.glsl @@ -12,9 +12,9 @@ layout(std140) uniform common_block vec4 volJitter; vec4 volCoordScale; /* To convert volume uvs to screen uvs */ float volHistoryAlpha; - float volLightClamp; float volShadowSteps; bool volUseLights; + bool volUseSoftShadows; /* Screen Space Reflections */ vec4 ssrParameters; float ssrBorderFac; diff --git a/source/blender/draw/engines/eevee/shaders/volumetric_lib.glsl b/source/blender/draw/engines/eevee/shaders/volumetric_lib.glsl index 6d7ddd4e56e..11fd3418a72 100644 --- a/source/blender/draw/engines/eevee/shaders/volumetric_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/volumetric_lib.glsl @@ -127,6 +127,20 @@ vec3 participating_media_extinction(vec3 wpos, sampler3D volume_extinction) vec3 light_volume_shadow(LightData ld, vec3 ray_wpos, vec4 l_vector, sampler3D volume_extinction) { #if defined(VOLUME_SHADOW) + /* If light is shadowed, use the shadow vector, if not, reuse the light vector. */ + if (volUseSoftShadows && ld.l_shadowid >= 0.0) { + ShadowData sd = shadows_data[int(ld.l_shadowid)]; + + if (ld.l_type == SUN) { + l_vector.xyz = shadows_cascade_data[int(sd.sh_data_index)].sh_shadow_vec; + /* No need for length, it is recomputed later. */ + } + else { + l_vector.xyz = shadows_cube_data[int(sd.sh_data_index)].position.xyz - ray_wpos; + l_vector.w = length(l_vector.xyz); + } + } + /* Heterogeneous volume shadows */ float dd = l_vector.w / volShadowSteps; vec3 L = l_vector.xyz / volShadowSteps; |