summaryrefslogtreecommitdiff
path: root/intermediate/ts.glsl
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2025-02-22 23:24:35 +1100
committerquou <quou@disroot.org>2025-02-22 23:25:55 +1100
commit3634e53cc68671a576754d6bb668f585f7e2c53d (patch)
tree7e22902d96d13d3cecc72c92155de47f8db5f5de /intermediate/ts.glsl
parented5d6dfa2ed08c5a9185f3eb4ffb4deb898ed2af (diff)
basic temporal coherence for shadowHEADmaster
Diffstat (limited to 'intermediate/ts.glsl')
-rw-r--r--intermediate/ts.glsl15
1 files changed, 13 insertions, 2 deletions
diff --git a/intermediate/ts.glsl b/intermediate/ts.glsl
index 23195f6..61dd728 100644
--- a/intermediate/ts.glsl
+++ b/intermediate/ts.glsl
@@ -138,11 +138,22 @@ vec3 get_world_pos(float depth, vec2 uv) {
}
void main() {
+ float w_prev = 0.9;
+ float w_cur = 0.1;
vec2 uv = interpolator.uv;
float d = texture(depthmap, uv).r;
vec3 wpos = get_world_pos(d, uv);
- float prev = texture(previous, uv).r;
+ vec4 prev_pos = config.prev_vp * vec4(wpos, 1.0);
+ vec2 prev_uv = (prev_pos.xy / prev_pos.w) * 0.5 + 0.5;
+ float prev = texture(previous, prev_uv).r;
float current = get_shadow(caster_config.index, wpos);
- shadow_amount = (prev + current) * 0.5;
+ if (
+ prev_uv.x < 0.0 || prev_uv.x > 1.0 ||
+ prev_uv.y < 0.0 || prev_uv.y > 1.0
+ ) {
+ w_prev = 0.0;
+ w_cur = 1.0;
+ }
+ shadow_amount = (prev * w_prev + current * w_cur);
}
#endif