Jump to content
  • Advertisement
Sign in to follow this  
Alessandro

Problem with blending

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

Hi, i have a problem with blending that i'm unable to solve. I feel very stupid to ask about this, but here it comes: i have this rgb texture, and i apply it to a simple quad. However, as you can see from this shot, blending is not done properly. It's ok when the cloud is above the teapot, wrong when is over the background. I tried several blendfunc functions but problem remains. Any hint is greatly welcome.

Share this post


Link to post
Share on other sites
Advertisement
make the RGB of the texture white and stick the cloud texture in the alpha of the texture
use blending of SRC_ALPHA , 1-SRC_ALPHA
and play around with glColor4f(...) to change the lightness of the cloud

Share this post


Link to post
Share on other sites
when using blending you have to be careful of the order you draw the object.

Do you draw the teapot and then the quad or the inverse ?

Try to change the order of rendering and it will work proprely.
I think the correct order will be quad and then teapot. Try it.

If you do the inverse (teapot and then quad) the accumulation buffer (the blending) will be filled even if the teapot if in front of the quad.

Share this post


Link to post
Share on other sites
Quote:
Original post by DamienFr
when using blending you have to be careful of the order you draw the object.

Do you draw the teapot and then the quad or the inverse ?

Try to change the order of rendering and it will work proprely.
I think the correct order will be quad and then teapot. Try it.

If you do the inverse (teapot and then quad) the accumulation buffer (the blending) will be filled even if the teapot if in front of the quad.

Not quite. You have the basics right, but the specifics are a little off. The correct order is to render opaque objects first and then translucent ones (in back to front order if you have multiple translucent polygons). If you do the reverse then it is the depth buffer that gets filled and the opaque object does not get drawn where it is behind the transluncent object. However, that's not actually the problem here. The problem here is that Alessandro is using additive blending instead of alpha blending. zedzeek posted the correct solution.

Enigma

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!