Papervision 3D Programming Tutorial – Simple LOD

Google+ Pinterest LinkedIn Tumblr +

VIEW THE DEMO
DOWNLOAD THE CODE

In 3D applications Level of Detail, or LOD for short, refers to a process that alters the polygon density of a mesh, generally reducing the polygon count the further a mesh is away from the camera. The idea is that only those objects close to the camera need to be rendered with full detail, and that reducing the polygon count for smaller, more distant objects increases performance without sacrificing too much in the way of visual appeal.

There are a number of ways this can be done. Quite often in commercial (and typically C++) 3D engines the LOD of mesh can be reduced on the fly. Papervision supports a less complicated system of displaying a predetermined mesh given the objects distance from the camera. It doesn’t quite have the same flexibility of a dynamic LOD system, but at the end of the day produces the same effect.

The SimpleLevelOfDetail class is used to display from a supplied array of meshes, swapping between them in a linear fashion depending on how far away the object is from the camera. You simply supply the SimpleLevelOfDetail constructor with the array of meshes, and give it a minimum and maximum distance. When the object is closer than the minimum distance it displays the first mesh in the array, and when it is further than the maximum distance it displays the last mesh. For distances in between it will pick one of the meshes in the middle of the array.

The sample application creates five spheres which bounce around inside an invisible box. Each sphere has four meshes associated with it, representing four levels of detail. As the spheres move closer to the camera you will notice that they use a more detailed mesh, and progressively switch to a lower detail mesh as they move away. The meshes themselves are textures with a wireframe material so you can easily see the polygon density of each model.

Go back to Papervision Tutorials

papervision24.jpg

Share.

About Author

Leave A Reply