OpenGL LOD Demo by Stefan Krause
New: The demo now handles bump mapping for two diffuse light sources. The effect enhances the visual appearence greatly. The impact on performance is quite low on a GeForce, since only a single rendering pass is needed for the effect.
New: Two nasty bugs have been resolved.
The first can be seen at the left arrow in the left picture. The normal generation algorithm did not calculate the correct normals along the seam of objects. Background: 3ds files contain two vertices e.g. for each vertex on the seam of a cylinder, since such a vertex has two different texture coordinates assigned. These vertices were not regarded to be connected. Finally the result was that e.g textured cylinders had one sharp edge.
The other bug can be seen at the right arrow. During edge collapse textures could be flipped for some triangles. Once again this happened on objects with vertices with multiple texture coordinates.
As you can see on the right debugging was successful.
The algorithm in action. Triangle count was reduced in steps from 100% to 18%. You'll find it hard to discover differences between the full geometry object and the one with half the triangles from a distance. However, if you zoom closer to the object, you can see clearly where triangle decimation has happened.
The simplification algorithm is based on a demo by Stan Melax, which is available on http://www.melax.com/polychop/. It was modified to be able to handle multiple normals per vertex (for smooth groups), textures and bump maps. A lot of optimizations were built in to achieve a better performace.
The simplification algorithm calculates a number of index lists (i.e. multi resolution meshes [MRM]) which specify the vertices to be drawn. These vertices are shared between all levels of detail, such that the additional cost of memory is restricted to the index lists. Therefore there is no (negative) performance impact for displaying.
Furthermore the algorithm used to calculate the cost of collapsing two vertices
has been modified and now works like Michael Garland's algorithm using quadric
error measure. You can find his excellent paper at http://graphics.cs.uiuc.edu/~garland/research/quadrics.html.
The 3D Studio loader is based on lib3ds-0.1.1 available on SourceForge http://lib3ds.sourceforge.net. There has been a major update for lib3ds in the meantime, but since the older version does a good job, I kept it.
This demo is released under the GNU Lesser General Public License.
Version 2: [Source & win32 executables, ~1,4 MB]
Version 1: [Source & win32 executables, ~1,4 MB]
To run the demo, please unzip the files in some folder preserving the directory structure in the zip file.
If you like the demo, please let me know. If you don't, let me know as well.
Please send me your feedback.
www.opengl.org - Home of OpenGL
Demos & Docs:
www.klaudius.free.fr - Some very nice demos including a LOD demo
romka.demonews.com - Lots of nice demos
Graphic card news: