# Performance Implications of Different Target Quad Counts in AutoRemesher

> Discover how target quad counts impact AutoRemesher performance. Learn about runtime and memory implications as element count increases, with costs scaling linearly.

- Repository: [Jeremy HU/autoremesher](https://github.com/huxingyi/autoremesher)
- Tags: performance
- Published: 2026-07-11

---

**Increasing the target quad count in AutoRemesher directly increases runtime and memory usage because the internal isotropic remesher processes roughly twice as many triangles as the target quad count, with computational cost scaling linearly in the number of elements.**

The target quad count is the primary control knob for mesh density in the huxingyi/autoremesher open-source project. This parameter not only determines the resolution of the final quad-dominant mesh but also dictates the computational resources required during generation. Understanding how `m_targetQuadCount` translates to processing overhead is essential for balancing output quality against execution time and RAM consumption.

## How Target Quad Count Drives the Remeshing Pipeline

### The Triangle-to-Quad Conversion Factor

In [`src/mainwindow.cpp`](https://github.com/huxingyi/autoremesher/blob/main/src/mainwindow.cpp) at lines 707-714, the application stores the user-specified value in the member variable `m_targetQuadCount`. Before the remeshing algorithm executes, the code converts this to an internal triangle count using the relationship `targetTriangleCount = targetQuadCount * 2`.

This multiplication factor is hard-coded in the parameter preparation logic. The underlying **isotropic remesher** located in [`src/AutoRemesher/isotropicremesher.cpp`](https://github.com/huxingyi/autoremesher/blob/main/src/AutoRemesher/isotropicremesher.cpp) operates exclusively on triangle meshes during the refinement phase, meaning every quad requested results in approximately two triangles being processed through the splitting, collapsing, and smoothing loops.

### Memory and Runtime Scaling

The remeshing pipeline allocates dense C++ containers for vertices, half-edges, and faces. As the target quad count increases:

- **Memory footprint** grows approximately linearly because each new triangle requires storage for its geometric data and connectivity information.
- **CPU time** scales with the number of edges processed during isotropic refinement, with each iteration visiting the expanded triangle set.

## Performance Characteristics by Quad Count Range

### Low Target Counts (1,000–10,000)

Setting `targetQuads` to a low value minimizes the triangle pool processed by the remesher. This configuration yields:

- **Faster generation** due to fewer edge operations in the refinement loops.
- **Lower RAM usage**, making it suitable for quick previews or low-detail assets.
- **Reduced fidelity**, potentially losing fine surface details in high-curvature regions.

### Medium Target Counts (50,000–200,000)

This range represents a balanced trade-off between processing time and geometric fidelity. When combined with the **adaptivity** parameter (`m_adaptivity`), the generator can allocate extra density to curved areas without exploding the total element count. This range is optimal for production characters and prop assets where detail must be preserved but processing time remains reasonable.

### High Target Counts (500,000–1,000,000+)

High values push the limits of the implementation:

- The generator processes roughly one to two million triangles, causing the refinement algorithms in [`src/quadmeshgenerator.cpp`](https://github.com/huxingyi/autoremesher/blob/main/src/quadmeshgenerator.cpp) to dominate CPU resources.
- **Memory consumption** increases significantly as the storage for the intermediate triangle mesh expands.
- The user interface may become sluggish because the remeshing thread consumes available processing power for extended periods.

## Adjusting Related Parameters for Performance

### Edge Scaling and Global Density

The `edgeScaling` parameter (stored in `m_targetScaling`) acts as a global multiplier on the target edge length. When combined with a high quad count, a low scaling factor creates a uniformly dense mesh that is especially computationally demanding. Raising the edge scaling reduces the effective triangle count without modifying the target quad parameter.

### Adaptivity and Local Refinement

The **adaptivity** parameter controls how unevenly quads are distributed across the surface. High adaptivity allows you to reduce the target quad count while preserving detail in high-curvature regions. This interaction provides a way to maintain output quality without incurring the full performance penalty of a uniformly high quad density.

## Implementation Details in the Source Code

The parameter flow through the codebase follows this path:

1. **UI Input**: In [`src/mainwindow.cpp`](https://github.com/huxingyi/autoremesher/blob/main/src/mainwindow.cpp) (lines 707-714), the `setHeadlessParams` function receives `targetQuads` and assigns it to `m_targetQuadCount`.
2. **CLI Parsing**: [`src/main.cpp`](https://github.com/huxingyi/autoremesher/blob/main/src/main.cpp) (lines 102-105) parses the `--target-quads` flag from the command line into the parameters structure.
3. **Conversion**: Before invoking the generator, the code sets `parameters.targetTriangleCount = m_targetQuadCount * 2`.
4. **Processing**: [`src/quadmeshergenerator.cpp`](https://github.com/huxingyi/autoremesher/blob/main/src/quadmeshergenerator.cpp) passes this value to the isotropic remesher, which performs the computationally expensive edge refinement.

## Practical Configuration Examples

Use the command-line interface to specify performance-critical parameters:

```bash
./autoremesher \
  --input model.obj \
  --output remeshed.obj \
  --target-quads 50000 \
  --edge-scaling 1.5 \
  --adaptivity 0.8

```

From the Qt UI implementation in [`src/mainwindow.cpp`](https://github.com/huxingyi/autoremesher/blob/main/src/mainwindow.cpp), the widget initialization and value conversion work as follows:

```cpp
// Widget creation for target quad input
m_targetQuadCountWidget = new IntNumberWidget(this, false);
m_targetQuadCountWidget->setItemName(tr("Target Quads"));
m_targetQuadCountWidget->setRange(1000, 1000000);
m_targetQuadCountWidget->setValue(m_targetQuadCount);
connect(m_targetQuadCountWidget, &IntNumberWidget::valueChanged,
        [=](int value) { m_targetQuadCount = value; });

// Conversion before remeshing
parameters.targetTriangleCount = m_targetQuadCount * 2;

```

## Summary

- **Target quad count** is the primary performance lever in AutoRemesher, directly controlling mesh density and processing overhead.
- A hard-coded **multiplier of 2** converts target quads to triangles, meaning resource usage scales linearly with the input value.
- **Low counts** (1,000–10,000) prioritize speed; **medium counts** (50,000–200,000) balance quality and performance; **high counts** (500,000+) maximize detail at significant computational cost.
- **Edge scaling** and **adaptivity** provide secondary controls to fine-tune resource consumption without altering the base target count.

## Frequently Asked Questions

### How does AutoRemesher convert target quads to triangles internally?

According to the source code in [`src/mainwindow.cpp`](https://github.com/huxingyi/autoremesher/blob/main/src/mainwindow.cpp) at lines 707-714, the application stores the user-defined `targetQuads` in `m_targetQuadCount`, then converts this to `targetTriangleCount` using a hard-coded multiplication by 2 before passing the value to the isotropic remesher.

### Why does increasing the target quad count make the remesher slower?

The isotropic remesher implemented in [`src/AutoRemesher/isotropicremesher.cpp`](https://github.com/huxingyi/autoremesher/blob/main/src/AutoRemesher/isotropicremesher.cpp) iterates over every triangle to perform edge splits, collapses, and smoothing operations. Since the internal triangle count equals roughly twice the target quad count, runtime increases linearly as the mesh density grows, and memory allocation for the mesh data structures expands proportionally.

### What is the relationship between adaptivity and target quad count performance?

Adaptivity (`m_adaptivity`) controls the distribution of quads across the surface, allocating more elements to high-curvature areas. High adaptivity allows you to use a lower target quad count while preserving detail in complex regions, effectively improving output quality without incurring the full performance penalty of uniformly increasing the quad density across the entire mesh.

### Is there a hard limit on the target quad count in AutoRemesher?

The Qt UI widget defined in [`src/mainwindow.cpp`](https://github.com/huxingyi/autoremesher/blob/main/src/mainwindow.cpp) sets a range of 1,000 to 1,000,000 quads via `setRange(1000, 1000000)`, though the underlying algorithm in [`src/quadmeshgenerator.cpp`](https://github.com/huxingyi/autoremesher/blob/main/src/quadmeshgenerator.cpp) could theoretically process more if sufficient memory is available. Practical limits depend on available RAM and CPU processing time rather than artificial software caps.