AutoRemesher Sharp Edge Detection: How It Works and Recommended Threshold Values
AutoRemesher detects sharp edges by converting a user-defined degree threshold to radians and testing the dihedral angle between adjacent mesh faces, preserving edges that exceed the threshold during isotropic remeshing.
AutoRemesher—an open-source automatic quad remeshing tool available at huxingyi/autoremesher—relies on the IsotropicRemesher library to identify geometric creases before processing. Understanding this sharp edge detection mechanism is essential for maintaining hard-surface details in engineering models, scanned data, or stylized assets.
How Sharp Edge Detection Works in AutoRemesher
Radian Conversion in the Constructor
In thirdparty/isotropicremesher/isotropicremesher.cpp, the constructor converts the user-facing degree value to an internal radian threshold. At line 38, the implementation uses:
m_sharpEdgeThresholdRadians = (180.0 - degrees) * (M_PI / 180.0);
This formula inverts the measurement because the algorithm tests for deviation from flatness. A smaller input degree (e.g., 20°) produces a larger radian threshold (~2.79 rad), meaning only edges with face normals nearly opposite each other (close to 180° apart) are classified as sharp.
Feature Edge Extraction and Classification
When remeshing begins, the system extracts sharp features by calling featureEdges() on the half-edge mesh. At line 333 in isotropicremesher.cpp, the code invokes:
m_halfedgeMesh->featureEdges(m_sharpEdgeThresholdRadians);
The implementation in thirdparty/isotropicremesher/isotropichalfedgemesh.cpp iterates over all edges, computes the dihedral angle between incident face normals, and marks the edge as sharp if the angle exceeds the supplied radian threshold.
Preservation During Remeshing
Once marked, these sharp edges act as topological constraints. The isotropic remeshing algorithm prohibits edge splits, collapses, and flips across sharp boundaries, ensuring that visual creases and mechanical hard edges remain intact in the final output.
Recommended Sharp Edge Threshold Values
The threshold parameter represents the minimum dihedral angle (in degrees) required to classify an edge as sharp. Based on the implementation in the AutoRemesher source code, use the following ranges:
- 20° – 30°: Preserves subtle creases in low-poly stylized models or organic surfaces with soft transitions. This corresponds to radian thresholds of approximately 2.79 to 2.36 radians.
- 30° – 45°: The recommended default for mechanical parts, CAD models, and hard-surface assets. This range (approximately 2.36 to 1.92 radians) captures standard hard edges while ignoring minor surface noise.
- 60° – 90°: Isolates only extreme features like cracks, spikes, or knife-sharp corners in scanned data. This translates to radian thresholds of 1.57 to 0.79 radians.
Because the conversion formula (180.0 - degrees) creates an inverse relationship, smaller degree values make the detector more selective. For most workflows, 30° serves as an effective default that balances detail preservation with mesh cleanliness.
Configuring Thresholds in Code
Configure the sharp edge threshold programmatically via the Parameterizer class before initializing the remesher:
#include <AutoRemesher/parameterizer.h>
#include <AutoRemesher/isotropicremesher.h>
AutoRemesher::Parameterizer param;
param.sharpEdgeThresholdDegrees = 30.0; // Set to 30 degrees
AutoRemesher::IsotropicRemesher remesher(param);
remesher.remesh(inputMesh, outputMesh);
To verify the internal radian value after construction:
double radianThreshold = remesher.getSharpEdgeThresholdRadians();
// Returns ~2.36 rad when input is 30 degrees
Key source files implementing this logic include:
thirdparty/isotropicremesher/isotropicremesher.cpp: Handles threshold conversion at line 38 and initiates feature detection at line 333.thirdparty/isotropicremesher/isotropichalfedgemesh.cpp: Contains thefeatureEdges(double radians)implementation.src/AutoRemesher/parameterizer.cpp: Defines the user-facingsharpEdgeThresholdDegreesparameter.
Summary
- AutoRemesher detects sharp edges by converting degree thresholds to radians using
(180.0 - degrees) * (M_PI / 180.0)inisotropicremesher.cpp. - The geometric test occurs in
IsotropicHalfedgeMesh::featureEdges(), which marks edges where the dihedral angle exceeds the calculated threshold. - 30° is the recommended default threshold for general hard-surface models, while 20°–30° preserves subtle creases and 60°–90° isolates only extreme features.
- Marked sharp edges are protected as constraints during remeshing, preventing topology changes across creases.
Frequently Asked Questions
What is the default sharp edge threshold in AutoRemesher?
While the source code does not enforce a hardcoded universal default, the UI and reference implementations typically use 30 degrees as the starting value. This setting provides an effective balance that preserves most mechanical hard edges while filtering out minor surface irregularities.
Why does a smaller degree value result in fewer detected sharp edges?
The conversion formula subtracts the input from 180 degrees, so a smaller input (e.g., 20°) produces a larger radian threshold (~2.79 rad). Since the algorithm marks edges only when the dihedral angle exceeds this threshold, fewer edges qualify. This restricts sharp classification to edges with face normals that are nearly opposite (nearly 180° apart).
How do I disable sharp edge detection entirely?
To effectively disable detection, set the threshold to 0 degrees. This results in a radian value of π (180°), meaning only edges with exactly 180° between incident face normals would be considered sharp—effectively treating all edges as smooth during remeshing.
Can I adjust the threshold after constructing the IsotropicRemesher object?
No, the threshold is locked during construction when featureEdges() is first called. To change the detection sensitivity, you must create a new Parameterizer instance with the desired degree value and instantiate a fresh IsotropicRemesher object.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →