v4k-git-backup/engine/art/shaders/fs_shadow_vsm.glsl

15 lines
310 B
Plaintext
Raw Normal View History

2024-08-29 15:32:34 +00:00
in vec3 v_position;
out vec4 fragcolor;
2023-09-10 14:46:07 +00:00
void main() {
2024-08-29 15:32:34 +00:00
float depth = length(v_position) / 20;
2023-09-10 14:46:07 +00:00
float moment1 = depth;
float moment2 = depth * depth;
float dx = dFdx(depth);
float dy = dFdy(depth);
moment2 += 0.25*(dx*dx+dy*dy);
2024-08-29 15:32:34 +00:00
fragcolor = vec4( moment1, moment2, 0.0, 1.0);
}