Level of Detail objects are used to improve the rendering performance of objects located far away from the camera picture plane.
|Table of Contents|
- The Base mesh (LOD 0) has no prefix/suffix. Every successive LOD should be a separate object that is linked/parented to the base mesh and named $lod1, $lod2, etc.
- For clarity, you can also add more information the name of the LOD node, i.e. _lod1_sphere or _lod2_justforfun. The engine only takes the first 5 characters into account.
- Reduce the amount of material IDs as much as possible, as this will decrease the amount of drawcalls your LOD produces. Ideally, the last LOD should only have one render material ID assigned. The r_Stats 6 CVar will allow you to view how many Drawcalls your objects are producing.
- Each successive LOD step should save 50% of triangles. (i.e. 1200 -> 600 -> 300 triangles) or have the amount of rendering materials reduced. A warning message will be displayed during export if the triangle reduction is above 66%.
- Currently up to 6 LOD's are supported. This number is hard-coded and may change in the future. The e_LodMin/Max CVars will allow control over which LODs are used on a global scale.
- Objects can have LOD's for every sub node. LOD's must be linked/parented to the nodes they should substitute during rendering.
3DS Max Specific Setup
- Create reduced versions of the object with the exact same pivot position and translation/scale values.
- Name them $lod1, $lod2, $lod3 in 3ds Max.
- Link/parent each LOD to the parent render mesh.
- Export the base mesh with the CRYENGINE Exporter. The exporter will recognize the linked LOD's and will include them in the .cgf.
Example for linked LOD's:
Additionally, you can make the LOD names more specific by adding a space/underscore and a descriptive name after the "$lod1"; i.e. "$lod1 box", "lod2 box".
Naming them specifically can help locating problematic assets which may be highlighted by the Resource Compiler during the build process. So long as the node begins with $lod<number>, the rest of the name shouldn't matter.
In the Schematic View mode of 3ds Max it will look like:
LOD's can also be created for and linked to sub-objects of complex assets, i.e. breakable objects, cars, tanks.
The engine will automatically detect the correct LOD step for the sub-objects based on distance/size/triangle count of the object.
Example of LOD's for sub-objects:
When linked correctly, the LOD's do not need to be added to the list window of the exporter.
"Merge all Nodes" needs to be unchecked in the exporter settings.
|When you export your .cgf from Max, the LOD's are embedded inside the .cgf. The engine is able to then pull these LOD's from the one .cgf at run time, but for a final released build, the Resource Compiler should be setup to extract the LODs from the base .cgf (with the /splitlods command) and create separate LOD .cgf's from them. If you look inside the shipped GameSDK .pak files, you'll see _lod1.cgf, _lod2.cgf assets alongside their parent .cgf.|
Old LOD Setup in 3D Packages
Kept for backwards compatibility - You can also create a separate .cgf object with the same object name plus the post fix _lod1, _lod2, etc.
The engine will automatically use these external LOD's. But this method is not recommended and might be removed in future releases.
Maya Specific Setup
1. Create a group called 'cryexportnode_@' replacing the '@' with the filename to export to.
2. Group the highest detail mesh (lod0) under a new group named '#_group' replacing the '#' with the name of the model you are exporting.
3. Group the '#_group' for LOD0 under the 'cryexportnode'.
4. For each additional LOD level create a group using the naming convention in step 5.
5. Make sure the LODs are using the following naming convention 'lod#@_group' replacing the '@' with the mesh name of your choice, replace the # with the lod ID. Ensure the same for all the LOD levels eg _lod1_mayalod_group, _lod2_mayalod_group.
6. Group the geometry for each LOD under the nodes we created in step 4.
7. Select the 'cryexportnode' group.
8. Click the export button on the 'Crytek' toolbar to open the 'Crytek Export' dialog.
9. Click the 'Add Attributes' button.
10. Ensure that 'Do Not Merge Nodes' is ticked.
11. Click the 'Export' button on the 'Crytek Export' dialog.
An example Maya scene for setting up LODing geometry can be downloaded here.
XSI Specific Setup
You can make use of the Level of detail functionality of CryENGINE by linking the LOD's to the Base object.
The rule of thumb is to reduce the poly count for every LOD step by 50%. If you only remove 20% of the polygons, the LOD will not load for being insufficient. There is a exception, though. If you use less different materials than on the previous LOD level, the LOD will still work, even if there are not 50% of the polygons saved.
Add an UNDERSCORE to the node name and number them accordingly:
_lod1, _lod2, ...
Example object with 2 additional LOD's:
Setup in Sandbox
There is no special setup needed. The engine will automatically detect LOD's and use them if available.
There are various console commands which help debugging LOD's in Sandbox of in game mode.