Skip to main content
gamedev.net
🔒 Locked

Texture coordinate transformations

Started by d000hg 3 replies 250+ views
Original Post
d000hg
d000hg
I noticed in the D3D SetTransform function that you can set 8 texture transforms as well as world, view & projection. Do these transformations just get automatically applied to uv coords as you''d expect? Are they done in hardware on HW T&L chips? cheers
Read about my game, project #1 NEW (18th December)2 new screenshots, one from the engine and one from the level editor
John 3:16
don
don
Yes, it''s a standard vector transformed by a 4x4 matrix operation. You enable the transforms via SetTextureStageState by setting the D3DTSS_TEXTURETRANSFORMFLAGS state to something other than D3DTTFF_DISABLE.

Note that your source texture coordinates will be extended to homogeneous form prior to the multiplication by the 4x4 matrix, if it is less than 4 components in size.

If you supply (u,v) in your vertex format and then want a 4 component texture coordinate set output after the matrix multiplication (D3DTTFF_COUNT4), the source coords will be promoted to (u,v,1.0,0.0) prior to the multiplication.

You can also ask the transformation unit to perform a divide after the transform. See D3DTTFF_PROJECTED in the DX docs.

Yes, your display card''s transformation unit will perform the operation if it can, otherwise the D3D runtime will do it.

d000hg
d000hg
On roughly the same topic, how high is it safe to assume the texture coordinate limit goes? I just multiply the coord on the ground by some factor to get uv coords in my terrain engine which works well, however having to change u=x*f to u=min(x*f,MAXU) is a large performance drop in my algorithm - building the texcoords each frame to save storing oodles of FVF vertices.
S1CA
S1CA
quote:
On roughly the same topic, how high is it safe to assume the texture coordinate limit goes?


It''s a PC - assume nothing :

caps.MaxTextureRepeat
caps.TextureCaps & D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE


(I take it you''re talking about uv coords outside of the 0-1 range of course)

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com
Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site
d000hg
d000hg
Yep that''s right. If that flag''s set I have to divide the maximum by the texture coords, right?
I just wondered if there is a lower limit to work within? My GF2MX seems fine with up to at least 2000 and it''s a problem if I can''t do it over 1000. What exactly happens if the uv coords are outside this range?



Read about my game, project #1
NEW (18th December)2 new screenshots, one from the engine and one from the level editor



John 3:16

Topic Locked

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

Sign in to reply to this topic.