Texture transforms do not appear to be applying translation.  
Author Message
Tommy Tucker





PostPosted: Game Technologies: Graphics, Texture transforms do not appear to be applying translation. Top

I am using Direct3D 9 with VS 2003. I have a program where I need to set texture transforms with a scale and a translation components in them. When I check the results of the texture transform using ProcessVertices, only the scale value appears to be applied. Is there something I'm missing about texture transforms Do I have to supply a four component texture coordinate so the w component is around for the translation I currently only specify two component texture coordinates and expect the w = 1 to be implied.



Game Technologies: DirectX, XNA, XACT, etc.5  
 
 
Ross Ridge





PostPosted: Game Technologies: Graphics, Texture transforms do not appear to be applying translation. Top

With 2D texture coordinates I believe the input to your transformation matrix is actually (u, v, 1, 0). There's actually a small example of using texture transformations to do translation in the SDK documentation, see Animating textures (by translation or rotation) on a model.
 
 
Tommy Tucker





PostPosted: Game Technologies: Graphics, Texture transforms do not appear to be applying translation. Top

That did it. Thanks.

It would be great if the user guide could be annotated in the Texture Transform section with a note on special handling for 2D texture coordinates. As a convert from OpenGL, this difference is hard to figure out on one's own. OpenGL does (u,v, 0, 1) instead. Also, all of the D3DX matrix routines are built around 4x4 matrix math. This is misleading when it comes to 2D texture coordinates.

Thanks again.