I found a webpage that has published some code for creating effects with glsl, and I am trying to get them to work in pd http://dem.ocracy.org/libero/photobooth/ There are some other cool effects, eventually it could be a cool patch idea. Do yo need a vert? I am trying to plug this into the deform_texture.pd patch. So far this is the frag that I have worked out so far:
uniform sampler2D texture;
void main(void) { vec2 texCoord = (gl_TexCoord[0].st); // [0.0 ,1.0] x [0.0, 1.0] vec2 normCoord = 2.0 * texCoord - 1.0; // [-1.0 ,1.0] x [-1.0, 1.0]
normCoordNew = Effect(normCoord)
rNew, phiNew = Effect(r, phi)
float r = length(normCoord); // to polar coords
float phi = atan(normCoord.y, normCoord.x); // to polar coords
r = pow(r, 1.0/1.8) * 0.8
normCoord.x = r * cos(phi);
normCoord.y = r * sin(phi);
texCoord = normCoord / 2.0 + 0.5; // [0.0 ,1.0] x [0.0, 1.0]
color = texture2D(sampler, texCoord);
gl_FragColor = color;
}
yup. that page is great. I updated some of his code to have origins
for the polar objects and whatnot. Thats the page that really got me
understanding some of the shader stuff.
On Jul 13, 2007, at 8:24 PM, Cypod wrote:
I found a webpage that has published some code for creating effects with glsl, and I am trying to get them to work in pd http://dem.ocracy.org/libero/photobooth/ There are some other cool effects, eventually it could be a cool
patch idea. Do yo need a vert? I am trying to plug this into the deform_texture.pd patch. So far this is the frag that I have worked out so far:uniform sampler2D texture;
void main(void) { vec2 texCoord = (gl_TexCoord[0].st); // [0.0 ,1.0] x [0.0, 1.0] vec2 normCoord = 2.0 * texCoord - 1.0; // [-1.0 ,1.0] x [-1.0, 1.0]
normCoordNew = Effect(normCoord) rNew, phiNew = Effect(r, phi) float r = length(normCoord); // to polar coords float phi = atan(normCoord.y, normCoord.x); // to polar coords
r = pow(r, 1.0/1.8) * 0.8
normCoord.x = r * cos(phi); normCoord.y = r * sin(phi); texCoord = normCoord / 2.0 + 0.5; // [0.0 ,1.0] x [0.0, 1.0] color = texture2D(sampler, texCoord); gl_FragColor = color; }
-- B~ www.cypod.co.nr
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/ listinfo/pd-list
v a d e //
www.vade.info abstrakt.vade.info
Cypod a écrit :
I found a webpage that has published some code for creating effects with glsl, and I am trying to get them to work in pd http://dem.ocracy.org/libero/photobooth/ There are some other cool effects, eventually it could be a cool patch idea. Do yo need a vert?
no, we don't need a vert
I am trying to plug this into the deform_texture.pd patch. So far this is the frag that I have worked out so far:
ok, here is a corrected version of this patch.
cyrille
uniform sampler2D texture;
void main(void) { vec2 texCoord = (gl_TexCoord[0].st); // [0.0 ,1.0] x [0.0, 1.0] vec2 normCoord = 2.0 * texCoord - 1.0; // [-1.0 ,1.0] x [-1.0, 1.0]
normCoordNew = Effect(normCoord) rNew, phiNew = Effect(r, phi) float r = length(normCoord); // to polar coords float phi = atan(normCoord.y, normCoord.x); // to polar coords
r = pow(r, 1.0/1.8) * 0.8
normCoord.x = r * cos(phi); normCoord.y = r * sin(phi); texCoord = normCoord / 2.0 + 0.5; // [0.0 ,1.0] x [0.0, 1.0] color = texture2D(sampler, texCoord); gl_FragColor = color; }
Wow, this is a great resource! I'm still really enjoying all of the discussion of GLSL!
~Kyle
On 7/14/07, cyrille henry cyrille.henry@la-kitchen.fr wrote:
Cypod a écrit :
I found a webpage that has published some code for creating effects with glsl, and I am trying to get them to work in pd http://dem.ocracy.org/libero/photobooth/ There are some other cool effects, eventually it could be a cool patch idea. Do yo need a vert?
no, we don't need a vert
I am trying to plug this into the deform_texture.pd patch. So far this is the frag that I have worked out so far:
ok, here is a corrected version of this patch.
cyrille
uniform sampler2D texture;
void main(void) { vec2 texCoord = (gl_TexCoord[0].st); // [0.0 ,1.0] x [0.0, 1.0] vec2 normCoord = 2.0 * texCoord - 1.0; // [-1.0 ,1.0] x [-1.0, 1.0]
normCoordNew = Effect(normCoord) rNew, phiNew = Effect(r, phi) float r = length(normCoord); // to polar coords float phi = atan(normCoord.y, normCoord.x); // to polar coords r = pow(r, 1.0/1.8) * 0.8 normCoord.x = r * cos(phi); normCoord.y = r * sin(phi); texCoord = normCoord / 2.0 + 0.5; // [0.0 ,1.0] x [0.0, 1.0] color = texture2D(sampler, texCoord); gl_FragColor = color;
}
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list