Work on distortion shader

This commit is contained in:
2025-11-15 13:21:11 +00:00
parent 5dfc97a683
commit d436b853eb
8 changed files with 44 additions and 55 deletions
+3 -13
View File
@@ -1,20 +1,10 @@
#version 450 core
in vec2 texPos;
in vec2 texDist;
in float gfactor;
in vec2 vcpos;
in vec2 distmask;
out vec4 fColor;
layout (binding = 1) uniform sampler2D screenTexture;
float f ( float x) {
if (x>1) {return 1;} else {return (1-gfactor)*x + gfactor;}
}
float x = min(1, dot(distmask,distmask));
void main()
{
float t = f(length(texDist));
float r = texture(screenTexture , (t*texPos - vcpos)).r ;
vec2 gb = texture(screenTexture
, 0.5+0.5 *( vcpos + t * (texPos - vcpos))
).gb
;
fColor = vec4(r,gb,1);
fColor = mix(texture(screenTexture, texPos),vec4(1,0,0,1),x);
}