mkazhdan / PoissonRecon

Poisson Surface Reconstruction
MIT License
1.59k stars 431 forks source link

Grid output not matching poisson mesh #244

Closed sterlinglaird closed 2 years ago

sterlinglaird commented 2 years ago

I'm trying to output the scalar field via the --grid option, however when I convert this field to a mesh using an implementation of marching cubes, I get a result that appears to be 'smoothed' when compared to the mesh given by poisson reconstruction directly.

I used my own implementation of marching cubes and verified the same results (approximately) with your own marching cubes implementation (https://github.com/mkazhdan/IsoSurfaceExtraction) - both giving a 'smoothed' result. The differences are subtle, but there is a noticeable loss in detail for my application.

poisson_mesh Mesh directly from Poisson Reconstruction

grid_mesh Mesh from grid output - meshed externally through https://github.com/mkazhdan/IsoSurfaceExtraction Note the subtle smoothing of faces around the mesh.

Command line: ./PoissonRecon --in cloud.ply --out poisson.ply --depth 8 --fullDepth 8 --grid grid_test.iso I get the same results when I omit the --fullDepth parameter.

I'm trying to understand why there would be a difference. I would expect the grid output to perfectly match the values used internally, especially if we're refining the octree to the max depth used in the calculations (using --fullDepth). Is there some other particularities in the marching cubes code used here that could explain this?

mkazhdan commented 2 years ago

In computing the positions of iso-vertices, the reconstruction code evaluates both the values and derivatives at the edge endpoints. It then fits a quadratic (I believe) interpolant and uses the root of that polynomial to generate the iso-vertex position along the edge.

This could be different than using the standard linear interpolation to find the iso-vertex position.

sterlinglaird commented 2 years ago

Thanks for your insights.