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

Blending Textures

Started by Christoph May 8, 2004 at 5:48 AM 5 replies 400+ views
Original Post
Christoph
Christoph
Hi there, how can I gradually blend two textures? I don''t mean a static effect such as detail mapping; my aim is to slowly switch between two cloud-textures to make the user believe the sky is changing. Greetz, Chris
OrcSlayer
OrcSlayer
set the first texture, and then the second, and slowsly set the alpha for the second texture higher and higher...
Christoph
Christoph
Thank you, but isn''t that to slow, direct manipulation at the textures? After all, how do I set the alpha-value? I couldn''t find an according function...
Rhapsodus
Rhapsodus
One way is to use the diffuse color on the vertices and change the alpha components of SkyMesh1 from 100% -> 0% while at the same time changing alpha of SkyMesh2 from 0% -> 100%

Sky1::Update()
{
DWORD dwColor = D3DCOLOR_ARGB( CurrentAlpha, 255, 255, 255 );
for all vertices
{
vertex[x].diffuse = dwColor;
}
CurrentAlpha--;
}


quote:
Original post by Christoph
Thank you, but isn't that to slow, direct manipulation at the textures? After all, how do I set the alpha-value? I couldn't find an according function...




[edited by - Rhapsodus on May 8, 2004 3:49:37 PM]
Christoph
Christoph
hmm, I don''t plan to use vertex blending because perrmanently locking vertex buffers costs performance... is there a way to directly manipulate the texture alpha components?
Rhapsodus
Rhapsodus

You could do it per pixel, but I think this is a slower method and its a pain accounting for all pixel formats...

http://www.drunkenhyena.com/docs/d3d8/dhGrayScale.phtml

quote:
Original post by Christoph
hmm, I don''t plan to use vertex blending because perrmanently locking vertex buffers costs performance... is there a way to directly manipulate the texture alpha components?



Morten
Morten
There are loads of options that doesn''t involve locking resources. E.g. you can write whatever alpha you want in a vertex shader, you can check for TFACTOR support, dest alpha, add another texture stage, draw the second texture lit with the alpha in the ambient, etc...

-Morten-

Topic Locked

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

Sign in to reply to this topic.