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

D3D Texture Coordinate Processing?

Started by Void Jul 3, 2000 at 1:15 AM 3 replies 200+ views
Original Post
Void
Void
Does any understand how the matrix for texture coordinate processing works? Like for animating textures using translation in UV (2D), the matrix is
    
1   0  0  0
0   1  0  0
du dv  1  0 (du and dv change each frame)
0   0  0  1
    
How does the maths work??..
WitchLord
WitchLord
The math works exactly (almost) like when transforming 3D coordinates. The only difference is that now you are only using 2D coordinates so that last column and row aren't used.

        
Translation matrix


tu = tu + a
tv = tv + b


1 0 0 0
0 1 0 0
a b 1 0
0 0 0 1


Scale matrix


tu = tu * a
tv = tv * b


a 0 0 0
0 b 0 0
0 0 1 0
0 0 0 1


Rotation matrix


tu = cos a * tu - sin a * tv
tv = sin a * tu + cos a * tv


cos a sin a 0 0
-sin a cos a 0 0
0 0 1 0
0 0 0 1






- WitchLord

Edited by - WitchLord on July 3, 2000 11:26:22 AM
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - <a href="http://www.angelcode.com/tower" rel
S1CA
S1CA
The API simply ignores the unnecessary parts of the matrix.

When using projected textures, it expands the coordinates internally to u,v,1

--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com
Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

Topic Locked

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

Sign in to reply to this topic.