I have baked SDF from mesh (using unity SDF baker) (mesh as on the picture) and then I use this sdf for spawning particles with some offset over the mesh, and for collision.
Particles falls with gravity and are colliding with a sdf collider.
Unfortunately the particles start to leak through the SDF collision until no particle is on the surface.
For performance reasons, the implementation of the SDF collision is pretty naive. It anticipates the next position based on the delta time and current velocity (see here).
This approach can miss thin objects or particles which are moving too fast.
In your case, you can workaround the issue adding a collision with a plane below however, it won’t prevent particles to go through your terrain.
Actually, if you are really trying to collide a terrain generated from an height map, it would be more approriate to compute the collision directly on this heightMap. We aren’t providing a builtin block for this specific case. It’s doable within the graph but I’m aware it can be really complex to achieve.
But It do not miss the particles on first impact, when particles are the fastest collision is proper, and then when the particles are not moving they are slowly sinking.
Interesting, Is the Gravity Block applied after or before the Collision Block ? Both are valid but having the Gravity before should minimize the needed adjustement of the position.
Can you share your data ? Maybe we missed something here.
Thanks, according to your generated data, the source mesh used to generate the SDF wasn’t closed. Thus, below the “ground” of your mesh, the distance field is positive, it explains why the particles can be sucked.
To solve this problem you can :
Close the holes of your mesh
Optionally, you can extend the bounds of the SDF along the z axis during baking
If you want to check the content of the generated data, you can take a look at the debug view in SDF Bake Tool. Alternatively, you can use a “Conform to SDF” block to verify if there isn’t a loophole in the source SDF data.
Additionally, you should be aware the collision integrating the radius of particles with a non uniform scale transform can lead to unexpected result with extreme stretching (it’s also the case with collision with primitive).That’s why I suggested to extend the z bound.
You’re welcome, it’s always a pleasure. Actually, thanks to this thread, we also realized the Collide With SDF block can be more robust for this kind of scenario, we registered an issue (this link is probably not yet available when you are reading).