Archived

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

Particle troubles

This topic is 5381 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 was going to comment this in my first post, but just forgot Anyway, Im going nuts trying to get my particle engine to render right without disabling depth testing... When the depth testing is off, you can see the particles thru walls, and it looks just plain stupid! How do you do this? Thanx... ~yodaman

Share this post


Link to post
Share on other sites
I had the same problem with my particles in my demo. I got around it by rendering all of my objects after the PS in order to obscure it except for one object which the OS was inside which i rendered after the PS. That worked but it is basically a cheap fix cause in a scene with lots of models and PS''s I know it would mess up again.

One thought i did have was to render a single quad over the entire area of the PS (with colour buffer writes off) after i render the PS in order to set the depth buffer up correctly. I haven''t got around to trying this yet though but it should work.

Share this post


Link to post
Share on other sites
To answer the 1st post...
The particles dont blend right.
to further on the second...
Ok, if you render the particles before the rest of the world,
then it wont blend right. If you disable depth testing you can see it thru the whole world, if you enable it, the particles wont blend correctly. Hey, what about gl alhpa testing?

[edited by - yodaman on March 24, 2003 2:43:43 PM]

[edited by - yodaman on March 24, 2003 2:44:11 PM]

Share this post


Link to post
Share on other sites
Comprehension from the Red Book after you''ve just read it is nearly impossible. It tells you every little detail and technicality you must know, but can''t simply remember automatically. This is why it''s a good reference book. So please don''t read it like a King novel, just refer to it before you come here to babble nonsensically about this CARP!!!

Share this post


Link to post
Share on other sites
Disabling depth buffer writes while rendering the PS actually does not solve the problem because then none of the quads that make up a PS will affect the depth buffer and therefore other models will either obscure the PS everytime or be obscured by the PS everytime u render (depending on the rendering order). As i said in my first post I believe that a solution to this would be to render a quad (with colour buffer writes disabled) over the entire PS to set the depth buffer up correctly.

Share this post


Link to post
Share on other sites
jonbell : if disable only z-writes and render PS as last thing it will look correct since you are still doing z-reads. Just try it..


You should never let your fears become the boundaries of your dreams.

[edited by - _DarkWIng_ on March 25, 2003 1:18:05 PM]

Share this post


Link to post
Share on other sites
I actually believe that they didn''t use glDepthMask(), but instead disabled depth testing, in the game "A time to kill", in the last chapter in the OpenGL game programming book... Try it and look what happens when the particles com behind a small piece of terrain, and you''ll see what I mean...

Share this post


Link to post
Share on other sites
Wouldn''t it just be better to sort the particles by distance with the rest of the world drawing furthest to closest with depth testing on. They are after all just quads so just treat them like the are a part of your scene. This is of couse assuming you render all polys furthest to closest to keep your blending realistic.

Share this post


Link to post
Share on other sites
Shadow_0f_Light : Sorting particles is a much better aproach but the trouble is sorting them. Especiali when you have alot of them (+10k).

You should never let your fears become the boundaries of your dreams.

Share this post


Link to post
Share on other sites
It''s a good point, the trick is not to you a bsp or oct tree cause then you have to redo your tree every frame. If you sort the polys, including the polys for the particles, by distance to the camera (simple trig) it actually a bit faster. But then again I haven''t tried it with +10k particles in my scene. I''ll have to check that out...

Share this post


Link to post
Share on other sites