游戏研发二三事 |LOD: 细节层面优化 with Autodesk Maya

Have you ever heard of LOD/s? Either with or without the “s”?  If not, read on then!

The idea of “Level of Detail”, or LOD for short, is an important topic in computer graphics as it is one of the key optimization strategy that would help your 3D graphical program, such as video game to run faster and reliably rendered across all the new and old hardware (think of the framerate in graphic rendering pipeline).

Although we will be only discussing the concept of LOD within the context of 3D games, I would like to acknowledge that the techniques of LOD that we have benefited here were the hard works of many professional real-time developers and computing scientists who were then researching about scientific visualization, and other general real-time simulation back in the old days.  In my own words, the methods of LOD were actually a resource allotment design that set to not overloading the CPU & GPU of a device, by rendering only what required to be seen in less time, while retaining the highest possible visual resolution.

The approach of LOD is similar to the philosophy of zero-wastage.  For instance, it is inefficient and simply not sustainable to peak your CPU with unnecessary draw calls for keeping tab on the 58081 vertices of a polygonal terrain, while we can represent it with mere 961 vertices within a relative viewing distance, as demonstrated below.

Level of Detail LOD Comparison between 3D polygonal terrain at a relative viewing distance

In 3D games, the process of LOD is often involved in decreasing the individual complexities of a 3D game asset, as it begins to distance or move away from the viewer (or the player’s point of view). The referred 3D game object can be an animate or in-animate object, such as the non-playable character (NPC), car, static crate boxes and other level items that are perceivable in visual means.  Besides the used of viewing distance between the player and the object as the decisive factor, the operation of LOD can also be set under the conditions of object importance, and the unit of speed that is viewpoint-relative.

Just think of a fast moving car: there is no point to render all the micro-polygonal-detailing of a fast moving object to the viewer in real-time when our visual system can’t even process it! Therefore, in 3D game development, you ought to build along the gameplay limits of a design, which I had postulated in Principles of 3D Modelling for Games. Although having said so, there will be always some exception, if the renders were meant for linear-playback (like movie) and the audience always gets to pause it for a glimpse!

Motion trails of cars and freeze render frame in Frozen Scene where Anna punches Hans

In game production, the process of LOD is also known by the jargon as “lodding”, and there were five (5) different lodding techniques to date, as shown in the following figure:

Overview of all LOD Techniques

Personally, among all these lodding techniques, I have found that effect of the Continuous Method (CLOD) & the Hierachical Method (HLOD) can be operative seen in most of the real-time 3D applications.  For instance, the method of CLOD can consist of a geomipmapping algorithm or GPU-based geometry clipmaps implementation that set to procedurally optimize and render a terrain fast!

Theory & Explanation of Continuos Level of Detail CLOD

Beside for the purpose of terrain optimization, CLOD can also be repurposed as a game mechanic for the gamers to interactively shaping their own gameplay experience and strategy.  Speaking of that, have you ever heard of the game titled – From Dust, which designed by Eric Chahi (one of the great game designers)?  If not, go to download the Google-Chrome demo version of the game, and immerse yourself about the effect of dynamic tessellation. (Note: don’t play too long, ya! Remember your goal is to study and make games, and not being played by games!)

Video Game From Dust in Google Chrome Store

 

Also, the method of CLOD is not just limited to creative entertainment purposes.  In fact, you can find a similar reversed implementation of the method in a free digital sculpting tool – the Pixologic’s Sculptris!  Unlike any other sculpting tools, Sculptris will automatically tessellate or subdivide the faces of a mesh that you are working on dynamically, as demonstrated in the following video. This will help to conserve the computing resource and eliminate waste, for we do not need to keep smoothing (or subdividing) all parts of the base mesh.  A well-optimized 3D graphic application should be able to let us selectively subdividing areas that required high density resolution.

Although the method of CLOD is really impressive, it is not easy to be implemented.  Therefore, for a simpler creative application like video games, we would prefer the Hierarchical Method, or the HLOD approach which is widely supported by the game engine.

Theory & Explanation of Hierarchical Level of Detail HLOD

As illustrated in the above figure, the method of HLOD basically functions by linearly swapping between a set of 3 to 4 pre-optimized versions of the original game model (the master). Each of these pre-optimized game meshes has a decremented count of polygons like 25%-lesser or total 50%-less than the original master model (see the following figure).

All these optimized in-game meshes will then be grouped with the master model, aka the LOD_0 (zero), and together it will be preloaded into the game engine. By obeying to an array of distancing threshold that defined by you, the renderer will automatically swapping the master model with its other lower-end representation.  Such swapping process can sometime be coded as the on/off switching of visibility.

In production, these optimized game meshes were usually prepared by the graphic artists manually, due to several technical constraints & reasoning.  To effective perform the task of lodding within the given deadline, we should work with the edit-edge-mode and reduce the polygon count by alternate loop of edges.  Should you always model your game mesh in quads with even spacing, then you will be laughing your way to construct the best looking X1 model without much visual degrading!  The process of lodding is an art itself, for it required a lot of planning and the plan had to be carried out way before you build your master model and its UV layout.  Perhaps, I shall discuss more about it in a separate article.

Example of Optimised game models with different level of detail and polygon count

Previewing Hierarchical LOD in Autodesk Maya

To summarize from what I have addressed so far, let’s look at the following 3-minutes tutorial podcast which I have prepared for you.  By going through the following demonstration, you will have a better overview about the concept of LOD, and how you can make it works within a 3D environment.

Closing

I hope this article had helped you to gain more insights about the tricks in making a game asset that tick.  So far, the approach of “lodding a master model” that I have briefly discussed in our lesson was more of a manual-labor-centric.

In Autodesk Maya, there is this improved Reduce function that can be found in the Mesh menu; through the use of the Reduce function, you can specify the desirable polygon count for each of your LOD models easily without the need to manually optimize it.  Such Reduce function is actually quite handy for students who were running out of time to hand in their work.  Although the Reduce function was long available in decade, but none of the professional artisans from the old days which I had personally know of would use it.  This is because the Reduce function would somehow screw up the face-normal and the topological flow of the mesh.

Although having said so, there is very promising automated Swedish solution for doing LOD in these days.  Have you ever heard of Simplygon: the Automagic 3D Optimization? If not, do check out the following Youtube video later.

Lastly, the LOD techniques that we had discussed here would work very well especially for games, as the process involved simplifying small quantity of individual game assets.  But, it would not work for large quantity of vegetation, or VFX assets for feature-film.  You will need to use a different kind of LOD technique called Stochastic Pruning that developed by the Pixar Animation Studios (Cook & Halstead, 2012).  You can read more about it here.

#End