Skip to content

Commit

Permalink
Stronger bias when resolution is lower
Browse files Browse the repository at this point in the history
  • Loading branch information
CodingJellyfish committed Jan 18, 2025
1 parent 3020642 commit 42bd29a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions data/shaders/ssao.frag
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ uniform float k;
uniform float sigma;
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 @@ -50,6 +48,10 @@ void main(void)
float peak2 = peak * peak;
float intensity = 2.0 * 3.14159 * sigma * peak * invSamples;

// Apply stronger bias when the resolution is lower.
float horizon = min(100. / min(u_screen.x, u_screen.y), 0.3);
float bias = min(1. / min(u_screen.x, u_screen.y), 0.003);

float theta = phi * 2.0 * 2.4 * 3.14159;
vec2 rotations = vec2(cos(theta), sin(theta)) * u_screen;
vec2 offset = vec2(cos(invSamples), sin(invSamples));
Expand Down

0 comments on commit 42bd29a

Please sign in to comment.