refactor: make the whole thing more generic

This commit is contained in:
2024-04-02 16:28:57 +02:00
parent 7b648e1955
commit 651f3ad808
193 changed files with 763 additions and 521 deletions

View File

@@ -0,0 +1,28 @@
// vim: set ft=glsl:
precision mediump float;
varying vec2 v_texcoord;
uniform sampler2D tex;
uniform float blurFactor;
uniform vec2 resolution;
const int numSamples = 120000;
uniform sampler2D accumulator;
void main() {
float blurFactor = 120000.0;
vec4 currentColor = texture2D(tex, v_texcoord);
vec4 prevColor = texture2D(accumulator, v_texcoord);
vec2 velocity = (v_texcoord - gl_FragCoord.xy / resolution) * 2.0;
vec4 colorDiff = currentColor - prevColor;
float motionBlur = length(velocity) * blurFactor;
vec4 finalColor = prevColor + colorDiff * 2.0;
gl_FragColor = finalColor;
}