feat: deferred lighting (WIP)

This commit is contained in:
MihailRis
2025-06-14 22:43:18 +03:00
parent 2ad076bec3
commit e849d5e9b7
10 changed files with 105 additions and 12 deletions
+4 -5
View File
@@ -1,13 +1,12 @@
#param vec3 u_ssaoSamples[64]
#param int u_kernelSize = 16
#param float u_radius = 0.25
#param float u_bias = 0.025
#param float u_radius = 0.2
#param float u_bias = 0.006
vec4 effect() {
vec2 noiseScale = u_screenSize / 4.0;
vec3 position = texture(u_position, v_uv).xyz;
vec3 color = texture(u_screen, v_uv).rgb;
vec3 normal = texture(u_normal, v_uv).xyz;
vec3 randomVec = normalize(texture(u_noise, v_uv * noiseScale).xyz);
@@ -31,7 +30,7 @@ vec4 effect() {
}
occlusion = min(1.0, 1.05 - (occlusion / u_kernelSize));
float z = -position.z * 0.02;
float z = -position.z * 0.01;
z = max(0.0, 1.0 - z);
return vec4(color * mix(1.0, occlusion, z), 1.0);
return vec4(occlusion, 0.0, 0.0, 1.0);
}