Jump to content
  • Advertisement

Archived

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

Re Kaioh

Problem drawing trasparent particles

This topic is 6107 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 drawing particles with transparency. I create a quad which always faces the camera, then i enable blending with: glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE); Even if i use a 32bit texture with the alpha channel which is totaly black in the borders, when i render these particles they aren''t trasparent at all, but some times i can see the border. Here you can see the result: http://www.danteworkshop.f2s.com/particles.jpg More over i''ve noticed that if i disable the depth test, when i render the particles are rendered perfectly, but of course, this has no sense and i need the depth test Thanks for any help.

Share this post


Link to post
Share on other sites
Advertisement
is dithering enabled?
also watchoug if u are using mipmaps the highest resolution''s borders might be transparent but lower resolutions mightnt be

http://uk.geocities.com/sloppyturds/gotterdammerung.html

Share this post


Link to post
Share on other sites
The problem is that with the z buffer on, particles drawn first are blocking out those drawn afterwards if they are in front - the z buffer test comes before any blending, so if you try to draw a particle on top of one thats in front of the new one, it wont get a chance to get blended in.
A few possible solutions that come to mind:

1. If OpenGL provides it, you want to turn off writes to the z-buffer when you render your particles, then turn it on again afterwards. You leave z-buffering itself on, so your particles wont get drawn behind other stuff youve already drawn, but dont write to the z buffer so the particles wont block each other out.

2. If it doesnt have this option, you could always sort your particles by z distance, then render them back to front.

3. One other possibility is to set the range of values open gl writes into the z buffer to be zero size, for example the range 0.0 to 0.0. This way all particles will get rendered with the same z value, 0.0, and if your depth test is set to Less than or equal, your particles should all get drawn. Again, I''m not sure if OpenGL supports this either.

good luck
Cameron

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!