User Tools

Site Tools


gamedev:lod

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
gamedev:lod [2012/12/03 14:35] – created dragonlordgamedev:lod [2019/05/24 23:43] (current) – ↷ Links adapted because of a move operation dragonlord
Line 1: Line 1:
 +{{tag>graphic lod optimization blender export}}
 <WRAP youarehere> <WRAP youarehere>
-[[:start|Start Page]] >> [[gamedev:main|Game Development with the Drag[en]gine]] >> **LOD System**+[[:start|Start Page]] >> [[:gamedev|Game Development with the Drag[en]gine]] >> **LOD System**
 </WRAP> </WRAP>
  
Line 9: Line 10:
  
 LOD versions of models are directly stored in the model itself and thus directly stored in the model files themselves. This has been chosen to keep files organized. LOD meshes and their base mesh are so closely linked separating them produces a lot of extra synchronization and management code that just doesn't justify splitting them apart. Storing the LOD meshes alongside the base mesh in the model allows all meshes to use the same bones and textures. **Animatable objects** can thus be lodded the exact same way as any other model. The number of LOD meshes in a model is **not limited**. You can use as many as you see fit to reduce the polygon count gradually to the utmost minimum. You are also not forced to just remove individual vertices only from the base mesh to the LOD mesh as some game engines require. The LOD meshes are **totally free concerning the number and placement of vertices and faces** connecting them. compared to each other. It is only important to keep the **surface points close to each other** since the proposed LOD metric works best in this case. LOD versions of models are directly stored in the model itself and thus directly stored in the model files themselves. This has been chosen to keep files organized. LOD meshes and their base mesh are so closely linked separating them produces a lot of extra synchronization and management code that just doesn't justify splitting them apart. Storing the LOD meshes alongside the base mesh in the model allows all meshes to use the same bones and textures. **Animatable objects** can thus be lodded the exact same way as any other model. The number of LOD meshes in a model is **not limited**. You can use as many as you see fit to reduce the polygon count gradually to the utmost minimum. You are also not forced to just remove individual vertices only from the base mesh to the LOD mesh as some game engines require. The LOD meshes are **totally free concerning the number and placement of vertices and faces** connecting them. compared to each other. It is only important to keep the **surface points close to each other** since the proposed LOD metric works best in this case.
 +
 +<WRAP center round tip 80%>
 +LOD meshes work perfectly together with **[[gamedev:renderables|dynamic textures]]** and texture replacement techniques. Replacing textures is fully transparent towards LOD meshes and adding, removing or changing LOD meshes is fully transparent towards texture replacement techniques.
 +</WRAP>
  
 ====== LOD Metric ====== ====== LOD Metric ======
Line 20: Line 25:
  
 ====== Blender3D Export Scripts ====== ====== Blender3D Export Scripts ======
 +<WRAP box right :en 310px>
 +{{ :gamedev:blender3d:props_lodmesh.png |Blender Script Object Props LODMesh}}
 +<WRAP centeralign>Blender Script Object Props LODMesh</WRAP>
 +</WRAP>
 The Blender3D export scripts accompanying the game engine distribution allows to easily export LODed models. To build a chain of LOD meshes for a base mesh you create each mesh as an individual mesh. No need to use modifiers or other hacks. Once created you can link them together using the "**LODMesh**" parameter in the "**Drag[en]gine LOD**" panel under the object properties. For each mesh write there the object name of the next LOD mesh in the chain. For the last object leave this field empty to stop the chain. Hence to export a base model "**my model**" with the lod meshes "**my model lod 1**" and "**my model lod 2**" set the parameters as following: The Blender3D export scripts accompanying the game engine distribution allows to easily export LODed models. To build a chain of LOD meshes for a base mesh you create each mesh as an individual mesh. No need to use modifiers or other hacks. Once created you can link them together using the "**LODMesh**" parameter in the "**Drag[en]gine LOD**" panel under the object properties. For each mesh write there the object name of the next LOD mesh in the chain. For the last object leave this field empty to stop the chain. Hence to export a base model "**my model**" with the lod meshes "**my model lod 1**" and "**my model lod 2**" set the parameters as following:
 ^Object^LOD Level^Value of "//LODMesh//" Parameter^ ^Object^LOD Level^Value of "//LODMesh//" Parameter^
