Fix: EEVEE-Next: Fix broken shadow global resolution scale
It was not connected to anything.
This commit is contained in:
@@ -87,9 +87,10 @@ void Light::sync(ShadowModule &shadows,
|
||||
this->power[LIGHT_TRANSMISSION] = la->transmission_fac * shape_power * transmission_visibility;
|
||||
this->power[LIGHT_VOLUME] = la->volume_fac * point_power * volume_visibility;
|
||||
|
||||
this->lod_bias = (1.0f - la->shadow_resolution_scale) * SHADOW_TILEMAP_LOD;
|
||||
this->lod_bias = max((1.0f - la->shadow_resolution_scale) * SHADOW_TILEMAP_LOD,
|
||||
shadows.global_lod_bias());
|
||||
this->lod_min = shadow_lod_min_get(la);
|
||||
this->pcf_radius = la->shadow_filter_radius;
|
||||
this->filter_radius = la->shadow_filter_radius;
|
||||
this->shadow_jitter = (la->mode & LA_SHADOW_JITTER) != 0;
|
||||
|
||||
if (la->mode & LA_SHADOW) {
|
||||
|
||||
@@ -985,7 +985,7 @@ struct LightData {
|
||||
/** Index of the first tile-map. Set to LIGHT_NO_SHADOW if light is not casting shadow. */
|
||||
int tilemap_index;
|
||||
/* Radius in pixels for shadow filtering. */
|
||||
float pcf_radius;
|
||||
float filter_radius;
|
||||
|
||||
/* Shadow Map resolution bias. */
|
||||
float lod_bias;
|
||||
|
||||
@@ -569,6 +569,8 @@ void ShadowModule::init()
|
||||
|
||||
::Scene &scene = *inst_.scene;
|
||||
|
||||
global_lod_bias_ = (1.0f - scene.eevee.shadow_resolution_scale) * SHADOW_TILEMAP_LOD;
|
||||
|
||||
bool update_lights = false;
|
||||
bool enable_shadow = (scene.eevee.flag & SCE_EEVEE_SHADOW_ENABLED) != 0;
|
||||
bool use_jitter = enable_shadow &&
|
||||
|
||||
@@ -305,6 +305,8 @@ class ShadowModule {
|
||||
|
||||
/** Scene immutable parameters. */
|
||||
|
||||
/* Render setting that reduces the LOD for every light. */
|
||||
float global_lod_bias_ = 0.0f;
|
||||
/** For now, needs to be hardcoded. */
|
||||
int shadow_page_size_ = SHADOW_PAGE_RES;
|
||||
/** Maximum number of allocated pages. Maximum value is SHADOW_MAX_TILEMAP. */
|
||||
@@ -350,6 +352,11 @@ class ShadowModule {
|
||||
return data_;
|
||||
}
|
||||
|
||||
float global_lod_bias() const
|
||||
{
|
||||
return global_lod_bias_;
|
||||
}
|
||||
|
||||
/* Set all shadows to update. To be called before `end_sync`. */
|
||||
void reset()
|
||||
{
|
||||
|
||||
@@ -451,7 +451,7 @@ float shadow_eval(LightData light,
|
||||
/* Avoid self intersection with respect to numerical precision. */
|
||||
P = offset_ray(P, N_bias);
|
||||
/* Stochastic Percentage Closer Filtering. */
|
||||
P += (light.pcf_radius * texel_radius) * shadow_pcf_offset(L, Ng, random_pcf_2d);
|
||||
P += (light.filter_radius * texel_radius) * shadow_pcf_offset(L, Ng, random_pcf_2d);
|
||||
/* Add normal bias to avoid aliasing artifacts. */
|
||||
P += N_bias * (texel_radius * shadow_normal_offset(Ng, L));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user