Texturing using other textures as alpha maps...
Here's the description of what i am trying to do... There are n layers of textures. Each layer consist of two textures. The first texture is a detail one and is repeated over mesh. The second texture is low detail alpha texture, that should be used for the first one as alpha map, and is streched over mesh. What i want to do is to blend all those layers nicely, using first texture as color, and the second as alpha for that texture. I've been reading OGL spec about the blending, but those things are very confusing, and i can't pick the right things i need. Please, help me to get on the right way. :-)
Edit:
In the end probably i should get this:
Color = Tex1 * AMap1 + ... + Texn * AMapn
where Texn is first texture for color, and AMapn is alpha texture for alpha map.
[edited by - Trinka on March 30, 2003 7:15:42 PM]
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
glEnable(GL_BLEND);
for (int i=n;i>=0;i--)
{
glColor4f(1,1,1,AMapi);
//Draw Quad with Texi;
}
glDisable(GL_BLEND);
glEnable(GL_BLEND);
for (int i=n;i>=0;i--)
{
glColor4f(1,1,1,AMapi);
//Draw Quad with Texi;
}
glDisable(GL_BLEND);
This will not work... AMapn is alpha texture. I think i will need to use multitexturing with separate pass for each layer, but i don''t know how to setup it properly.
Well, using register combiners this becomes rather trivial. Using the standard texture environment, render the object just using the alpha map first. Then for a second pass render using the detail texture, with a blending function of GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA. Make sure you have a framebuffer with an alpha channel though.
Death of one is a tragedy, death of a million is just a statistic.
Death of one is a tragedy, death of a million is just a statistic.
Do you want to mix a normal (color) bmp with another bmp that holds an alpha map, into a single texture?
I have a function that does that...
Height Map Editor | Eternal Lands | Fast User Directory
I have a function that does that...
Height Map Editor | Eternal Lands | Fast User Directory
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement