mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 20:59:19 +02:00
Specgloss shaders improvements + experimental SSAO (debug only)
This commit is contained in:
22
shaders/postfx_ssao_apply.frag
Normal file
22
shaders/postfx_ssao_apply.frag
Normal file
@@ -0,0 +1,22 @@
|
||||
in vec2 f_coords;
|
||||
layout(location = 0) out vec4 out_color;
|
||||
|
||||
#texture (color_tex, 0, RGB)
|
||||
uniform sampler2D color_tex;
|
||||
|
||||
#texture (ssao_tex, 1, R)
|
||||
uniform sampler2D ssao_tex;
|
||||
|
||||
const float SSAO_STRENGTH = 0.8;
|
||||
const float SSAO_MIN = 0.3; // floor on darkening so shadows don't go pitch black
|
||||
|
||||
void main() {
|
||||
vec3 c = texture(color_tex, f_coords).rgb;
|
||||
float occ = texture(ssao_tex, f_coords).r;
|
||||
|
||||
// remap occlusion with strength and a minimum floor
|
||||
occ = pow(clamp(occ, 0.0, 1.0), SSAO_STRENGTH);
|
||||
occ = mix(SSAO_MIN, 1.0, occ);
|
||||
|
||||
out_color = vec4(c * occ, 1.0);
|
||||
}
|
||||
Reference in New Issue
Block a user