• Advertisement

Archived

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

particle visibility

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

lo all, does anyone know how to determine whether a particle is visible or not? im thinking of raycasting to the center of the particle to see if it hits anything else first - the only problem with this is that i will have a large number of objects with high poly counts on screen, so checking against all the objects isnt really feasable. i also thought about partitioning space using an octree or similar but im not sure how this would help - im guessing the cpu hit would be significant. any response is greatly appreciated thanks, Fusi0n "We are what we repeatedly do. Excellence, then, is not an act, but a habit." - Aristotle

Share this post


Link to post
Share on other sites
Advertisement
Don''t even try to check if each particle is visible. Test the whole particle system using some kind of bouding volume (AABB, sphere,...). The cost of checking each particle would totaly kill your performance.

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

Share this post


Link to post
Share on other sites
You might want to alter that statement to checking if the dispersal point is visible. Checking if the entire particle engine is visible is entirely possible. This is assuming you have your particle engine setup with a container class for dispersal points, that throw particles and maintain the particles for that dispersal point. Otherwise if you have a generic particle system that has particles everywhere, you''ll end up finding it always visible. So you might want to estimate the distance a particle can go from a dispersal point, create a bounding sphere/box for that dispersal, then test against that. but that''s just my opinion...

Always remember, you''''re unique. Just like everyone else.

Share this post


Link to post
Share on other sites
hi, thanks for the response

using a bounding volume for the particle system and checking whether that is visible sounds like a fast way of doing it, but what if an object partially occuldes the bounding volume of a particle system? and what if the bounding volume of the particle system is very large (ie particles are either moving very fast, have a very long lifetime or the object the particle system is connected to is moving very fast) using this method of visibility testing would result in particles being drawn over objects that partially occlude the bounding volume. or am i completely wrong ;p

ill take you up on your advice first and implement it and have a look at the results

just thinking about it now... as the particle system gets further away from the camera, its size onscreen reduces, so, particle systems close to the camera would suffer the effect of not beng culled -this might work for my situation, as i have many objects with particle systems linked to all of them - and most ofthe objects are quite a long way from the user, ah, but my objects are quite small and the particle systems are quite large - i havent implemented bounding volumes for my particle systems, but i would imagine they would be larger than the objects, which i spose makes it a bit redundant :s

what about using just pixels instead of textured quads? have them blended with the background _and_ depth buffered [opengl]? i could do that right? would enabling the depth buffer remove the capability to blend with the background, i am unsure of how opengl works in these matters :s

thanks, Fusi0n :D:

"We are what we repeatedly do. Excellence, then, is not an act, but a habit." - Aristotle

Share this post


Link to post
Share on other sites
quote:
Original post by Fusi0n
hi, thanks for the response

using a bounding volume for the particle system and checking whether that is visible sounds like a fast way of doing it, but what if an object partially occuldes the bounding volume of a particle system? and what if the bounding volume of the particle system is very large (ie particles are either moving very fast, have a very long lifetime or the object the particle system is connected to is moving very fast) using this method of visibility testing would result in particles being drawn over objects that partially occlude the bounding volume. or am i completely wrong ;p

ill take you up on your advice first and implement it and have a look at the results

just thinking about it now... as the particle system gets further away from the camera, its size onscreen reduces, so, particle systems close to the camera would suffer the effect of not beng culled -this might work for my situation, as i have many objects with particle systems linked to all of them - and most ofthe objects are quite a long way from the user, ah, but my objects are quite small and the particle systems are quite large - i havent implemented bounding volumes for my particle systems, but i would imagine they would be larger than the objects, which i spose makes it a bit redundant :s

what about using just pixels instead of textured quads? have them blended with the background _and_ depth buffered [opengl]? i could do that right? would enabling the depth buffer remove the capability to blend with the background, i am unsure of how opengl works in these matters :s

thanks, Fusi0n :D:

"We are what we repeatedly do. Excellence, then, is not an act, but a habit." - Aristotle


Dude, just calculate the LARGEST possible distance a particle could theoretically travel(dist), create a sphere from the origin of the partsys with a radius of (dist), test it. If its not visible, dont draw. If it is, enable the depth buffer(although state changes are BAD!!!!) and GL wont draw the pixels if they are occluded. Is that an OK explanation?
You could look into hardware occlusion culling too after you''re used to this method....

Share this post


Link to post
Share on other sites
Not really... just leave depth testing on, but disable depth writes, and you can still alpha-blend your particles to your heart's content...

[edit] probably should clarify a bit there... you should draw you opaques first, then draw any particle systems whose bounding volume is visible (drawing back to front if the blend-mode requires... many pariticle systems can be done with additive blending, or even a simple alpha-test in the case of opaque particles (e.g. blood splats)), then draw your translucent objects last (back to front) ... that should give you a scene with fairly correct blending behaviour.


[edited by - Bad Monkey on December 5, 2002 9:30:42 AM]

Share this post


Link to post
Share on other sites
thanks for the responses people :D

i did some messing around this past week and came to the same method Bad Monkey outlined.

what ive done is draw all the opaque objects first with depth testing enabled, then i draw all the transparent particles with depth writing disabled - this produces exactly the effect i was after :D

cheers, Fusi0n

"We are what we repeatedly do. Excellence, then, is not an act, but a habit." - Aristotle

Share this post


Link to post
Share on other sites

  • Advertisement