View Single Post
Old 10-09-2009, 10:15 AM
farshizzo farshizzo is offline
WorldViz Team Member
Join Date: Mar 2003
Posts: 2,849
You can use a post-process shader to perform your keystone correction. A shader may be overkill for a simple linear transformation, but it allows for more flexibility for distortion correction. The vizlens module that comes with Vizard uses a post-process shader to perform the lens correction. Here is a simple example of a post-process shader:
import viz
import vizpp

KeystoneShader = """
uniform sampler2D vizpp_InputTex;
uniform float osg_FrameTime;
void main (void)
	float s = gl_TexCoord[0].s + (gl_TexCoord[0].t * sin(osg_FrameTime) * 0.3);
	float t = gl_TexCoord[0].t;
	gl_FragColor = texture2D( vizpp_InputTex, vec2(s,t) );
vizpp.addEffect( vizpp.ShaderEffect(frag=KeystoneShader) )

Reply With Quote