Jump to content
  • Advertisement

Archived

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

jhwc1138

Particle Depth Sort

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

Ok... I have working, although minimal, particle system.. I turn off depth testing so I can get the blending right but now I see the particle through everything, which I know is becuase I turned off depth testing... So my question is would depth sorting the particles make all the blending modes work right? Is there a way to make it so I don''t see the borders of the particle textures and also avoid a depth test? If there is no way, what is the best algo for depth sorting? Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Draw everything solid in the scene with z-buffer on, then disable the z-buffer for writing, but leave on the z-test and finally draw your particles. This should be enough for simple engines... correct if this description was wrong!


Yesterday we still stood at the verge of the abyss,
today we''re a step onward!

Share this post


Link to post
Share on other sites
if your alpha is either 0% or 100%,
disable the z-buffer for writing works
else
turn off depth testing or disable the z-buffer for writing wont make blending right, but acceptable
better draw them back to front

[edited by - iwaskia on September 18, 2002 6:45:54 PM]

Share this post


Link to post
Share on other sites
Something important to mention: blend mode. If you are using GL_ONE-GL_ONE blending, you can simply turn off depth writing before drawing your particles. If you are using GL_SRC_ALPHA-GL_ONE_MINUS_SRC_ALPHA, you need to sort them back to front before drawing.

EDIT - FYI, ONE-ONE blending is best used for "energy" effects like fire, SRC_ALPHA-ONE_MINUS_SRC_ALPHA is best used for dust and smoke effects. So don't just use one-one because it is faster. Use it when appropriate.

[edited by - Neosmyle on September 18, 2002 7:10:49 PM]

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!