Jump to content
  • Advertisement

Archived

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

Erik Labree

OpenGL What blending functions to use for lightmapping with OpenGL?

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

Hello there, I'm doing some research into lightmapping and can't get the blending of the texture and the lightmap right. I've got two questions: 1) What blending functions should be used? I'm using OpenGL 2) In what order should be rendered. Lightmap, texture or texture, lightmap. Thanks, Erik Labree Edited by - Erik Labree on 7/16/00 5:45:21 AM

Share this post


Link to post
Share on other sites
Advertisement
Try in glBlendFunc() for first param:GL_SRC_ALPHA and as second:GL_ONE_MINUS_SRC_ALPHA. The first may be texture then your lightmap that will lighten the texture. Also you may try to render light map first and then render texture. There is no difference because you have only two simple texture blending stages.

Share this post


Link to post
Share on other sites
Well thank you for the input.

Tae, your functions did gave a nice result but not what i wanted. With a texel on the lightmap which is black i want the result when blended with for instance a brickwall texture to be black (aka dark). With your functions the bricks remained visible when the lightmaptexel was black.
I tried some other combinations and this one works for me.

glBlendFunc(GL_DST_COLOR, GL_SRC_COLOR);

Thanks Erik.

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!