Metadata-Version: 2.4
Name: anvil-reduce
Version: 0.2.3
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Rust
Classifier: Topic :: Multimedia :: Graphics :: 3D Modeling
Classifier: Topic :: Software Development :: Libraries
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Requires-Dist: numpy>=1.21
License-File: LICENSE
Summary: Volume-based mesh proxy generator. Voxelize, marching-cubes, smooth, remesh. Fast, watertight, hands-off.
Keywords: mesh,geometry,decimation,proxy,lod,vfx,dcc,voxel,marching-cubes
Author-email: Alejandro Cabrera <voidreamer@gmail.com>
License-Expression: MIT
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Homepage, https://github.com/voidreamer/anvil-reduce
Project-URL: Issues, https://github.com/voidreamer/anvil-reduce/issues
Project-URL: Repository, https://github.com/voidreamer/anvil-reduce

# anvil-reduce

Watertight mesh proxy generator: exact narrow-band distance field,
marching cubes, smooth, remesh, exact surface projection. Fast,
verifiable, hands-off. Native Rust core, Python bindings via PyO3.

## Install

```bash
pip install anvil-reduce
```

Inside DCCs:

```bash
mayapy -m pip install anvil-reduce          # Maya
hython -m pip install anvil-reduce          # Houdini
# Blender: install into the addon's bundled Python or vendor the wheel
```

## Quick start

One-shot file pipeline (the path most pipeline TDs want):

```python
from anvil_reduce import proxy_from_path

result = proxy_from_path(
    "hero.usd",
    "hero_proxy.usd",            # .usd/.usdc = binary, .usda = ASCII
    quality="balanced",          # "fast" | "balanced" | "high"
    transfer_normals=True,
)
print(f"{result['input_faces']} -> {result['output_faces']} in "
      f"{result['wall_seconds']:.2f}s")
```

NumPy-driven workflow:

```python
import numpy as np
from anvil_reduce import Mesh, generate_proxy

mesh = Mesh.from_numpy(positions, indices)   # (N,3) f64, (M,3) u32
proxy = generate_proxy(mesh, quality="balanced", target_faces=20_000)
positions, indices = proxy.positions(), proxy.indices()
```

## Functions

| Function | What it does |
|---|---|
| `proxy_from_path(in, out, **kw)` | File-to-file pipeline, returns a stats dict |
| `generate_proxy(mesh, **kw)` | Proxy for an in-memory `Mesh` |
| `generate_lod_chain(mesh, levels=4, **kw)` | List of meshes: the original, then each level at half resolution |
| `load(path)` / `save(mesh, path)` | Mesh I/O: `.obj`, `.glb`, `.gltf`, `.usd`, `.usda`, `.usdc` |
| `Mesh.from_numpy(positions, indices)` | Build a mesh from numpy arrays |

USD output is a `Mesh` prim with `purpose = "proxy"` and an authored
extent, so usdview and DCCs bind it as proxy geometry directly. USD input
is sniffed: crate (binary) and ASCII layers both load. No composition —
flatten referenced assets with `usdcat --flatten` first.

## Quality presets

| Preset    | voxel_res | smooth | remesh |
|-----------|-----------|--------|--------|
| fast      | 64        | 3      | 0      |
| balanced  | 128       | 5      | 3      |
| high      | 256       | 5      | 5      |

Override individual knobs by passing them explicitly. `target_faces`
hits an output face budget (resolution and remesh edge length are
derived from it). `offset` is the standoff from the input surface in
voxel cells (0 = surface-exact, default 0.1, larger = looser hull);
`close` seals gaps in open meshes; `project` caps the final exact
projection onto the offset surface.

The output is closed, outward-wound, and free of degenerate triangles;
verify with the CLI's `check` command.

See <https://github.com/voidreamer/anvil-reduce> for the full project.

