Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/volumetric_lib.glsl')
-rw-r--r--source/blender/draw/engines/eevee/shaders/volumetric_lib.glsl14
1 files changed, 14 insertions, 0 deletions
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;