# How Does the Scaling Parameter Affect Voxelization in AutoRemesher?

> Discover how the scaling parameter impacts voxelization in AutoRemesher. Learn that scaling affects grid resolution, not voxel size, which is determined by mesh area and triangle count.

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

---

**The `scaling` parameter does not affect voxelization at all; it only influences the integer grid resolution during the later parameterization stage, leaving the voxel grid size determined solely by mesh area and target triangle count.**

AutoRemesher is an open-source automatic quad remeshing tool that processes mesh islands through distinct computational stages. While the API exposes a `scaling` configuration option, developers often assume it controls the density of the initial voxelization. By examining the source code in `huxingyi/autoremesher`, this article demonstrates exactly how the **scaling parameter affects voxelization**—or more precisely, why the voxel grid remains completely independent of this value.

## The Two-Stage Processing Pipeline

AutoRemesher processes each mesh island through two sequential stages defined in [`src/AutoRemesher/autoremesher.cpp`](https://github.com/huxingyi/autoremesher/blob/main/src/AutoRemesher/autoremesher.cpp). Understanding this separation is crucial to recognizing where the scaling parameter applies.

### Stage 1: Voxel-Based Isotropic Remeshing

The first stage resamples the mesh onto a uniform voxel grid. The voxel edge length is computed in `initializeVoxelSize()` at lines 118–124, which derives the size purely from geometric properties:

```cpp
void AutoRemesher::initializeVoxelSize()
{
    double area = calculateMeshArea(m_vertices, m_triangles);
    double triangleArea = area / m_targetTriangleCount;
    // Voxel edge length derived solely from area & target count
    m_voxelSize = std::sqrt(triangleArea / (0.86602540378 * 0.5));
}

```

This `m_voxelSize` value is later passed to the `resample()` method (lines 190–199) to generate the voxelized intermediate mesh. **The `scaling` parameter is not referenced at any point during this voxel-size calculation or the resampling routine.**

### Stage 2: Parameterization and Quad Extraction

After voxelization, the mesh undergoes parameterization and quadrangulation. During this phase, the scaling parameter is finally utilized:

- The value is copied into each island's context at lines 86–89
- It is passed to the `Parameterizer` class via `setScaling()` at line 108
- Inside [`parameterizer.cpp`](https://github.com/huxingyi/autoremesher/blob/main/parameterizer.cpp) (line 44), the scaling controls the integer grid used for Geogram's `quad_cover` routine

This scaling affects the density of the final quad mesh and UV layout, but operates entirely after the voxelization stage has completed.

## Where Scaling Is Actually Applied

To understand the actual impact of the scaling parameter, examine the `Parameterizer` implementation in [`src/AutoRemesher/parameterizer.cpp`](https://github.com/huxingyi/autoremesher/blob/main/src/AutoRemesher/parameterizer.cpp).

The `setScaling()` method receives the user-provided value, which is then passed to the underlying Geogram library:

```cpp
// Inside Parameterizer – scaling passed to Geogram
GEO::GlobalParam2d::quad_cover(&M, B, U,
    m_scaling,                // Affects integer grid resolution
    constrain_hard_edges,
    do_brush,
    integer_constraints,
    m_sharpEdgeDegrees);

```

In this context, `m_scaling` dictates the resolution of the integer grid used for quadratic parameterization. A larger value produces a coarser grid (fewer, larger quads), while a smaller value generates a finer grid (more, smaller quads).

## Voxelization Constants: Area and Triangle Count

The voxel grid density depends exclusively on the relationship between total mesh area and the target triangle count. As implemented in [`autoremesher.cpp`](https://github.com/huxingyi/autoremesher/blob/main/autoremesher.cpp), the island context receives both values separately:

```cpp
for (size_t islandIndex = 0; islandIndex < trianglesIslands.size(); ++islandIndex) {
    // ...
    context.scaling = m_scaling;          // Stored but not used for voxelization
    context.voxelSize = m_voxelSize;      // Already fixed by initializeVoxelSize()
    // ...
}

```

Here, `context.voxelSize` is assigned before any scaling influence could be applied, confirming that the voxelization pipeline operates independently of the scaling configuration.

## Practical Implications for Developers

When adjusting the `scaling` parameter in `huxingyi/autoremesher`, the effects are strictly confined to the parameterization stage:

- **Voxelization stage:** Changing `scaling` produces no effect. The resampling time, intermediate vertex count, and voxel edge lengths remain identical regardless of the scaling value.
- **Parameterization stage:** Increasing `scaling` reduces the integer grid resolution, resulting in larger, fewer quads in the final mesh. Decreasing `scaling` increases grid density, producing finer, more numerous quads.

This architectural separation ensures that the voxel-based remeshing provides a consistent geometric foundation, while the scaling parameter offers fine-grained control over the final quadrangulation density.

## Summary

- The **scaling parameter** in AutoRemesher **does not affect voxelization**; it only controls the integer grid resolution during the parameterization stage.
- **Voxel size** is calculated in `initializeVoxelSize()` based solely on mesh area and target triangle count, stored in `m_voxelSize`, and passed to `resample()`.
- The scaling value is stored in island contexts at `autoremesher.cpp:86-89` and passed to `Parameterizer::setScaling()` at line 108.
- During parameterization in [`parameterizer.cpp`](https://github.com/huxingyi/autoremesher/blob/main/parameterizer.cpp), the scaling affects Geogram's `quad_cover` routine, dictating final quad density.
- Modifying `scaling` changes the UV grid density and quad size but leaves the intermediate voxel grid completely unchanged.

## Frequently Asked Questions

### Does the scaling parameter make the voxel grid finer or coarser?

No. The scaling parameter has zero effect on the voxel grid. The voxel edge length is determined exclusively by the mesh area and target triangle count in the `initializeVoxelSize()` method. Scaling only affects the integer grid used during the later parameterization stage.

### What determines the voxel size in AutoRemesher?

Voxel size is calculated from the mesh area divided by the target triangle count. Specifically, in [`autoremesher.cpp`](https://github.com/huxingyi/autoremesher/blob/main/autoremesher.cpp) lines 118–124, the code computes `triangleArea = area / m_targetTriangleCount` and derives the voxel edge length from this value, completely independent of any scaling parameters.

### How does the scaling parameter affect the final quad mesh?

The scaling parameter controls the resolution of the integer grid used in the `quad_cover` algorithm during parameterization. Larger scaling values produce coarser integer grids, resulting in fewer, larger quads. Smaller values create finer grids, generating more numerous, smaller quads in the final remeshed output.

### Where is the scaling parameter stored in the AutoRemesher codebase?

The scaling parameter is stored as `m_scaling` in the `AutoRemesher` class (defined in [`autoremesher.h`](https://github.com/huxingyi/autoremesher/blob/main/autoremesher.h) around line 126). It is copied into each island's context structure at `autoremesher.cpp:86-89`, then passed to the `Parameterizer` instance via `setScaling()` at line 108 before being used in `parameterizer.cpp:44`.