Archived

This topic is now archived and is closed to further replies.

Animating a texture

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Howdy. At the moment I am rendering my water using just a single big texture mapped onto a mesh grid of 10x10. This looks OK, but I''d really like to make it move around a bit. What I was thinking of doing was scrolling the texturemap in a circular direction (and perhaps adding a bump-map with countering scrolling). How can I do this without recalculating the UV co-ordinates every update? Obviously I could store multiple texture and bump maps and cycle through them (which could give me more realistic water anyhow), but that seems a little too brute-force''ish and dull.

Share this post


Link to post
Share on other sites
What''s wrong with cycling texture coordinates? Works just fine for me...

The other thing to do would be to make the actual geometry move up and down in waves, and environment map the water with a texture that looks like the surrounding scene.

Ryan Buhr
Reactor Interactive, LLC.
www.reactorinteractive.net

Share this post


Link to post
Share on other sites
I don''t really want to use an environment map to reflect the scene - only works if the water is relatively calm.

As for scrolling, in the good old days, i''d just be able to change the pointer the start address of the bitmap in memory. Is there a DX analogue?

Share this post


Link to post
Share on other sites
Changing the texture coords means unlocking the vertex buffer and I hear that is pretty costly. I''m very curious on this answer because I''m doing something similiar where I need to scroll the texture.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You can use a texture transform matrix to animate your UVs without locking the VB :

D3DXMATRIX matScale;
D3DXMatrixScaling( &matScale, 5.0f, 5.0f, 1.0f);
pD3DDevice->SetTransform( D3DTS_TEXTURE0, &matScale);
pD3DDevice->SetTextureStageState( 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2 );

This example is for scale, but you can do it for translation or anything you want.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
why not render using a pointer to a texture, and every frame, change where the pointer points so you do have an animated texture?

Share this post


Link to post
Share on other sites
Maybe the volumetric fog's(Texture based,transformed to camera space) method can achieve this.


[edited by - kimryo on June 5, 2003 6:38:52 AM]

Share this post


Link to post
Share on other sites
I am looking for a texture swirlling algorithm for my water too. I dont want it to be costy, just good looking. That is why I rejected the EMBM method I had started, as it would only run on GF3 >

Texture matrix operations are IMO the best for texture swirlling, I have tried many things on that without success. For example, how did Commandos do the water effect we see?

Another way todo it, would be animated textures.. But that means lots of SetTexture calls. Actually I might test that!

Share this post


Link to post
Share on other sites