Skip to content

Commit

Permalink
Tune
Browse files Browse the repository at this point in the history
  • Loading branch information
CodingJellyfish committed Feb 5, 2025
1 parent d0670f4 commit 909faf8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions data/shaders/sunlightshadowpcss.frag
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ mat2 getRandomRotationMatrix(vec2 fragCoord)
}

void blockerSearchAndFilter(out float occludedCount, out float z_occSum,
vec2 uv, float z_rec, uint layer, vec2 filterRadii, mat2 R, vec2 dz_duv)
vec2 uv, float z_rec, uint layer, vec2 filterRadii, vec2 dz_duv)
{
// Make sure no light leaking
float z_occ = texture(shadowtexdepth, vec3(uv, float(layer))).r;
Expand All @@ -110,7 +110,7 @@ void blockerSearchAndFilter(out float occludedCount, out float z_occSum,

for (uint i = 0u; i < 8u; i++)
{
vec2 duv = R * sample_point_pos[i] * filterRadii;
vec2 duv = sample_point_pos[i] * filterRadii;
vec2 tc = clamp(uv + duv, vec2(0.), vec2(1.));
// receiver plane depth bias
float z_bias = dot(dz_duv, duv);
Expand Down Expand Up @@ -149,7 +149,7 @@ float getShadowFactor(vec3 position, vec3 bbox, vec2 dz_duv, uint layer)
float occludedCount = 0.0;
float z_occSum = 0.0;

blockerSearchAndFilter(occludedCount, z_occSum, position.xy, position.z, layer, penumbra / bbox.xy, R, dz_duv);
blockerSearchAndFilter(occludedCount, z_occSum, position.xy, position.z, layer, penumbra / bbox.xy, dz_duv);

// early exit if there is no occluders at all, also avoids a divide-by-zero below.
if (z_occSum == 0.0) {
Expand Down
2 changes: 1 addition & 1 deletion src/graphics/shadow_matrices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ core::matrix4 ShadowMatrices::getTightestFitOrthoProj(const core::matrix4 &trans
if (left == right || up == down)
return tmp_matrix;

float vnear = std::min((zmax + zmin) / 2 - 200, zmin); // 200m above karts
float vnear = std::min((zmax + zmin) / 2 - 250, zmin); // 250m above karts
tmp_matrix.buildProjectionMatrixOrthoLH(left, right,
down, up,
vnear, zmax);
Expand Down

0 comments on commit 909faf8

Please sign in to comment.