Level of Detail – Interactive 3D Graphics
This lesson doesn’t quite fit in with this unit, but the topic is important enough that I’ll cover it here. As we move the camera or objects through a scene, models become larger and smaller. For very large scenes with many objects, rendering everything in the scene at full detail can make us lose any shred of interactivity. We’ve seen how there are limits to how large a texture needs to be, in fact it’s usually best if the texel to pixel ratio stays at about one to one. More than that and the texture can just become a source of noise. Choosing the proper data representation is part of a much wider topic called level of detail. In this area of computer graphics, the focus is on how to change an object’s representation as its size on the screen changes. Methods must balance tradeoffs between performance and quality. The two major areas where level of detail techniques come into play are with meshes and textures. Textures can be down sampled to create mid maps so that proper texture level can be used for a scene. As a textured object gets farther away a smaller texture on the mid map is needed. There also limits for how much memory a GPU has available for texture storage. For very large data sets such as a city or world map, it’s impossible to save all the high resolution textures in memory at the same time. Since we know that when an object is small on the screen, it will need only a lower resolution texture. We can design our system to load only the low resolution textures out of the mip chain. As we zoom in on a particular object We can load the higher and higher resolution textures. At the same time, we can be deleting the higher resolution textures for objects that are now receding from view, or have been clipped off the screen entirely. As an object gets smaller on the screen, we can also consider simplifying the illumination equation. In other words using shaders with fewer instructions. For example, if we get far away enough from an object, its displacement map may add very little detail. Displacement maps help in particular by giving a more realistic silhouette to an object. At a distance, these fine details are less important. As an object gets smaller, switching from a displacement map to a normal map then to no bump map at all saves considerable amounts of memory. Mesh geometry itself can be thought of in the same terms. As a mesh gets smaller on the screen, fewer vertices are needed to represent its details. For objects that are tessellated into triangles, this means a smaller tessellation factor can be given. For more complex objects that do not have a simple tessellation factor, simplified meshes have to be either created by hand, or by what’s called the decimation algorithm. Such algorithms try to find the least important triangles and patch up their areas with fewer triangles. Here’s an example by Paolo Cignoni using mesh lab, a powerful and free mesh manipulator. This automatic techniques are effective but can run into problems with objects such as faces, where the lips and eyes should be subject to less simplification because of their importance. In mipmapping we interpolate between two textures in the mip pyramid. With level of detail techniques for geometry, we can do the same with what are called geomorphs. This technique can provide a smoother transition between levels of detail, but at the cost of additional processing and memory, which is in opposition to much of the point of using of level of detail techniques in the first place. It’s much more common to simply replace a model with its simplified version when it becomes smaller on the screen. You sometimes see a pop if the two versions of the model differ considerably. 3JS supports this form of level of detail. In this demo, you can see different versions of the sphere model being used depending on the distance from the viewer. These were explicitly chosen by the programmer. If you look closely, you’ll see four different levels of detail.