Allow independent distortion of rgb channels
This commit is contained in:
+12
-10
@@ -1,12 +1,12 @@
|
||||
#version 450 core
|
||||
in vec2 texPos;
|
||||
in vec2 distmask[10];
|
||||
in vec2 pinch[10];
|
||||
in vec2 pinchr[10];
|
||||
in vec2 pinchg[10];
|
||||
in vec2 pinchb[10];
|
||||
out vec4 fColor;
|
||||
layout (binding = 1) uniform sampler2D screenTexture;
|
||||
layout (location = 0) uniform int n;
|
||||
//float x = 1 - min(1, sqrt(distance(distmask[0],vec2(0,0))));
|
||||
//float x = 1 - min(1, dot(distmask,distmask));
|
||||
vec3 toYUV (vec3 rgb)
|
||||
{ return rgb * mat3
|
||||
( 0.299 , 0.587 , 0.114
|
||||
@@ -23,17 +23,19 @@ vec3 toRGB (vec3 yuv)
|
||||
}
|
||||
void main()
|
||||
{
|
||||
vec2 tpos = texPos;
|
||||
vec2 tposr = texPos;
|
||||
vec2 tposb = texPos;
|
||||
vec2 tposg = texPos;
|
||||
for(int i = 0; i < n; ++i)
|
||||
{
|
||||
float x = 1 - min(1, sqrt(distance(distmask[i],vec2(0,0))));
|
||||
tpos += x * pinch[i];
|
||||
tposr += x * pinchr[i];
|
||||
tposg += x * pinchg[i];
|
||||
tposb += x * pinchb[i];
|
||||
}
|
||||
fColor = texture(screenTexture, tpos);
|
||||
//fColor = texture(screenTexture
|
||||
// , (texPos + x * pinch[0]
|
||||
// + y * pinch[1]
|
||||
// ));
|
||||
fColor.r = texture(screenTexture, tposr).r;
|
||||
fColor.b = texture(screenTexture, tposb).b;
|
||||
fColor.g = texture(screenTexture, tposg).g;
|
||||
}
|
||||
// fColor = vec4
|
||||
// ( toRGB(vec3( toYUV(texture(screenTexture, texPos).rgb).r
|
||||
|
||||
Reference in New Issue
Block a user