[Bf-blender-cvs] [8831c6f0561] blender-v3.4-release: Fix T101965: Shadow bounds ignore the light Volume Factor

Miguel Pozo noreply at git.blender.org
Tue Nov 15 18:41:04 CET 2022


Commit: 8831c6f05618f5405c092449ab514136bfc6f4d7
Author: Miguel Pozo
Date:   Tue Nov 15 18:40:58 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rB8831c6f05618f5405c092449ab514136bfc6f4d7

Fix T101965: Shadow bounds ignore the light Volume Factor

Take invsqrdist_volume into account for computing shadow bounds.

Reviewed By: fclem

Maniphest Tasks: T101965

Differential Revision: https://developer.blender.org/D16513

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

M	source/blender/draw/engines/eevee/eevee_shadows_cube.c

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

diff --git a/source/blender/draw/engines/eevee/eevee_shadows_cube.c b/source/blender/draw/engines/eevee/eevee_shadows_cube.c
index df9ee253317..b18644c7d98 100644
--- a/source/blender/draw/engines/eevee/eevee_shadows_cube.c
+++ b/source/blender/draw/engines/eevee/eevee_shadows_cube.c
@@ -38,7 +38,7 @@ void EEVEE_shadows_cube_add(EEVEE_LightsInfo *linfo, EEVEE_Light *evli, Object *
   /* Saving light bounds for later. */
   BoundSphere *cube_bound = linfo->shadow_bounds + linfo->cube_len;
   copy_v3_v3(cube_bound->center, evli->position);
-  cube_bound->radius = sqrt(1.0f / evli->invsqrdist);
+  cube_bound->radius = sqrt(1.0f / min_ff(evli->invsqrdist, evli->invsqrdist_volume));
 
   linfo->shadow_cube_light_indices[linfo->cube_len] = linfo->num_light;
   evli->shadow_id = linfo->shadow_len++;
@@ -87,7 +87,7 @@ bool EEVEE_shadows_cube_setup(EEVEE_LightsInfo *linfo, const EEVEE_Light *evli,
 
   eevee_light_matrix_get(evli, cube_data->shadowmat);
 
-  shdw_data->far = max_ff(sqrt(1.0f / evli->invsqrdist), 3e-4);
+  shdw_data->far = max_ff(sqrt(1.0f / min_ff(evli->invsqrdist, evli->invsqrdist_volume)), 3e-4);
   shdw_data->near = min_ff(shdw_data->near, shdw_data->far - 1e-4);
 
   bool update = false;



More information about the Bf-blender-cvs mailing list