Closed xingyul3 closed 4 years ago
Hi, we purposefully do not include any instructions for doing this, because there are many different ways to achieve a rendering such as the one in the video. First for reading partio files, have a look at the partio repository. If you decide to use the python bindings you could use code similar to the following to read partio data
import partio
import numpy as np
def read_partio_data(file):
headers = partio.readHeaders(file)
data = partio.read(file)
info = {headers.attributeInfo(i).name: (headers.attributeInfo(i), headers.attributeInfo(i).count, headers.attributeInfo(i).type) for i in range(headers.numAttributes())}
np_data = np.array([data.get(info["position"][0], i) for i in range(data.numParticles())]).astype(np.float64)
min = np.array([np.amin(np_data[:,i]) for i in range(3)]) - np.ones((3,))
max = np.array([np.amax(np_data[:,i]) for i in range(3)]) + np.ones((3,))
return np_data, min.astype(np.float32), max.astype(np.float64)
As an alternative you could use vtk to export particle data. Going from particle data to what you see in the video typically involves the following steps
There are many additional resources out there to help you with the steps above. This project is "only" meant to solve incompressible fluid flow problems using SPH and none of the above.
Thanks a lot for the replies. They are really helpful.
Hi, thanks for releasing this awesome project. I'm just wondering how to read the dumped bgeo files with python (both particle positions and velocities). Also, how to reconstruct transparent fluid surfaces from the particles to high-quality generate images like this video? Is it possible to read the reconstructed surface also in python (e.g. as a mesh)? Thanks a lot!