Hello,
Already shared a screenshot of this project in Screenshot of the Month, and here it is!
With this class you can simplify existing meshes by contracting / collapsing edges.
This is very usefull for creating LOD meshes on the fly, instead of creating all meshes in your 3D editor.
Already using this in TANK@WAR 1.2 to create less detailed models of the tanks for the LOD system.
Features
- Contract / Collapse edges
- Texture support
- Bump/normal support
- Algorithms:
* Random
* Shortest
* Melax
* Quadric
How to use
Code: Select all
// Get original mesh
scene::IMesh* mesh = smgr->getMesh("media/cow.b3d");
// Create ProgressiveMeshBuffer
ProgressiveMeshBuffer::SimplificationAlgorithm algorithm = scene::ProgressiveMeshBuffer::MELAX;
scene::ProgressiveMeshBuffer* pmb = new scene::ProgressiveMeshBuffer(mesh ->getMeshBuffer(0), algorithm);
// Contract / collapse 50 edges
pmb->contract(50);
// Get new mesh buffer
scene::IMeshBuffer* mb = pmb->getCurrentMeshBuffer();
Download (Demo + Source)
Download
IrrExt mirror
TODO
- Optimize
I hope people want to optimize this further (and share it ofcourse) because I don't have the time anymore
Because it's still quite slow for big meshes. (See bunny model in demo)
NOTE: models are not mine, and can't remember where I got them from tho