Implement multiple radial distortion rendering
This commit is contained in:
@@ -6,10 +6,7 @@ in vec2 vcpos;
|
||||
out vec4 fColor;
|
||||
layout (binding = 1) uniform sampler2D screenTexture;
|
||||
float f ( float x) {
|
||||
//return max (1, 1 / (2 * x + 0.5)) ;
|
||||
//return min (1, x) ;
|
||||
if (x>1) {return 1;} else {return (1-gfactor)*x + gfactor;}
|
||||
//if (x>1) {return 1;} else {return 0.5;}
|
||||
}
|
||||
void main()
|
||||
{
|
||||
@@ -18,8 +15,4 @@ void main()
|
||||
, 0.5+0.5 *( vcpos + t * (texPos - vcpos))
|
||||
)
|
||||
);
|
||||
//vec4 tColor = vec4(texture(screenTexture , cpos + (texPos - cpos)) );
|
||||
//float t = distance(cenPos,texPos);
|
||||
//fColor = vec4(tColor.xy,t,tColor.w);
|
||||
//fColor = tColor;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ out vec2 vcpos;
|
||||
out vec2 texPos;
|
||||
out vec2 texDist;
|
||||
out float gfactor;
|
||||
|
||||
vec2 g(float x,float y, vec2 v, vec2 r1, vec2 r2)
|
||||
{ return vec2
|
||||
(dot(normalize(r1-v),vec2(x,y)-v) / length(r1-v)
|
||||
@@ -18,7 +17,6 @@ vec2 g(float x,float y, vec2 v, vec2 r1, vec2 r2)
|
||||
}
|
||||
void main() {
|
||||
vec2 cpos = vCen[0];
|
||||
//vcpos = 2*cpos - vec2(1,1);
|
||||
vcpos = cpos;
|
||||
vec2 grad1 = vRad1[0];
|
||||
vec2 grad2 = vRad2[0];
|
||||
|
||||
@@ -12,10 +12,7 @@ void main()
|
||||
{
|
||||
gl_Position = vec4(0,0,0,1);
|
||||
vCen = (theMat * vec4(pos,0,1)).xy;
|
||||
//vCen = (theMat * vec4(0,0,0,1)).xy;
|
||||
vRad1 = (theMat * vec4(rad1,0,1)).xy;
|
||||
//vRad1 = (theMat * vec4(0,200,0,1)).xy;
|
||||
vRad2 = (theMat * vec4(rad2,0,1)).xy;
|
||||
//vRad2 = (theMat * vec4(200,0,0,1)).xy;
|
||||
vFactor = factor;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user