Jump to content
  • Advertisement
Sign in to follow this  
Enalis

blending particles with an alpha channel

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

I've created particle systems before, but this time I'm having some trouble. Even utilizing similar code. I've tried using color based blending with no transparency and alpha based blending with an image that utilizes an alpha channel. It seems that some of the particles blend fine, whilst others show the outline of the texture I'm using. Here is the screenshot: screenshot I've tried numerous glBlendFunc combinations... here are a few I've tried for the textures with an alpha channel.
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
glBlendFunc(GL_SRC_ALPHA, GL_SRC_ALPHA);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
For the screenshot, I'm using
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
also, here is the particle texture I'm using, created with the Gimp: particle texture ^^ Probably won't show up because it's a white sphere on a translucent background. Any thoughts on why I'm getting these results?

Share this post


Link to post
Share on other sites
Advertisement
You draw the closer particle first, which will cause the ones behind to be clipped by the depth-buffer. You can avoid it either by sorting your particles by distance, and drawing them from further to closer, or by disabling the depth buffer to always draw the particles even if something else is drawn closer. Depending on your blend function and how your particles look like the simple solution of disabling depth testing can be acceptable (glDisable(GL_DEPTH_TEST)), but generally you want to sort the particles, since it can look different when a particle further away is drawn on top of a closer one.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!