ShapeWorks
ShapeWorks copied to clipboard
shapeworks::Mesh::smooth() gives poor quality results
Initial mesh:
result of shapeworks::Mesh::smooth() with 100 iterations (I tried playing with "relaxation" but couldn't get better results):
MeshLab's laplacian smooth with 3 iterations:
Is there some option that is not being exposed? Or is the VTK Laplacian Smooth doing something different?
Meshes attached meshsmooth.zip
@archanasri is this using VTK smoothing or FEMesh smoothing?
@medakk PreviewCmd (or mesh-fix) had a Laplacian smoothing with a number of iterations and lambda parameter that controls the smoothing operation.
PreviewCmd (or mesh-fix) had a Laplacian smoothing with a number of iterations and lambda parameter that controls the smoothing operation.
Is the usage documented? I don't see any binaries related to PreviewCmd or mesh-fix in build:
$ make -j8
$ ls bin/
boundary_loop_extractor
ComputeMeanNormals
ComputeMeshGeodesics
create_isosurface
GroomTests
ImageTests
libgeometry-central.so
MeshFromDT
MeshTests
OptimizeTests
ParticlesTests
PythonTests
ReconstructMeanSurface
ReconstructSamplesAlongPCAModes
ReconstructSurface
RemoveFidsDTLeakage
shapeworks
shapeworks.cpython-37m-x86_64-linux-gnu.so
ShapeWorksStudio
shapeworksTests
shared_boundary_extractor
PreviewCmd was probably removed after its consolidation. @archanasri I recall the command name was mesh-fix. Is there a new command for PreviewCmd?
@medakk you can find the filter here https://github.com/SCIInstitute/ShapeWorks/blob/master/Libs/Mesh/PreviewMeshQC/FEMeshSmoothingModifier.h
Its hard for me to tell what it's doing by looking at the code. There is a note there however:
//! \todo This implementation will only work with closed surfaces.
The shared boundary surfaces will always be open meshes
The smoothing in there right now is VTK's Laplacian. They also have windowed sinc that I will add.
Does the vtk filter support open meshes?
We are seeing the output of the vtkSmoothPolyData filter in the images above. I'm not sure about windowed sinc on open meshes.
Fwiw I've been playing with "relaxation" some more. Results improve a bit but are still off
FYI, the Mesh::fix call that uses the FEMesh stuff crashes on all three of these inputs:
$ shapeworks read-mesh --name meshlab_smooth.ply fix-mesh
zsh: segmentation fault shapeworks read-mesh --name meshlab_smooth.ply fix-mesh
$ shapeworks read-mesh --name source_mesh.ply fix-mesh
zsh: segmentation fault shapeworks read-mesh --name source_mesh.ply fix-mesh
$ shapeworks read-mesh --name sw_smooth.ply fix-mesh
zsh: segmentation fault shapeworks read-mesh --name sw_smooth.ply fix-mesh
FECoreMesh::IsType(int) FECoreMesh.cpp:19
FEMeshSmoothingModifier::Apply(FEMesh*) FEMeshSmoothingModifier.cpp:27
shapeworks::Mesh::fix(bool, bool, double, int, bool, double) Mesh.cpp:553
VTK's laplacian and windowed sinc seem to work fine on open meshes in general, but Karthik's meshes with the jagged edges don't seem to work out.
The difference is probably that Meshlab has:
parlst.addParam(RichBool ("Boundary",true,"1D Boundary Smoothing", "Smooth boundary edges only by themselves (e.g. the polyline forming the boundary of the mesh is independently smoothed). This can reduce the shrinking on the border but can have strange effects on very small boundaries."));
The current implementation of shapeworks::Mesh::smooth() already has boundary smoothing enabled:
if (relaxation)
{
smoother->SetRelaxationFactor(relaxation);
smoother->FeatureEdgeSmoothingOff();
smoother->BoundarySmoothingOn();
}
So it appears the results I've been obtaining are despite that
Is there someone more appropriate to whom this issue should be assigned? We only ported the executable to the Mesh class, so it's the same as it was before.
adding @riddhishb
@riddhishb can you check this out for 6.1?
Can we move this to 6.3?
Yes we can.
- Look into VTK loop sub-division to improve mesh quality and other smoothing options
- Check ACVD again, does it work on open meshes?
@akenmorris, @sheryjoe: Looks like windowed sinc smoothening(with added arguments) is a better option than Laplacian smoothening.
Windowed Sinc with updated options: mesh.smoothSinc(10,0.5)
Iteration: 10, passband: 0.5
smoother->SetNumberOfIterations(iterations);
smoother->BoundarySmoothingOn();
smoother->FeatureEdgeSmoothingOn();
smoother->SetFeatureAngle(180.0);
smoother->SetPassBand(passband);
smoother->SetEdgeAngle(180);
smoother->NonManifoldSmoothingOn();
smoother->Update();
Laplacian Smooth: mesh.smooth(10,0.5)
Iterations:10, relaxation: 0.5
smoother->SetRelaxationFactor(relaxation);
smoother->FeatureEdgeSmoothingOn();
smoother->BoundarySmoothingOn();
are these options exposed in Studio?
Edge angle will have to be added to Studio. Iterations and relaxation are exposed currently for Laplacian, and iteration and passband are exposed for window sinc.
Which ones do we want to expose and which ones do we want to hard-code?
- Using the edge smoothing option can curl the edges inwards
- Remeshing can cause non-manifold edges at the boundary faces that have an opposite ordering giving an inverted normal
- vtkPolyDataNormals can only fix the orientation for closed surfaces.
- Either other mesh smoothing options need to be investigated, or the shared boundary extraction has to be modified to produce smoother meshes.