作者实测了开源工具在保留2%三角面并烘焙法线贴图后的效果,提供了可复用的低模优化工作流。
An AI 3D tool says 1/50 of the triangles still looks like the original. I tested that ratio with open-source tools: quadric decimation plus a baked normal map.
Watch the three panels 👇
▸ The test
A stone relief I generate in code: a cat, scrolls, beads and about 900 carved fur grooves. 0.8 m wide, 999,698 triangles.
Left: the original. Middle: cut to 19,992 triangles (2%, exactly 1/50). Right: the same 19,992 triangles plus a normal map baked from the original. One moving light for all three.
▸ Step 1: cutting 98% of the triangles
meshoptimizer's simplifier (Arseny Kapoulkine). It collapses edges one at a time and always picks the cheapest one.
"Cheap" is measured with quadric error (Garland and Heckbert): every vertex keeps a small matrix that sums the planes of the triangles around it. The cost of moving a vertex is the squared distance to those planes. Flat areas cost almost nothing, so they go first. Ridges and creases cost a lot, so they stay.
I also passed the normals as attributes, so shading changes count as error too, and locked the border so the tablet edge stays straight.
Result: 19,992 triangles, largest shape error about 3 mm on a 0.8 m slab. 1.1 s.
▸ Step 2: baking a normal map
For every texel of the low mesh (2048 x 2048), cast a ray back along its normal, 3 cm above to 3 cm below. Where it lands on the original, read the original's normal and store it relative to the low mesh's own surface (tangent space).
4,199,598 rays, every one of them hit, 6.2 s on one CPU thread in Node.js. three-mesh-bvh makes each ray cheap.
The relief is almost flat, so the UVs are just a straight top-down projection. A real model needs proper UV unwrapping first.
▸ What comes back, what doesn't
Comes back: fur grooves, eye rims, the carved lines. They're mostly a change in surface angle, and that's exactly what a normal map stores.
Doesn't come back: the outline. In the grazing shot at the end, the original's edge is bumpy, both 2% versions are smooth. A normal map changes the lighting, not the shape, so silhouettes and self-shadows stay at 20k-triangle quality.
Without the map, 2% looks like melted soap up close.
▸ What I didn't test
The AI tool runs its own generation and retopology, and I don't know its details. This is only the same 1/50 ratio done the classic way, so I'm not judging its result.
Video rendered on CPU, so no frame times.
▸ When to use it
Props and scans seen mostly face-on: carvings, walls, rocks, game-ready versions of sculpts. Keep more triangles where the outline matters, like character silhouettes and anything seen edge-on.
#gamedev #threejs
来源:Vidar · x.com