Fix: EEVEE-Next: Broken Area light shadow
This removes the area light shadow clipping. This had issues and we are now not using any shifting behind the area light. Fix 122108
This commit is contained in:
@@ -1309,12 +1309,11 @@ struct ShadowTileMapData {
|
||||
int clip_data_index;
|
||||
/** Light type this tilemap is from. */
|
||||
eLightType light_type;
|
||||
/** True if the tilemap is part of area light shadow and is one of the side projections. */
|
||||
bool32_t is_area_side;
|
||||
/** Entire tilemap (all tiles) needs to be tagged as dirty. */
|
||||
bool32_t is_dirty;
|
||||
|
||||
float _pad1;
|
||||
float _pad2;
|
||||
/** Near and far clip distances for punctual. */
|
||||
float clip_near;
|
||||
float clip_far;
|
||||
@@ -1332,9 +1331,7 @@ struct ShadowRenderView {
|
||||
/**
|
||||
* Is either:
|
||||
* - positive radial distance for point lights.
|
||||
* - negative distance to light plane (divided by sqrt3) for area lights side projections.
|
||||
* - zero if disabled.
|
||||
* Use sign to determine with case we are in.
|
||||
*/
|
||||
float clip_distance_inv;
|
||||
/** Viewport to submit the geometry of this tile-map view to. */
|
||||
|
||||
@@ -36,7 +36,6 @@ void ShadowTileMap::sync_orthographic(const float4x4 &object_mat_,
|
||||
projection_type = projection_type_;
|
||||
level = clipmap_level;
|
||||
light_type = eLightType::LIGHT_SUN;
|
||||
is_area_side = false;
|
||||
|
||||
grid_shift = origin_offset - grid_offset;
|
||||
grid_offset = origin_offset;
|
||||
@@ -74,7 +73,6 @@ void ShadowTileMap::sync_cubeface(
|
||||
cubeface = face;
|
||||
grid_offset = int2(0);
|
||||
light_type = light_type_;
|
||||
is_area_side = is_area_light(light_type) && (face != eCubeFace::Z_NEG);
|
||||
|
||||
if ((clip_near != near_) || (clip_far != far_)) {
|
||||
set_dirty();
|
||||
|
||||
@@ -138,11 +138,7 @@ void main()
|
||||
render_view_buf[view_index].is_directional = !is_cubemap;
|
||||
render_view_buf[view_index].clip_near = clip_near;
|
||||
/* Clipping setup. */
|
||||
if (tilemap_data.is_area_side) {
|
||||
/* Negative for tagging this case. See shadow_clip_vector_get for explanation. */
|
||||
render_view_buf[view_index].clip_distance_inv = -1.0;
|
||||
}
|
||||
else if (is_point_light(tilemap_data.light_type)) {
|
||||
if (is_point_light(tilemap_data.light_type)) {
|
||||
/* Clip as a sphere around the clip_near cube. */
|
||||
render_view_buf[view_index].clip_distance_inv = M_SQRT1_3 / tilemap_data.clip_near;
|
||||
}
|
||||
|
||||
@@ -179,13 +179,7 @@ vec3 shadow_clip_vector_get(vec3 view_position, float clip_distance_inv)
|
||||
/* No clipping. */
|
||||
return vec3(2.0);
|
||||
}
|
||||
|
||||
if (clip_distance_inv < 0.0) {
|
||||
/* Area light side projections. Clip using the up axis (which maps to light -Z). */
|
||||
/* NOTE: clip_distance_inv should already be scaled by M_SQRT3. */
|
||||
return vec3(view_position.y * clip_distance_inv);
|
||||
}
|
||||
/* Sphere light case. */
|
||||
/* Punctual shadow case. */
|
||||
return view_position * clip_distance_inv;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user