3
$\begingroup$

I have some python scripts that generate and run a fluid simulation in Blender for me. To my understanding, Blender uses a voxel grid for it's volumetric fluid representation in the fluid simulator with a mesh laid on top. I'd like to be able to read the state of that voxel grid at each frame in the simulation (and, say, save that state to a file). Is it possible to do this programmatically when interacting with Blender? Maybe it would be possible to read the cache files somehow?

Thanks!

$\endgroup$
4
  • $\begingroup$ Interesting idea. I think that the state of each frame is not in an easily stored variable or something, but more like the calculation is done and output is written to the mesh, then the next calculation is done. I once asked a related question: "Is it possible to pause and later resume a fluid sim bake?" and the answer was basically no. I believe that if speed and vector data were stored in a file for each frame, both of these features could be implemented. $\endgroup$
    – Mentalist
    Jan 27, 2016 at 3:45
  • $\begingroup$ I was just looking through the Blender source at where they read in the fluid bake cache files, and it looks like it should be fairly straight forward to write a script to read those in, which will give you the mesh and velocities. But I haven't been able to find a way to get the actual voxel grid. $\endgroup$
    – BaxterLab
    Jan 27, 2016 at 3:53
  • $\begingroup$ I see. I don't understand the details of how it works, but I imagine that the mesh would be a product of the voxel data. In other words, from the voxel data and motion vector data you could derive a mesh, but not the other way around. In any case, the voxel grid may not exist in the code as its own construct, but something that is hidden within the math itself. But again, the subject is over my head. Would love to hear a plain English explanation from the devs of the fluid sim about how it works. $\endgroup$
    – Mentalist
    Jan 27, 2016 at 4:06
  • $\begingroup$ I think you're right. I'd love to hear more from the devs about it, but I'm not sure even they would know. It looks like they use the El'Been fluid simulation library, which doesn't seem to have been updated for ~10 years. $\endgroup$
    – BaxterLab
    Jan 27, 2016 at 4:20

0

You must log in to answer this question.

Browse other questions tagged .