https://sourceforge.net/tracker/?func=d ... tid=540678
This patch adds a new algorithm for mesh optimization. It's tuned for heightmaps, tiles in particular.
How it differs from the usual ones (such as the many ones in the irrExt repo):
- it is intended to be lossless
- it takes extra care around the mesh borders
These qualities let it be run on just about any static mesh. The main use for me is heightmap mesh tiles - if there are planar areas, this saves triangles and verts. The other common use is bad 3d art; you know what I'm talking about, a straight wall that has 60 tris when it should have 2.
The latter use case is somewhat hampered by the border code, but of course one should be teaching the artists, not post-processing their work
Heightmap tile before - after:
Note how the borders don't change. It still tiles seamlessly without T-junctions.
Example when run on a mesh, too tesselated cube:
In this case, you can see how it's lossless, but not as good as it could be. There are two parts to this, the mentioned border limit, and the fact the algorithm is pass-based - it does not run until stabilization. If you need the finest models, you should run it 4-5 times.
For Minecraft-style worlds, having the cube like above, avoiding T-junctions, would still be desirable of course.
PS: I do think the irrext simplification methods should be merged. They're self-sufficient and useful for lossy LOD.
Heightmap mesh optimization
Re: Heightmap mesh optimization
It runs in linear time (O(n) on vertex count), and can handle very complex meshes.
The example cube stabilizes after 2 passes:
Before: 96 verts 324 ind
p1: 74 verts 192 ind
p2: 72 verts 180 ind
p3: 72 verts 180 ind
It successfully cut 45% of the indices and 25% of the vertices in this model. The time to do the first pass wass 370 usec.
It should be noted that my weld cleanup patch is required to see the full potential - without it, irrlicht's welding does not remove degenerate tris, so the speedup is not as good as with it. The HW can drop degenerate tris early, but the best case is to not send them.
The example cube stabilizes after 2 passes:
Before: 96 verts 324 ind
p1: 74 verts 192 ind
p2: 72 verts 180 ind
p3: 72 verts 180 ind
It successfully cut 45% of the indices and 25% of the vertices in this model. The time to do the first pass wass 370 usec.
It should be noted that my weld cleanup patch is required to see the full potential - without it, irrlicht's welding does not remove degenerate tris, so the speedup is not as good as with it. The HW can drop degenerate tris early, but the best case is to not send them.