# simplify_3d_model

Check discovery first: this tool is available only on deployments that enable it.
Use it to reduce a model's triangle count while keeping its textures: materials and
images pass through unchanged and UVs, normals and vertex colours are carried through
the edge collapses, so the original textures stay aligned. Supports GLB, glTF, OBJ,
PLY, STL and OFF. Geometry is never smoothed or re-textured.

Give `upload_id` or a public HTTPS `url` (with `filename` if needed; `job_file` is not
accepted, so download an earlier job's output and upload it), plus `wait_seconds`
(default 20, at most 45). Options:

- `target_faces` (100–10,000,000) or `ratio` (0.01–0.95, default 0.25), not both.
- `max_error` (0.0005–0.5): optional quality guard, the largest deviation allowed as a
  fraction of the model's extent. Without it, topology and texture seams can still stop the collapse; read the achieved count and error.
- `aggressive` (default false): force the target when texture seams or topology stop
  the collapse. On atlas-textured generated models the seam-preserving collapse stops
  before the target; forcing lower counts can visibly damage the textures. Use it only
  when the count matters more than looks. Use `optimize_3d_model` when new textures are needed.
- `lock_borders` (default true), `remove_debris` (default false; drops disconnected
  pieces under 1 % of the surface before simplifying), `web_copy` (default false;
  adds `model.web.glb` with Draco geometry and WebP textures, single textured meshes).

Read `simplify.json` with `read_job_file`: per mesh, faces and vertices before and
after, the target, the error (relative to the extent and in model units; it is
a combined geometric-plus-attribute measure, not a pure surface
distance), the attributes used and the passes run (`collapse`, then `permissive` and
`sloppy` when aggressive). `result.notes` says when the target was not reached and
why. Download `model.glb` (and `model.web.glb`) from `result.files`.

Price is by input triangles (see discovery). Runtime depends on the model and options.

Free limits: 500 jobs per rolling 24 hours (50 until the account's first credit
purchase), 1,000,000 faces, existing account upload
and concurrency limits.

Without MCP:

```bash
python scripts/mcpbytes.py run simplify_3d_model model.glb --out simplified/ --option target_faces=250000 --option web_copy=true
python scripts/mcpbytes.py read j_... simplify.json
```

Handle `invalid_mesh`, `unsupported_feature` (skinned, animated, morph-target,
compressed or quantized meshes), `invalid_options`, `limit_exceeded` and `timeout`
using the returned hint. Do not repeat a failed input unchanged.