Line 26: Line 35:
 |my model lod 2|LOD 2|<empty>| |my model lod 2|LOD 2|<empty>|
 Avoid producing loops this way. You can make the chain as long as you want. Obviously if "**LODMesh**" is empty for the base mesh the model has no LOD meshes at all. The only restriction is that all meshes are required to have the exact same material slots. Hence the used materials have to be the same as well as their ordering. This limitation is due to the way the export scripts are written. Later versions of the scripts might remove this limitation. For the game though you are not required to use the materials at all. You can even have an additional material for your LOD version only not used in the base mesh. See the **[[gamedev:treecanopylod|Tree Canopy LOD]]** for an example of this technique. Once created you can export the model with all the LOD meshes included by just selecting the base mesh and exporting. The export scripts find the LOD objects through the "**LODMesh**" parameter following the chain. Avoid producing loops this way. You can make the chain as long as you want. Obviously if "**LODMesh**" is empty for the base mesh the model has no LOD meshes at all. The only restriction is that all meshes are required to have the exact same material slots. Hence the used materials have to be the same as well as their ordering. This limitation is due to the way the export scripts are written. Later versions of the scripts might remove this limitation. For the game though you are not required to use the materials at all. You can even have an additional material for your LOD version only not used in the base mesh. See the **[[gamedev:treecanopylod|Tree Canopy LOD]]** for an example of this technique. Once created you can export the model with all the LOD meshes included by just selecting the base mesh and exporting. The export scripts find the LOD objects through the "**LODMesh**" parameter following the chain.
 +<WRAP clear></WRAP>
  
 +<WRAP box right :en 310px>
 +{{ :gamedev:blender3d:tools_loderror.png |Blender Script LOD Error Tool}}
 +<WRAP centeralign>Blender Script LOD Error Tool</WRAP>
 +</WRAP>
 To help artists check the fitness of their LOD meshes the scripts include also a LOD metric calculation based on the LOD metric describe in this page. To use this tool select the base mesh and then the LOD mesh. You can select also two LOD meshes. The meshes are not requied to be linked yet or to be directly next to each other in the LOD chain. Press then the "**LOD Max Err**" or the "**+ Avg Err**" button. The maximum and average error is then displayed underneath in meters. A max error of 3-5mm is an optimal value. Smaller than this and the LOD mesh might be skipped often if it is not the last LOD mesh in the chain. A max error up to 0.5-1cm is a good value. With most meshes you will have a max error of 0.5-1cm. For higher LOD meshes the max error should be around 4-5x the max error of the base mesh to the previous LOD mesh. Hence if the max error from LOD-0 to LOD-1 is 4mm then a good max error from LOD-1 to LOD-2 is 1.6-2cm. Of course you can choose different scales if you like. These are values proving good LOD changing steps. The OpenGL Graphic Module allows to visualize LOD levels if you want to get a closer look. To help artists check the fitness of their LOD meshes the scripts include also a LOD metric calculation based on the LOD metric describe in this page. To use this tool select the base mesh and then the LOD mesh. You can select also two LOD meshes. The meshes are not requied to be linked yet or to be directly next to each other in the LOD chain. Press then the "**LOD Max Err**" or the "**+ Avg Err**" button. The maximum and average error is then displayed underneath in meters. A max error of 3-5mm is an optimal value. Smaller than this and the LOD mesh might be skipped often if it is not the last LOD mesh in the chain. A max error up to 0.5-1cm is a good value. With most meshes you will have a max error of 0.5-1cm. For higher LOD meshes the max error should be around 4-5x the max error of the base mesh to the previous LOD mesh. Hence if the max error from LOD-0 to LOD-1 is 4mm then a good max error from LOD-1 to LOD-2 is 1.6-2cm. Of course you can choose different scales if you like. These are values proving good LOD changing steps. The OpenGL Graphic Module allows to visualize LOD levels if you want to get a closer look.
 +<WRAP clear></WRAP>
 +
 +====== Advanced Usage ======
 +An advanced use of the LOD System can be found on the **[[gamedev:treecanopylod|Tree Canopy LOD]]** page.
  
 ====== Examples ====== ====== Examples ======
 <WRAP column 45%> <WRAP column 45%>
 <WRAP center box 450px> <WRAP center box 450px>
 +{{ :gamedev:lod_system.png |LOD meshes of a tree grate}} 
 +<WRAP centeralign>LOD meshes of a tree grate. At LOD-1 the reduction is already to 22% while on LOD-2 even down to 4%. This is an example of aggressive LODing removing entire geometry sections barely visible at a distance.</WRAP>
 </WRAP> </WRAP>
 </WRAP> </WRAP>
  
 <WRAP column 45%> <WRAP column 45%>
 +<WRAP center box 450px>
 +{{ :gamedev:lod_system2.png |LOD meshes of a power plug}}
 +<WRAP centeralign>LOD meshes of a power plug. The reduction here is less heavy. This is the typical example of LODing reducing model complexity without removing entire geometry sections. Both is possible in the Drag[en]gine.</WRAP>
 </WRAP> </WRAP>
 +</WRAP>
 +<WRAP clear></WRAP>
 +
gamedev/lod.1354545333.txt.gz · Last modified: 2012/12/03 14:35 by dragonlord