SDF for particle collision in particle network

   13273   8   2
User Avatar
Member
11 posts
Joined: Oct. 2007
Offline
Hi Champs,

I am simulating some good amount of particles and have to collide those particles with some rigid bodies and was wondering, how do I save my rigid bodies into sdfs format(iso offset or something else) and use them in particle simulation for collision?

Cheers,
Junaid
Art imitates life
User Avatar
Member
795 posts
Joined: April 2020
Offline
First of, if you get your particles into the dop environment using a pop solver, you can set up the collisions right there. If you want to separate the two, ust run the rigid bodies, an when you have them back in sops, create a sdf using an iso-offset node. Make sure you have enough padding.

Then in the pop network, use a vop pop. There are two vops really usefull here, the volume sample and the volume gradient. The volume sample will give you the distance to the collision object, so you can adjust the velocity, position or force (look at the advect pop network for a elegant implementation of the different ways to influence the particles.) You can use a volume gradient to get the direction in which to push them, it essentially gives you the normals.

I have found this to be very fast and very reliable. If a particle shoots into you object after all, in a collision pop the game is over, using sdf, you can find an elegant solution.

Hope that helps,

Koen
User Avatar
Member
11 posts
Joined: Oct. 2007
Offline
yess Koen somewhat like that, giving it a go lets see what turns out, thanks. would be great if you have any example file or something to share, because when I am doing advect in pop net, its adding up some force to particles when its collide with sdf but what I am after is collision and I am not sure how to get that.

Cheers,
Junaid
Art imitates life
User Avatar
Member
795 posts
Joined: April 2020
Offline
You should not use the advect pop to do the collisions, you should create a vop-pop with a volume sample and a volume gradient node (and some math :-) ) I mentioned the advect because it shows you how you can have the user choose how to control the particle (force, vel, or position)

Cheers,
Koen
User Avatar
Member
11 posts
Joined: Oct. 2007
Offline
oops never did this before and I am trying it but couldn't figure out how this volume sample thing works also I am not experience with vop pop, do you have any example file which has similar demonstration of it? that would be great.

Cheers
Art imitates life
User Avatar
Member
192 posts
Joined: Nov. 2008
Offline
Hi junaidcg. Here's a little example of a way to use the VOP POP to collide particles with an SDF volume. I'm sure its pretty short on the math Koen mentioned (it just uses the reflect function to find the collision vector), but hopefully that helps to show some of the tools within VOPs.

Good luck dude.

Attachments:
brn_sdfcollisions.hip (306.5 KB)

User Avatar
Member
11 posts
Joined: Oct. 2007
Offline
sweet :idea: , Briliant brianBruke !! yeah, I knew it doesn't require some hardcore maths all I need to do is to reflect my points velocity vectors based on sdf volume intersection, I am new to vops and it sound powerful to me. I needs to explore it.

Thanks for the help dude

Cheers,
Junaid
Art imitates life
User Avatar
Member
795 posts
Joined: April 2020
Offline
Hello all,

I did not mean to imply there is any difficult math involved, I just mentioned it so you would be aware there are a few more nodes in the network.

To find the new velocity after bouncing on a surface, you would use the normal of the surface, when you use a volume the gradient can be used for this.

The math is just to mirror the velocity.

Cheers,
Koen
User Avatar
Member
795 posts
Joined: April 2020
Offline
Hello all,

Here is an example file. I did not test it thoroughly, but on a sphere it seems to work :-)

Cheers,
Koen

Attachments:
volume_collision.hipnc (75.2 KB)

  • Quick Links