taichi-dev / taichi_elements

High-performance multi-material continuum physics engine in Taichi
MIT License
483 stars 69 forks source link

Inflow Objects #20

Closed PavelBlend closed 4 years ago

PavelBlend commented 4 years ago

@yuanming-hu I want to add inflow objects to blender. I have a question, how to do this? Need to call MPMSolver.add_mesh in every frame? To create a continuous stream of particles. Or is it more complicated? If everything is as I described, then I will start adding Inflow objects, since this is not a difficult task.

PavelBlend commented 4 years ago

I started doing this and there seems to be one problem. The blender has a restriction on what parameters can be animated. I wanted to add an animated Enable parameter. But this parameter cannot be animated, since it belongs to the node. And nodes (if I'm not mistaken) cannot have animated parameters. So far I have made an Inflow object with the Frame Start and Frame End options. This introduces its limitations, but so far I do not know what to do differently. I will try to find a workaround.

PavelBlend commented 4 years ago

I solved this problem: cb48b51aaa14a6a34c99a7535552d69e01516798

I added a new FCurve node, with which you can specify the animation for the Inflow Object.

yuanming-hu commented 4 years ago

Actually even for a static mesh, continuously seeding particles from it as inflow needs a little bit of work - I'm thinking about it.

PavelBlend commented 4 years ago

I found a mistake. It sounds like a blender mistake. I don’t know how to fix it. Particles are not visible on the render (Cycles). If you render an animation. Single frame rendering works without errors. Here is the scene: test_04.zip This scene will work on this commit: cb48b51aaa14a6a34c99a7535552d69e01516798

PavelBlend commented 4 years ago

I found a workaround for rendering particles without errors: https://gfycat.com/ru/warmheartedbelatedchevrotain

I had to make an operator that starts rendering the frame throughout the range. However, I am not sure about the correct implementation of Inflow objects.

yuanming-hu commented 4 years ago

Looks cool! Maybe we should just use your current inflow object implementation for now, which is simply continuously sampling within a mesh. In the future, we may want to make a better version, e.g. uniform particle density (note that in your implementation, the top part has lower particle density compared to the bottom).

PavelBlend commented 4 years ago

OK, then I do a merge of this branch. But I will first add an operator to render the animation in the interface.

And you need to open the issue of particle density, so as not to forget to fix it.

And can I delete your doc branch since it is already merged? It seems to me that it is better to delete branches immediately, so that they do not accumulate a large number.

yuanming-hu commented 4 years ago

OK, then I do a merge of this branch. But I will first add an operator to render the animation in the interface.

Thanks!

And you need to open the issue of particle density, so as not to forget to fix it.

Here it is: #22

And can I delete your doc branch since it is already merged? It seems to me that it is better to delete branches immediately, so that they do not accumulate a large number.

Sure! I just now deleted that branch. Sorry about the mess.