AutoRemesher Model Types: Organic vs HardSurface Mesh Processing

AutoRemesher supports two distinct model types—Organic for smooth, flowing geometry and HardSurface for sharp, man-made features—controlled via the ModelType enum in src/AutoRemesher/autoremesher.h.

The open-source huxingyi/autoremesher library distinguishes between organic and hard-surface meshes through a dedicated enumeration that dictates how the remeshing algorithm handles sharp edges, normal smoothing, and gradient adaptivity. Understanding these AutoRemesher model types is essential for achieving optimal results whether you are processing character models or mechanical CAD parts.

The ModelType Enum Definition

The core classification resides in src/AutoRemesher/autoremesher.h, where the enum class ModelType declares two distinct values:

  • ModelType::Organic
  • ModelType::HardSurface

Organic Models

The Organic model type is optimized for smooth, flowing geometry such as characters, creatures, and terrain. When this mode is active, the algorithm prioritizes curvature-preserving remeshing, smooth normal interpolation, and adaptive edge-length control to maintain natural surface continuity.

HardSurface Models

The HardSurface model type targets man-made objects including mechanical parts and architectural elements. This mode emphasizes preservation of hard edges, sharp-edge detection, and minimal smoothing of normal directions to retain crisp geometric features.

How to Set Model Types in Code

You configure the processing behavior through the AutoRemesher::setModelType() method after constructing an instance.

Basic Implementation

#include "AutoRemesher/autoremesher.h"
#include "AutoRemesher/Vector3.h"
#include <vector>

int main() {
    // Load geometry (vertices + triangle index list)
    std::vector<AutoRemesher::Vector3> vertices = /* … */;
    std::vector<std::vector<size_t>> triangles = /* … */;

    // Construct the remesher
    AutoRemesher::AutoRemesher remesher(vertices, triangles);

    // Choose the model type
    remesher.setModelType(AutoRemesher::ModelType::HardSurface);
    // Alternative: remesher.setModelType(AutoRemesher::ModelType::Organic);

    // Configure additional parameters
    remesher.setTargetTriangleCount(5000);
    remesher.setScaling(1.0);

    // Execute remeshing
    if (remesher.remesh()) {
        const auto& newVerts = remesher.remeshedVertices();
        const auto& newQuads = remesher.remeshedQuads();
        // Process results...
    }
}

Default Behavior

If you do not explicitly call setModelType(), the library defaults to Organic mode. This is defined in the private member declaration within src/AutoRemesher/autoremesher.h:

private:
    ModelType m_modelType = ModelType::Organic;   // default

UI Integration in the AutoRemesher Application

The Qt-based GUI stores the current selection in src/mainwindow.h using the member AutoRemesher::ModelType m_modelType, initialized to Organic. When users switch modes via the interface, the application invokes setModelType() as implemented in src/mainwindow.cpp:

void MainWindow::onModelTypeChanged(int index) {
    // index 0 → Organic, index 1 → HardSurface
    AutoRemesher::ModelType type = (index == 0)
        ? AutoRemesher::ModelType::Organic
        : AutoRemesher::ModelType::HardSurface;

    m_autoRemesher->setModelType(type);
}

Technical Impact on Remeshing

The selected model type directly influences three critical aspects of the remeshing pipeline according to the source implementation:

  1. Sharp Edge Treatment: HardSurface mode preserves creases and corners, while Organic mode smooths them.
  2. Normal Smoothing: Organic applies interpolated normals for soft shading; HardSurface minimizes smoothing to maintain faceted appearances.
  3. Gradient Adaptivity: Organic uses curvature-based adaptive edge lengths, whereas HardSurface maintains uniform density near sharp features.

The src/quadmeshgenerator.cpp file applies these settings during the actual mesh generation phase by reading the configured type from the AutoRemesher instance.

Summary

  • AutoRemesher defines two model types in src/AutoRemesher/autoremesher.h: Organic for natural shapes and HardSurface for mechanical objects.
  • Use setModelType() to switch modes programmatically; the default is Organic as initialized in the class constructor.
  • HardSurface prioritizes edge preservation and minimal normal smoothing, while Organic emphasizes curvature preservation and smooth interpolation.
  • The Qt GUI in src/mainwindow.cpp demonstrates typical UI integration for toggling between modes via the onModelTypeChanged() handler.

Frequently Asked Questions

What is the default model type in AutoRemesher?

The default model type is Organic, as defined by the private member initialization ModelType m_modelType = ModelType::Organic in src/AutoRemesher/autoremesher.h. This default is also reflected in the GUI implementation in src/mainwindow.h, where the member m_modelType is explicitly initialized to AutoRemesher::ModelType::Organic.

How do I switch between Organic and HardSurface modes programmatically?

Call the setModelType() method on your AutoRemesher instance, passing either AutoRemesher::ModelType::Organic or AutoRemesher::ModelType::HardSurface. This method is declared in src/AutoRemesher/autoremesher.h and modifies the internal m_modelType member used during the remeshing operation in src/quadmeshgenerator.cpp.

When should I use HardSurface mode instead of Organic?

Use HardSurface mode when processing mechanical parts, architecture, or any model requiring preservation of sharp edges and crisp geometric features. Use Organic mode for character models, terrain, or organic shapes where smooth surface continuity and curvature-adaptive edge lengths are desired.

Does the model type affect the output triangle count?

The model type itself does not change the target triangle count specified via setTargetTriangleCount(), but it influences how triangles are distributed across the surface. HardSurface mode concentrates density around sharp features to preserve edges, while Organic mode distributes triangles based on surface curvature, potentially yielding different topological patterns at the same target count.

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 →