I've been trying to apply a 2d texture to an object where I want the UVs to 
correspond to screen position. A bit like using EYE_LINEAR texgen, but with the 
texture projected 'orthographically' through the screen.
What I want would in effect be like applying the texture so it always spans the 
window, but without applying the perspective of the camera. I guess, a bit like 
using the texture as a stencil.

I've tried using EYE_LINEAR, and that very nearly does what I want, but I want 
to remove the effect of perspective on the way the texcoords are calculated.

In other words, I think I want calculated texture UV's to be something like:
texcoord.x = (worldPosition * (projectionMatrix * modelViewMatrix)).x
texcoord.y = (worldPosition * (projectionMatrix * modelViewMatrix)).y

What's the best way to implement this without using stencil buffer or shaders?
Is there a way to do it by adjusting the texture matrix object to remove the 
perspective projection?
Or would it be better to recalculate texCoords on geometries prior to each 
frame?

Hope this makes some kind of sense.
 
Cheers,
Chris Denham

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=34694#34694





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to