Jump to content
  • Advertisement
Sign in to follow this  
riuthamus

Particle Collision

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

How would you go about determine if a particle collided with something? We finally got GPU particles working but for rain we want it to create a new particle on collision with the ground. How might one go about doing this?

Share this post


Link to post
Share on other sites
Advertisement

How would you go about determine if a particle collided with something? We finally got GPU particles working but for rain we want it to create a new particle on collision with the ground. How might one go about doing this?

Kind of depends on the implementation and what you're trying to do. For instance with rain you could treat it different ways, if it simply is created and moves downward and you want it to create a "splash" effect on hitting the ground you could provide some sort of method to find the ground coordinates under the position of the rain particle and have it react when it reaches that point. If you wanted something more dynamic like smoke that brushes off of solid objects and funnels upward then you'd have to look into testing it against the world geometry. Particles are like any other object really, the only problem is they come in massive amounts so testing them again a wide variety of collisions is just asking for trouble.

The biggest killer would be if you tried to do something like test particles against each other. Edited by Satharis

Share this post


Link to post
Share on other sites

Can't find that presentation (I think it was Bungie, but not the Blowing S#!t Up one) where they used the depth buffer (world pos reconstruction, I think you got deferred rendering already) for collision detection and response, and put the particles to sleep when off-screen.

 

Maybe you can get away by faking it: Just emit (splashes?) near ground. Rain is pretty fast moving, so I wonder if one can tell the difference.

Share this post


Link to post
Share on other sites
This one? I tried implementing that, but wasn't able to get it working since I can't actually debug our GPU particle system (the VS debugger crashes). But it only deals with on-screen collisions, which covers pretty much everything except rain/snow. I'm not too worried about having splashes, the bigger issue is preventing the rain from falling through the terrain.

Share this post


Link to post
Share on other sites

Yep, that's the one I meant.

 

Ok, just throwing ideas around: How about a heightfield then. Meaning: From your terrain create a "stop layer" texture (one channel), one texel per cube encoding the highest layer. Then in the simulation destroy the rain when it falls below the height at the corresponding position. This height texture can then also be used to create the splash positions.

Share this post


Link to post
Share on other sites
How would you create such a texture? Scanning all the blocks on the CPU would probably be rather slow. Rendering it out with the GPU might be quicker but I don't know how you'd map 1 block to 1 pixel.

Share this post


Link to post
Share on other sites

E.g. rendering with an orthographic projection, birds eye view looking straight down, axis aligned, and scaled so that one block comes out as one pixel and outputting depth (== distance from near plane == height). Actually a depth buffer alone could suffice here (with D3D11 one can disable rasterization completely). Then use this depth buffer/depth map for collision detection.

Share this post


Link to post
Share on other sites
I suppose I could try that out. It may end up being rather expensive though considering how many draw calls it would need to draw all the terrain.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!