Particle System Depth Test?
I have a problem with the particle system (From this site), i am using imported models and i cant seem to get the particles to be on top of an other shape ever, it is allways behind it?
Any suggestions???
Thanx, ShCiPwA
----- ShCiPwA -----
glEnable(GL_DEPTH_TEST);
nitzan
-------------------------
www.geocities.com/nitzanw
www.scorchedearth3d.net
-------------------------
nitzan
-------------------------
www.geocities.com/nitzanw
www.scorchedearth3d.net
-------------------------
that might make the particles look funny though, if they do, try drawing the particle system *after* the model
------------------------------
Baldur K
------------------------------
Baldur K
Isn''t it possible to apply DEPTH_TEST to a particle system and
render the particles correctly?
render the particles correctly?
adema: yes but the particle engine on this site uses blending to get rid of the black bit around the sprite and it does blending by enabling blending and disabling depth testing rather than drawing in back to front order(?).
------------------------------
Baldur K
------------------------------
Baldur K
the way to draw particles and other translucent surfaces:
glDepthMask(GL_TRUE); // enable depth writes
DrawYourOpaqueStuff();
glDepthMask(GL_FALSE); // disable depth writes
DrawYourTranslucentStuff();
you can leave depth testing on for both of these processes (it is advisable to do so, or your particles/translucent surfaces will look all wacky as they will not be occluded by solid/opaque surfaces).
disabling depth writes means that particles and other translucent surfaces will still be correctly occluded by opaque geometry, but not occlude each other.
it is also advisable to draw them in back to front order (furthest to nearest) to achieve correct blending results (but you can get away with it most times if you''re too lazy
)
glDepthMask(GL_TRUE); // enable depth writes
DrawYourOpaqueStuff();
glDepthMask(GL_FALSE); // disable depth writes
DrawYourTranslucentStuff();
you can leave depth testing on for both of these processes (it is advisable to do so, or your particles/translucent surfaces will look all wacky as they will not be occluded by solid/opaque surfaces).
disabling depth writes means that particles and other translucent surfaces will still be correctly occluded by opaque geometry, but not occlude each other.
it is also advisable to draw them in back to front order (furthest to nearest) to achieve correct blending results (but you can get away with it most times if you''re too lazy

I just had a quick question on this depth sorting business with alpha blending. Is the only way, to sort the triangles into depth order each time you render the frame? Isn''t this going to kill performance?
cheers.
cheers.
It will definitely eat CPU cycles. That's why choosing the right sorting algorithm is important.
Does anyone know if a binary tree sort algorithm is worthwhile here, or is there a better way?
Maybe do this in addition to separating the particles into grid blocks, sorting particles within those blocks, rendering each block of particles in a back to front fashion? As the particles are creatd or move, flag which block they are a part of. I did this once with collision detection - each block had its own linked list of references to the objects that were in that block. It worked quite well!
Edited by - Waverider on March 6, 2002 11:16:48 AM
Does anyone know if a binary tree sort algorithm is worthwhile here, or is there a better way?
Maybe do this in addition to separating the particles into grid blocks, sorting particles within those blocks, rendering each block of particles in a back to front fashion? As the particles are creatd or move, flag which block they are a part of. I did this once with collision detection - each block had its own linked list of references to the objects that were in that block. It worked quite well!
Edited by - Waverider on March 6, 2002 11:16:48 AM
It's not what you're taught, it's what you learn.
I''ve found that for most particle systems, if you''re looking for a blending effect, sorting them beforehand generally isn''t necessary. The visual effect really isn''t any different.
Of course, that could change if the particle system isn''t the only transparent thing in the scene.
Of course, that could change if the particle system isn''t the only transparent thing in the scene.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement