Projective textures with shaders
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
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.
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.
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
in pixel shader version 1.4
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
Popular Topics
Advertisement