PointCloudLibrary / pcl

Point Cloud Library (PCL)
https://pointclouds.org/
Other
10.05k stars 4.62k forks source link

Fluid Surface from Particles #2809

Closed ghost closed 5 years ago

ghost commented 5 years ago

I tried PCL poisson reconstruction and also greedy projection on a point cloud containing anisotropic particles (ellipsoids). But yet my results are not satisfying. Are there special parameters to set, to get a surface reconstruction of a fluid? The particles are oriented (U, V, W vectors) and 3 scales, where W is the normal vector when the particles are rendered using ellipsoid splatting.

Your Environment

Context

Particles are built with NVIDIA Flex and are correctly rendered when using ellipsoid splatting of Flex on a rasterizer; but I want to render them using raytracing (Path Tracing). I need a mesh where all of them are merged into one big geometry instead of one instance per ellipsoid. fluid_surface

Is there something implemented in PCL as described in this paper: "Fluid Surface Reconstruction from Particles" by Brent Warren Williams (2008) ? Or are some of the components of that algorithm present in PCL? Especially: unweighted graph Laplacian matrix, Gauss-Seidel, integrated Bilaplacian matrix ? Are there examples about them present online ?

Is there a ray-splat intersection (based on an octree) implemented in PCL ? As described under 4.3 of "Splat-based ray tracing of point clouds" Article in Journal of WSCG 15:51-58 · January 2007 ?

ghost commented 5 years ago

I also now tried out MarchingCubesRBF of PCL. (using https://github.com/PointCloudLibrary/pcl/blob/master/tools/marching_cubes_reconstruction.cpp as a starting point using default values) As you see in the screenshot (of a visualization of the created mesh in Blender) its working for 1000 particles. But already on 5000 particles it has such a high memory consumption, that my 4GB RAM are obivously not enough, cause the system constantly does disk mapping and the process uses over 1GB And unfortunately on the least required 16045 particles : Exception thrown Microsoft C++ exception: std::bad_alloc at memory location 0x000.... somewhere in MarchingCubesRBF::reconstruct ( ); A final fluid simulation would have > 100000 particles, which is simply out of range for my memory setup. A solution would be to reduce the memory usage per particle within the PCL libraries, but it was a high time consume and a real pain for me to build the PCL DLLs on my own. (as you can see in my older post https://github.com/PointCloudLibrary/pcl/issues/2787); however, I got it done. But its impossible to rebuild and debug them again and again, cause compiling and building them each time over and over again costs too much time for me.

So I think I have to implement a less-memory using MarchingCube handling on my own. UPDATE: I implemented that on my own (without using PCL); see my later post

marchingcubes

ghost commented 5 years ago

My own Marching Cubes (CPU single-threaded) implementation: (yet no Gaussian-Seidel; no radial basis function (RBF); only pure Marching Cubes)

input particles=193536

allocation_size_for_octree = 6057156 bytes allocation_size_for_neighbors = 7499336 bytes allocation_size_for_CubeCorners = 2307488 bytes allocation_size_for_CubeEdges = 3461232 bytes allocation_size_for_CubeIDdata = 72109 bytes allocation_size_for_corners = 2322400 bytes allocation_size_for_edges = 1652800 bytes allocation_size_for_TriangleList = 4326540 bytes allocation_size_for_VertexList = 9916800 bytes total ~37 MB

min/max Creation Time: 0.34msec Octree Creation Time: 19.55msec Octree Surround Search Time: 81.63msec Octree Neighbor Search Time: 155.29msec Find Corner Occupation Time: 44.21msec Building Triangles Time: 11.2msec total ~312msec

target_node_size=0.022759 MaxOctreeLevel=7 Octree Center: X=0.874593 Y=1.357760 Z=0.751348 Octree Dimension: X=-0.189877,2.905396 Y=-0.189877,2.905396 Z=-0.189877,2.905396 overall_particle_count = 166631 used_entriesOctree = 72109 final_triangle_count = 67932

myownmarchingcubes

ghost commented 5 years ago

Finally I also applied uniform laplacian mesh smoothing (inspired by this code: http://rodolphe-vaillant.fr/?e=70)

smoothedmesh smooth mesh: smooth_factor = 0.5f
4 iterations

allocation_size_for_ring1neighbors = 7437600 bytes Building Triangles Time: 11.02msec Smoothing Mesh Time: 4.34msec

smoothedmesh2 smooth mesh: smooth_factor = 1.0f
20 iterations