Skip to content

Commit

Permalink
Fix black line
Browse files Browse the repository at this point in the history
  • Loading branch information
CodingJellyfish committed Jan 17, 2025
1 parent 1a36e33 commit 96b575a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions data/shaders/ssao.frag
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ out float AO;

const float bias = .0005;
const float thickness = 10.0;
const float horizon = 0.1;

#define SAMPLES 4
const float invSamples = 0.25; // 1. / SAMPLES
Expand Down Expand Up @@ -60,9 +61,7 @@ void main(void)
float h = r * alpha;
vec2 localoffset = h * rotations;

ivec2 ioccluder_uv = ivec2(x, y) + ivec2(localoffset);

if (ioccluder_uv.x < 0 || ioccluder_uv.x > int(u_screen.x) || ioccluder_uv.y < 0 || ioccluder_uv.y > int(u_screen.y)) continue;
ivec2 ioccluder_uv = clamp(ivec2(x, y) + ivec2(localoffset), ivec2(0), ivec2(u_screen));

float LinearoccluderFragmentDepth = textureLod(dtex, vec2(ioccluder_uv) / u_screen, max(m, 0.)).x;
vec3 OccluderPos = getXcYcZc(ioccluder_uv.x, ioccluder_uv.y, LinearoccluderFragmentDepth);
Expand All @@ -72,6 +71,7 @@ void main(void)
float vn = dot(vi, norm);
float w = max(0.0, 1.0 - vv / thickness / thickness);
w = w * w;
w *= step(vv * horizon * horizon, vn * vn);
bl += w * max(0., vn - FragPos.z * bias) / (vv + peak);
}

Expand Down

0 comments on commit 96b575a

Please sign in to comment.