Generating Level Of Details
From C4 Engine Wiki
C4 features a level of detail system which involves decreasing the complexity of a 3D object as it moves away from the viewer. Level of detail increases the efficiency of rendering by decreasing the workload on the graphics pipeline. The reduced visual quality of the model is often unnoticed because of the small effect on object appearance when distant.
Primitive geometries that are created within the C4 world editor feature automatic level of detail. You can control this by selecting the geometry and hitting Ctrl-I (Cmd-I on the Mac) to access the node info screen.
C4 supports four individual level of details.
- LOD0 - The highest detailed mesh
- LOD1
- LOD2
- LOD3 - The lowest detailed mesh
You may specify that the engine use a specific level of detail for the collision volume. For example, you could use the highest level of detail (the lowest detailed mesh) to perform collision detection. This would result in a slight performance increase as collision calculation is less complicated due to the lower resolution mesh being used. If no collision detail level is specified the engine will use the lowest level of detail (the highest detailed mesh) to perform collision detection.
These settings can be found within the node info screen of the geometry, under the collision tab.
You can create a level of detail set with the C4 world editor by selecting between two to four geometries and using the Combine Detail Levels command from the Geometry menu.
Once combined you may use the Separate Detail Levels command to separate the geometries if need be.
The world editor or model viewer can be used as a diagnostic tool if you wish to easily see the level of detail transitions take place. In the world editor you need to toggle lighting to enabled, then use the perspective viewport and start zooming in and out. You should notice the mesh switching between detail levels in the orthographic viewports.
An easier way to diagnose detail levels is to use the model viewer. Simply export your mesh to a model by using the Export Model command from the World menu. Now open the model with the Open Model command from the Tools menu and use the Detail level bias slider to switch between the various level of details.
Geometries that are imported into the engine from an external modeling tool may also feature level of detail. This includes skinned, animated meshes such as player objects.
The remainder of this article will detail the process of creating level of details for a skinned, animated player object from within 3ds Max.
Contents |
Step 1 — Duplicating our model
This tutorial assumes that you have already created your highest detailed mesh and that it is skinned and animated.
The first thing we need to do is duplicate our highest detail mesh so that we may create our level of details. We will repeat this process three times so that we end up with four meshes which will correspond to our four level of details.
I recommend that you name your mesh in a logical fashion, ending with the suffix "_LOD00". Once named use the Snapshot command from the Tools menu to create a duplicate.
Use the settings shown in the image above. You will now have a duplicate of your mesh. It will be named identically however the LOD00 number at the end should have incremented by one. This naming convention will make it easy for us to determine which mesh corresponds to which level of detail. Repeat this procedure two more times so that you end up with a total of four meshes in the scene.
Step 2 — Applying the MultiRes modifier
3ds Max features a MultiRes modifier that can be used to create lower detailed meshes from a base high detailed mesh. There are other methods one can use to achieve the same purpose, such as using the Optimize modifier or by reducing the polys and verts by hand. I chose the MultiRes method for this tutorial as it is the quickest and easiest to use.
Select the first copy of your mesh whose name should end in LOD01. Now select the Modify tab from the right hand menu pane. From the Modifiers List drop box select the MultiRes modifier.
Click the Generate button. Now use the Vert Percent field to reduce the overall poly and vert count. The values you use are up to you and will vary pending on the model. For my model I entered 75% for LOD01, 50% for LOD02 and 25% for LOD03.
Repeat this procedure for the remaining meshes. You will end up with four meshes, one high detailed mesh and three others with lowering poly and vert counts.
Step 3 — Applying the Skin Wrap modifier
Because we used the Snapshot command earlier to duplicate our mesh we need to reapply the skinning to each duplicate. This can be done easily by using the Skin Wrap modifier.
Select the first copy of your mesh whose name should end in LOD01. Now select the Modify tab from the right hand menu pane. From the Modifiers List drop box select the Skin Wrap modifier.
From the Skin Wrap dialog click the Add button. Now press H to raise the Pick Object screen and select your highest detailed mesh which already has a Skin modifier applied, now click the Pick button. A new button will appear in the Skin Wrap dialog named Convert To Skin, click this button. We need to do this as C4 does not support the Skin Wrap modifier however it does support the Skin modifier.
Repeat this procedure for the remaining meshes.
Step 4 — Exporting and configuring the level of details inside of C4
Make sure you have the latest version of the Collada Max plugin installed. Before exporting ensure that all objects in your scene are unhidden.
Once exported import the Collada file into C4 by using the Import Scene command from the World menu. Once you have imported the scene switch one of the viewports to the scene graph view.
Select all the meshes in the scene and use the Combine Detail Levels command from the Geometry menu. You should end up with something that looks like this.
That's it. You have created your level of detail set and are ready to export to a model. You should save the world file in case you need to make adjustments later down the track.
Step 5 — Final notes
- When creating levels of detail for skinned meshes each mesh needs to contain a skeleton and skinning data. The skeleton and skinning data needs to be identical for each mesh.
- There is no need to create levels of detail for all your animation files. Simply create your levels of detail for the main root mesh. Animation files do not need to contain any level of detail information and can be exported as per normal.









