Expand description
Mesh and asset optimization for low-budget targets (Raspberry Pi, sprites).
cluster_collapse: polygon reduction by vertex clustering (snap to a grid, merge, drop degenerate/duplicate triangles). Robust on any mesh; stylized results, no topology bookkeeping needed.decimate_to_ratio: pick the cluster cell automatically to hit a target fraction of the original triangles.merge_materials: merge near-identical materials so a scene shares fewer PBR states (WorldBuilder has no bitmap textures, so this is the equivalent of “texture reduction”; UV channels can be dropped entirely withremove_uvs).
Functions§
- cluster_
collapse - Snap all vertices onto a grid of
cellmeters, merge each cluster to its centroid and rebuild the triangle list. Degenerate (collapsed) and duplicate triangles are dropped; UVs are averaged per cluster; skin data is removed (callers should refuse skinned meshes explicitly). - decimate_
mesh - Decimate one mesh asset. Terrain grids are resampled (clean lattice); everything else goes through clustering. Skinned meshes are refused: vertex weights would point at merged vertices. Returns (before, after).
- decimate_
node - Decimate the mesh instance under
node. Seedecimate_mesh. - decimate_
to_ ratio - Cluster with a cell size chosen so the result is close to
ratioof the original triangle count (bisection search). Returns (before, after). - merge_
materials - remove_
uvs - Drop the UV channel (unused without bitmap textures; saves memory). Returns whether anything was removed.
- remove_
uvs_ mesh - Remove the UV channel of one mesh asset; true when it had one.