Skip to main content
GameDev.net gamedev.net
🔒 Locked

Transforming Texture Coordinates

Started by Ronin28 Aug 27, 2006 at 1:19 PM 3 replies 1k views
Original Post
Ronin28
Ronin28
Can Texture coordinates in the fx file be transformed by say outVS.Tex0 = mul(Tex0, TransFormationMatrix);. Or is that the wrong way. I'm rotating the texture btw. Thanks in advance.
Namethatnobodyelsetook
Namethatnobodyelsetook
For a regular 2D texture transform, it's more like

mul (coord.xyw, (float3x3)transformMatrix);

this will correctly take into account that 2D texture transforms use translation in row3, not row4 of the matrix. This will require a special 2D transformation matrix like the fixed pipeline does.

Then again, if you use the full vector and full matrix, as in your code, you don't need to build the transform differently for a 2D coordinate, and you can forget about that need of the fixed pipeline.

Either way should work fine for scaling and rotation, it's just translation of 2D coords that's special.
Ronin28
Ronin28
Thanks. That helped alot.
Ronin28
Ronin28
how do you set up a 3 or 4d tex coordinate in HLSL??
Ronin28
Ronin28
nevermind got it!!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.