How to Preserve Sharp Edges with AutoRemesher: A Complete Technical Guide

You can preserve sharp edges with AutoRemesher by setting a dihedral angle threshold in degrees; the algorithm converts this to an included-angle radian value and marks exceeding edges as feature edges, excluding them from collapse and smoothing operations during remeshing.

When remeshing 3D models, maintaining geometric fidelity at hard creases is critical for production workflows. You can preserve sharp edges with AutoRemesher, an open-source isotropic remeshing library by huxingyi, by configuring a user-defined angle threshold that protects feature edges through the entire pipeline. This guide explains the exact source code implementation, from UI parameter to geometric constraint.

How to Preserve Sharp Edges with AutoRemesher: The Pipeline

The workflow follows a strict data flow from the user interface to the half-edge data structure. Understanding each stage ensures you can reliably configure edge preservation in both GUI and API contexts.

Setting the Angle Threshold

The process begins with the sharp edge degrees parameter, representing the dihedral angle cutoff. In the GUI, this appears as a slider control stored in m_sharpEdgeDegrees src/mainwindow.cpp. For programmatic access, the IsotropicRemesher class exposes setSharpEdgeDegrees() to configure this threshold before remeshing begins src/AutoRemesher/isotropicremesher.h.

Parameter Propagation to the Core Engine

When remeshing initiates, the parameter travels through the generator layer. The QuadMeshGenerator forwards the user-defined degrees to the remesher instance via m_autoRemesher->setSharpEdgeDegrees(m_parameters.sharpEdgeDegrees) src/quadmeshgenerator.cpp. This bridges the UI settings to the computational backend.

Radian Conversion and Feature Detection

Before mesh processing, the system converts degrees to radians using the complement formula to calculate the included angle:

m_sharpEdgeThresholdRadians = (180 - degrees) * (M_PI/180.0);

This conversion occurs in setSharpEdgeIncludedAngle src/AutoRemesher/isotropicremesher.cpp. During remeshing, the half-edge mesh marks edges exceeding this threshold via m_halfedgeMesh->featureEdges(m_sharpEdgeThresholdRadians) src/AutoRemesher/isotropicremesher.cpp. These marked edges are excluded from edge-collapse and Laplacian smoothing operations.

Implementation Code Examples

C++ API Configuration

Use the AutoRemesher class interface to programmatically preserve sharp edges:

#include "AutoRemesher/autoremesher.h"

// Initialize with your mesh data
AutoRemesher::AutoRemesher remesher(vertices, triangles);

// Preserve edges sharper than 45 degrees
remesher.setSharpEdgeDegrees(45.0);

// Execute remeshing
bool success = remesher.remesh();

// Access results
const auto& newVertices = remesher.remeshedVertices();
const auto& newTriangles = remesher.remeshedTriangles();

GUI Workflow

  1. Launch AutoRemesher and load your target mesh.
  2. Locate the Sharp Edge slider (default: 60°).
  3. Adjust the threshold—lower values (e.g., 30°) preserve more edges, while higher values allow increased smoothing.
  4. Click Remesh; the system automatically propagates your setting through setSharpEdgeDegrees() and protects detected features.

Key Source Files and Functions

Understanding the architecture requires familiarity with these specific components:

Summary

  • AutoRemesher preserves sharp edges by treating them as feature edges in the half-edge data structure.
  • The pipeline uses a dihedral angle threshold converted to an included-angle radian via (180 - degrees) * π/180.
  • Critical functions include setSharpEdgeDegrees() for configuration and IsotropicRemesher::featureEdges() for geometric marking.
  • Implementation spans from mainwindow.cpp through quadmeshgenerator.cpp to the core logic in isotropicremesher.cpp.

Frequently Asked Questions

What dihedral angle should I use to preserve sharp edges with AutoRemesher?

Start with 60 degrees for general mechanical parts, which preserves intentional hard edges while allowing slight smoothing on rounded corners. Use 30–45 degrees for high-detail models like character armor where subtle creases must remain crisp, and 90 degrees for architectural models with strict right angles.

Does AutoRemesher support per-edge sharpness control?

The current implementation uses a global threshold via setSharpEdgeDegrees() applied to the entire mesh. According to the source code in isotropicremesher.cpp, the featureEdges() method evaluates all edges against the single m_sharpEdgeThresholdRadians value. Per-edge customization would require modifying the half-edge marking logic directly.

Why are my sharp edges still being smoothed after I adjusted the threshold?

Verify that you call setSharpEdgeDegrees() before remesh(), as the threshold is only applied during the initial feature detection phase at line 330 of isotropicremesher.cpp. Additionally, ensure your angle value is appropriate—values too high (e.g., 170°) treat nearly all edges as smooth, while extremely low values (e.g., 10°) may over-constrain the mesh and cause artifacts.

How does preserving sharp edges affect final mesh density?

Protecting sharp edges constrains the remeshing algorithm along creases, often resulting in higher triangle density near these features to maintain geometric fidelity. The isotropic remesher balances this against the target edge length, so very low sharp-edge thresholds may produce locally dense clusters around every minor ridge.

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:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →