Closed PavelBlend closed 4 years ago
Trying to reproduce this on my end, but I get undefined nodes in Blender:
A quick question: is the mesh completely within the bounding cube? Currently the rasterizer will only seed within the simulation domain.
Have you used which commit? This scene will work on this commit: d1848fdecd1318e16e31dcf6ba70921bec1f574f
I will now create a new scene for the last commit. And it seems to me that the solver has a limit on the number of particles. And because of this, at high resolution many particles are missing.
Thanks for the reply. It was caused by my Taichi version... I'm fixing that now.
Maybe we can warn the user if taichi version does not satisfy https://github.com/taichi-dev/taichi_elements/blob/8a919456c07135d031d56c8860e6cb629fb93f0d/engine/mpm_solver.py#L8
Sorry about my poor Blender skills, but it seems to me that Suzanna is a box in this scene?
No, this is the bounds display mode. In fact, Suzanne has many polygons. You can change the display type of this object in the Properties window of the Object tab.
I see. Now on my end, it seems that no particles are seeded at all :-( I'm not sure what is happening. In order to fix this, could you please do me a favor and share with me a npy file with the triangles? For me debugging is way easier if I can reproduce it outside Blender.
Here is Suzanne. It ranges from 0, 0, 0 to 1, 1, 1. suzanne.zip
Thanks for the Suzanne mesh - I tried to reproduce it outside Blender yet it seems that now the particles are seeded in a reasonable manner. I'm not sure if that is because Blender and the following Python script has different simulator settings:
import taichi as ti
import numpy as np
import utils
from engine.mpm_solver import MPMSolver
write_to_disk = False
# Try to run on GPU
ti.init(arch=ti.cuda)
gui = ti.GUI("Taichi MLS-MPM-99", res=512, background_color=0x112F41)
mpm = MPMSolver(res=(64, 64, 64), size=1)
triangles = np.fromfile('suzanne.npy', dtype=np.float32)
triangles = np.reshape(triangles, (len(triangles) // 9, 9))
mpm.add_mesh(triangles=triangles, material=MPMSolver.material_elastic, color=0xFFFF00)
mpm.set_gravity((0, -20, 0))
for frame in range(1500):
mpm.step(4e-3)
particles = mpm.particle_info()
np_x = particles['position'] / 1.0
# simple camera transform
screen_x = ((np_x[:, 0] + np_x[:, 2]) / 2**0.5) - 0.2
screen_y = (np_x[:, 1])
screen_pos = np.stack([screen_x, screen_y], axis=-1)
gui.circles(screen_pos, radius=1.1, color=particles['color'])
gui.show(f'{frame:06d}.png' if write_to_disk else None)
Hello, @yuanming-hu I think I found the reason for the lack of particles. This error is reproduced at high resolution (256). There are particles, but they have the position 0, 0, 0. The number of particles that have a non-zero position is 2 ^ 20. I think we need to increase the max_num_particles parameter here: https://github.com/taichi-dev/taichi_elements/blob/b9140fb57875a0b40b43442c81d35c983f572551/engine/mpm_solver.py#L39 Or even remove the restriction on the maximum number of particles. Since some users have 64 GB of RAM and they will be surprised if a huge number of particles will have a position of 0, 0, 0.
The mesh is not completely filled with particles. Here is a screenshot:
This error is reproduced in this scene: test_05.zip
And at this commit: d1848fdecd1318e16e31dcf6ba70921bec1f574f