MROffset to keep sharp features
you use openvdb to do mesh offset. It is good. but the origin openvdb code can not preserve sharp features. Do you have plans to optimize the code to keep sharp features?
Positive offset (outside of original surface) is a smooth surface with minimal convex curvature radius equal to offset distance (it can have sharp concave regions, but they are not in the same places where the original surface had them). Please clarify, what do you mean. If you have some samples (input and expected result), that will help us.
I have a box with 8 vertices,12 triangles ,20mm20mm20mm, offset -1, the result doesnt have sharp edges as the input .like this

Thanks, I see, you are interested in negative offset, which shall produce sharp edges. We will try to work on it later this year.
you use openvdb core library to do offseting which may not keep sharp, but openvdb_houdini has functions to keep sharp,maybe it will help, https://github.com/AcademySoftwareFoundation/openvdb/blob/master/openvdb/openvdb/tools/VolumeToMesh.h#L279 https://github.com/AcademySoftwareFoundation/openvdb/blob/master/openvdb_houdini/openvdb_houdini/GeometryUtil.cc#L568
I do not understand the code above,if you solve this problem ,please tell me thanks
Currently you can highlight sharp edges using post-processing with Decimate tool:
Please increase Max Error and decrease Stabilizer for more sharpness.
The result will be as follows:

Does it work for you?
Decimation tool can sharpen features when Max Error is large enough ,But it will cause large deformation elsewhere, So I do not think it is a perfect solution
@Fedr Will you solve this issue recently?I really expect this function。Thank you
Yes, we are working on it.
Please look at our latest release. It contains Sharpen Features option in Offset and Remesh tools to reproduce sharp edges and corners:
Blue - mesh with new option, grey - old offset mesh.
If I use the function in MROffset.h ,it still can not keep sharp. So where is the function to offset mesh while keep sharp?
dog.zip
Here is a bug
Thanks for you finding. The problem with Dog mesh is that it contains big self-intersecting areas:
And our sharpening method currently requires self-intersection free meshes on input. If this condition is not satisfied, you see the artifacts as on your picture.
We will think how to reduce the amount of damage from self-intersections.
As to single function for sharp offset, yes, it is a good idea and we will create it. Currently one needs to call several functions to get sharpened result: floatGridToVdbVolume, vdbVolumeToMesh, sharpenMarchingCubesMesh.
In the master branch of MeshLib, you can find and improvement. Now -1 offset of Dog with sharpening looks as follows:

And we introduced simple function for this operation:
// Offsets mesh by converting it to voxels and back
// post process result using reference mesh to sharpen features
[[nodiscard]] MRMESH_API tl::expected<Mesh, std::string> sharpOffsetMesh( const Mesh& mesh, float offset, const SharpOffsetParameters& params = {} );
Thanks I ll do more tests recently,and will tell you if I find bugs
1-2.zip
I do not know how to choose parameters to generate a good mesh that keep sharp
I see your point. The best I could do with this input is to reduce voxel size to 0.3 and remove smaller connected components after offset:
Resulting mesh:
12offset.zip
The place highlighted on the picture is ragged because probably two surfaces join here at very acute angle. We will investigate and probably add another parameter to control it. Hope to return to you next week with an update.
In today release of MeshLib and MeshInspector we introduced several improvements in Offset tool and added one more setting in UI. And now the output looks as follows (with shown parameters):
Resulting mesh:
12offsetBetter.zip