Projective textures with shaders

Started by
1 comment, last by bakery2k1 22 years, 3 months ago
I have been trying to implement projective texturing using both vertex and pixel shaders. In the vertex shader, I am specifying the texture coordinates to be the same as the transformed vertex position. I thought this would mean that the texture would be put "flat" on the scene, but I can still see where deeper parts are, as if the projection matrix is not being used. What have I missed? Any papers etc on this? Thanks
Advertisement
Create a concatenated world/view/projection matrix as if you were rendering a scene from the projector''s point of view. Use that as your texture matrix.

However, you need to add one more matrix to scale and bias this to the 0-1 range of texture coordinates. There are docs at the nVidia developer''s site that talk about this. If that doesn''t make sense, reply here and I''ll post some code.
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
Thanks.

I did exactly that, but used a texture generation matrix instead of the texture matrix itself (I had already used this method in OpenGL). The exact problem was that the x and y coordinates for texture look-up were not being divided by the w coordinate (per pixel). This is done automatically in OGL, but wasn''t happening in DX. I fixed this by using
texld r0, t0_dw.xyw 

in pixel shader version 1.4

This topic is closed to new replies.

Advertisement