Jump to content
  • Advertisement

Archived

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

Smilediver

Texturing using other textures as alpha maps...

This topic is 5652 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

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]

Share this post


Link to post
Share on other sites
Advertisement
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);



Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!