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
SDF for particle collision in particle network
13273 8 2-
- junaidcg
- Member
- 11 posts
- Joined: Oct. 2007
- Offline
-
- koen
- 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
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
-
- junaidcg
- 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
Cheers,
Junaid
Art imitates life
-
- koen
- Member
- 795 posts
- Joined: April 2020
- Offline
-
- junaidcg
- Member
- 11 posts
- Joined: Oct. 2007
- Offline
-
- brianBurke
- 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.
Good luck dude.
-
- junaidcg
- 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
Thanks for the help dude
Cheers,
Junaid
Art imitates life
-
- koen
- 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
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
-
- koen
- Member
- 795 posts
- Joined: April 2020
- Offline
-
- Quick Links