On 12/10/2010 5:21 AM, Chris Denham wrote:
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.
With those restrictions, it seems like the texture matrix is your only path to a
solution, though I couldn't type it here off the top of my head. It would take
some dev time to get it right.
What you want to do would be trivial with a shader. Is there a reason why you've
ruled out use of shaders for this problem?
--
-Paul Martz Skew Matrix Software
http://www.skew-matrix.com/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org