taichi_elements icon indicating copy to clipboard operation
taichi_elements copied to clipboard

Sphere colliders

Open yuanming-hu opened this issue 5 years ago • 10 comments

I can add simple colliders to the solver. To begin with, I would simply do spheric colliders only.

A question for @PavelBlend: what is the best way to specify the trajectory of the sphere?

yuanming-hu avatar Apr 08 '20 17:04 yuanming-hu

It is possible to make a motionless sphere for now. Or do you want the sphere to interact with particles? If the sphere is dynamic, then you can simply indicate to it the initial velocity along the X axis (1.0, 0.0, 0.0).

PavelBlend avatar Apr 08 '20 17:04 PavelBlend

Sure, I can easily do motionless or specify a fixed velocity.

yuanming-hu avatar Apr 08 '20 17:04 yuanming-hu

But will it be difficult in the future to make the sphere dynamic? Will I have to break a lot of code? If not, then for the first time you can get around motionless obstacles.

PavelBlend avatar Apr 08 '20 17:04 PavelBlend

No, that's not difficult at all. I agree we should just demonstrate the possibility and let the community to contribute fancier versions.

yuanming-hu avatar Apr 08 '20 17:04 yuanming-hu

I have a question: What will colliders be like? Particles, voxels or mesh?

PavelBlend avatar Apr 10 '20 14:04 PavelBlend

I have a question: What will colliders be like? Particles, voxels or mesh?

Currently, just spheres. We can improve later to support arbitrary meshes/voxels.

yuanming-hu avatar Apr 10 '20 14:04 yuanming-hu

Hi Yuan Ming,

I have started looking into supporting arbitrary meshes. What I have done is quite simple, I just get the positions and normals of the triangles centroid and add them to the engine using add_surface_collider. It works but it's very slow during initialisation. The number of triangles is just over 1000 when it took more than 5 minutes to initialise. How can we speed up the initialisation process when adding these colliders or we need a different approach? Thanks.

Sam

anthropoy avatar Jan 10 '22 01:01 anthropoy

Hi, Could you show me the code where you add these triangles? Maybe I could take a look when available. Maybe we should try using SDF instead of manually add these triangles

Jack12xl avatar Jan 19 '22 15:01 Jack12xl

Hi Jack,

Thanks for responding. After dwelling in a bit more, I did realise that what I did there was wrong. The existing add_surface_collider function is not suitable for arbitrary meshes, it will just create an infinite plane for each point and normals. I was looking for existing python packages that could calculate SDF for meshes fast. Trimesh seems to be a good candidate but I'm not sure what's the best way to integrate this into taichi_element. Or what do you suggest? Appreciate your help and pointers. Thanks!

anthropoy avatar Jan 19 '22 16:01 anthropoy

you may want to check libigl (comes with python bindings)

r03ert0 avatar Jan 19 '22 16:01 r03ert0