# Texture coordinate transformations

This topic is 4849 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello, I've been having some difficulty with texture coordinate transformations. The sdk docs says "Microsoft Direct3D devices can transform the texture coordinates for vertices by applying a 4x4 matrix." Yet it doesn't seem to be the case. From what I can tell D3D is multiplying [u, v, 1] against a 3x3 maxtrix.
//This matrix properly translates u and v by 0.5
matTrans._11 = 1.00f; matTrans._12 = 0.00f; matTrans._13 = 0.00f;
matTrans._21 = 0.00f; matTrans._22 = 1.00f; matTrans._23 = 0.00f;
matTrans._31 = 0.50f; matTrans._32 = 0.50f; matTrans._33 = 1.00f;

//This matrix does nothing and just acts like the identity matrix
matTrans._11 = 1.00f; matTrans._12 = 0.00f; matTrans._13 = 0.00f; matTrans._14 = 0.00f;
matTrans._21 = 0.00f; matTrans._22 = 1.00f; matTrans._23 = 0.00f; matTrans._24 = 0.00f;
matTrans._31 = 0.00f; matTrans._32 = 0.00f; matTrans._33 = 1.00f; matTrans._34 = 0.00f;
matTrans._41 = 0.50f; matTrans._42 = 0.50f; matTrans._43 = 0.00f; matTrans._44 = 1.00f;

Is the documentation misleading or am I missing something?

##### Share on other sites
I had the exact same problem. Yes, DirectX is multiplying your coordinates by a 3x3 matrix. To transform 2D texture coordinates in DirectX, the translation components of the matrix need to be in the third row, rather than the fourth row.

Here's the newsgroup post that I found, when trying to fix the problem.

##### Share on other sites
Just a quick note for anyone else looking at this, even though D3D is multiplying the coordinates by the 3x3 that's inside the D3DMatrix, make sure you still put 0's in the 4th row and column because if you're going to combine that matrix with another matrix you'll end up having problems like me. :)

Thanks for the help Oxyacetylene

1. 1
Rutin
40
2. 2
3. 3
4. 4
5. 5

• 18
• 20
• 13
• 14
• 9
• ### Forum Statistics

• Total Topics
633365
• Total Posts
3011520
• ### Who's Online (See full list)

There are no registered users currently online

×