Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/eevee/eevee_shadows_cube.c
| Show All 32 Lines | void EEVEE_shadows_cube_add(EEVEE_LightsInfo *linfo, EEVEE_Light *evli, Object *ob) | ||||
| sh_data->near = max_ff(la->clipsta, 1e-8f); | sh_data->near = max_ff(la->clipsta, 1e-8f); | ||||
| sh_data->bias = max_ff(la->bias * 0.05f, 0.0f); | sh_data->bias = max_ff(la->bias * 0.05f, 0.0f); | ||||
| eevee_contact_shadow_setup(la, sh_data); | eevee_contact_shadow_setup(la, sh_data); | ||||
| /* Saving light bounds for later. */ | /* Saving light bounds for later. */ | ||||
| BoundSphere *cube_bound = linfo->shadow_bounds + linfo->cube_len; | BoundSphere *cube_bound = linfo->shadow_bounds + linfo->cube_len; | ||||
| copy_v3_v3(cube_bound->center, evli->position); | 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; | linfo->shadow_cube_light_indices[linfo->cube_len] = linfo->num_light; | ||||
| evli->shadow_id = linfo->shadow_len++; | evli->shadow_id = linfo->shadow_len++; | ||||
| sh_data->type_data_id = linfo->cube_len++; | sh_data->type_data_id = linfo->cube_len++; | ||||
| /* Same as linfo->cube_len, no need to save. */ | /* Same as linfo->cube_len, no need to save. */ | ||||
| linfo->num_cube_layer++; | linfo->num_cube_layer++; | ||||
| } | } | ||||
| Show All 32 Lines | |||||
| bool EEVEE_shadows_cube_setup(EEVEE_LightsInfo *linfo, const EEVEE_Light *evli, int sample_ofs) | bool EEVEE_shadows_cube_setup(EEVEE_LightsInfo *linfo, const EEVEE_Light *evli, int sample_ofs) | ||||
| { | { | ||||
| EEVEE_Shadow *shdw_data = linfo->shadow_data + (int)evli->shadow_id; | EEVEE_Shadow *shdw_data = linfo->shadow_data + (int)evli->shadow_id; | ||||
| EEVEE_ShadowCube *cube_data = linfo->shadow_cube_data + (int)shdw_data->type_data_id; | EEVEE_ShadowCube *cube_data = linfo->shadow_cube_data + (int)shdw_data->type_data_id; | ||||
| eevee_light_matrix_get(evli, cube_data->shadowmat); | 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); | shdw_data->near = min_ff(shdw_data->near, shdw_data->far - 1e-4); | ||||
| bool update = false; | bool update = false; | ||||
| if (linfo->soft_shadows) { | if (linfo->soft_shadows) { | ||||
| shadow_cube_random_position_set(evli, sample_ofs, cube_data->shadowmat[3]); | shadow_cube_random_position_set(evli, sample_ofs, cube_data->shadowmat[3]); | ||||
| /* Update if position changes (avoid infinite update if soft shadows does not move). | /* Update if position changes (avoid infinite update if soft shadows does not move). | ||||
| * Other changes are caught by depsgraph tagging. This one is for update between samples. */ | * Other changes are caught by depsgraph tagging. This one is for update between samples. */ | ||||
| ▲ Show 20 Lines • Show All 111 Lines • Show Last 20 Lines | |||||