Difference between revisions of "Arcane University:LOD Model Creation"

The Beyond Skyrim Wiki — Hosted by UESP
Jump to: navigation, search
(table)
(updated with some DynDOLOD 3 info)
 
(30 intermediate revisions by the same user not shown)
Line 1: Line 1:
{| class="wikitable sortable"
+
{{Trail|3D Art}}
!3D Software
+
[[File:Skyrim_Whiterun_LOD1.png|thumb|350px|right|A compiled LOD file of Whiterun, viewed in NifSkope.]]
!Free?
+
'''LOD''', or '''level of detail''', is the method used in video games to render distant objects at a lower complexity, for better performance. For objects in Skyrim, this is achieved by using meshes with lower polycount created by the 3D artists. These models are then compiled into groups of 4x4, 8x8, and 16x16 cells during [[AU:LOD Generation|LOD Generation]]. The resulting compiled nifs are loaded and rendered for cells that are not occupied by or near the player character. This article will detail the methods for creating LOD models for objects in Skyrim.
!Modeling
 
!Sculpting
 
!Baking
 
!Texturing
 
|-
 
|3ds Max||No||Yes||?||?||?
 
|-
 
|Blender||Yes||Yes||Yes||Yes||Yes
 
|-
 
|Maya||No||Yes||?||?||?
 
|-
 
|Substance Painter||*||No||No||Yes||Yes
 
|}
 
  
bad
+
Since LOD models will only be seen at a distance, not everything needs to have them. LOD is mainly used for architecture, trees, mountains, ships, and similar large objects that would be noticeably absent from a distance. Smaller clutter objects are not noticeable when invisible at a distance, so they don't need LOD models. Trees in Skyrim use a pair of billboards (planes) for LOD, but this only looks good for trees that are more or less symmetrical. Otherwise, they can be implemented as objects instead, using full 3D LOD meshes for the closest LOD models, and billboards farther away.
 +
 
 +
==Overview==
 +
There are four levels of LOD used by Skyrim, referred to as LOD0, LOD1, LOD2, and LOD3. You may also hear them referred to as LOD4, LOD8, LOD16, and LOD32, respectively. This guide will use the former system.
 +
*'''LOD0''' is the first level, which appears first as the player moves away from the object. This usually happens at a distance of about two cells. Many medium-sized objects only have this first level, and then fade out at greater distances.
 +
*'''LOD1''' is the second level, which becomes visible several cells away. This is used for larger objects like buildings, trees, and landscape objects.
 +
*'''LOD2''' is the next level, which is visible only at great distances, and often uses the same model as LOD1. Only the largest objects require a model for LOD2. This is also the level which is shown by default on the map (although this is configurable by the user in an ini file).
 +
*'''LOD3''' is not used in Skyrim.
 +
<gallery mode=packed style="text-align:left margin:auto" caption="Skyrim Mountain Cliff 01">
 +
Skyrim_Mtn_Full.png | The full mountain cliff model (3399 tris). Note that it uses two meshes/texture sets, and tiles heavily.
 +
Skyrim_Mtn_LOD0.png | The LOD0 model (2391 tris) uses a single full-size texture (1k), still tiling.
 +
Skyrim_Mtn_LOD1.png | The LOD1 model (354 tris) uses a baked texture at 128x128.
 +
Skyrim_Mtn_LOD2.png | The LOD2 model (63 tris), and uses the same baked texture as the LOD1 model.
 +
</gallery>
 +
 
 +
<gallery mode=packed style="text-align:left margin:auto" caption="Skyrim Farmhouse 01">
 +
Skyrim_LOD_Farmhouse_Full.png | The full farmhouse model (2488 tris). It uses several meshes with different shaders and textures.
 +
Skyrim_LOD_Farmhouse_LOD0.png | The LOD0 model (368 tris) uses a single trimsheet-style texture (128x256).
 +
</gallery>
 +
 
 +
==Technical constraints==
 +
There are several technical constraints to keep in mind before making your LOD models:
 +
*'''No specular:''' LOD models do not use specular maps, so you can remove this from the material in your 3D package to reduce extra steps after export. This also means that if you create downscaled normal maps, they do not need the specular information in the alpha channel, and can be compressed to BC1 without loss of specular information.
 +
*'''No animation:''' LOD models cannot be animated. If you must have an object that retains its animation at a distance, use the "Is Full LOD" option on the object reference, and be sure the object form has no LOD meshes assigned. Use this sparingly, as the full detail mesh will be loaded no matter where you are in the worldspace.
 +
*'''No collision:''' Since the model will only be loaded at a distance, it does not need [[AU:Mesh Collisions|collision]]. If it is included in the nif, it will be ignored at LOD Generation.
 +
*'''No BSXFlags:''' Similarly, the nif does not need [[AU:NIF Data Format#BSXFlags|BSXFlags]], since they too are irrelevant. They will also be ignored if included.
 +
However, some features are supported by LOD:
 +
*'''Vertex Colors:''' LOD models do retain vertex color information, which is useful for maintaining faked shadow detail.
 +
*'''Transparency:''' LOD meshes have a constant alpha testing threshold of 128. Alpha blending is not supported, and alpha testing cannot be turned off. This means there are a few things to note:
 +
** Any textures that have alpha channels will have transparency in LOD, even if it is not enabled with an alpha property in the nif.
 +
** The diffuse textures can be compressed to BC1 without a loss of transparency gradients.
 +
** Keep in mind, as always, that transparency is very resource intensive, and should be used carefully.
 +
*'''Glow:''' LOD models can use the glow shader. Simply add "passthru" to the name of the TriShape in NifSkope, and xLODGen will pass the shader through.
 +
 
 +
==Methods==
 +
With DynDOLOD 3, textures are downscaled and added to the atlas automatically, so generally it is no longer necessary to create downscaled LOD textures. DynDOLOD 3 also can apply texture sets on the fly, so you don't need to create separate LOD models for texture set variants, as long as the full model and LOD model have matching shape names. Polycount will depend on the complexity of the original mesh, and how large it is, so exercise your judgment. A good rule of thumb is to make LOD0 to have 20% of the triangles that the full mesh has, and LOD1 to have 10%. If this brings it down to the low hundreds, that should be all you need.
 +
 
 +
===Method 1: Create extra-low poly and bake===
 +
This method is ideal for objects that already use baked textures, or unique architecture. The workflow is exactly the same as baking from a high poly to low poly model. Simply retopologize your model to have fewer faces, adjust UVs if needed, and bake. Since it will only ever be seen from far away, automatic decimation may even produce an acceptable result. Finally, shrink the first LOD level along its normals by 3-5%. This will prevent flickering as the full model loads in on top of it in game.
 +
 
 +
===Method 2: Adjust UVs and decimate===
 +
[[File:UV_0to1.png|thumb|upright=0.7|right|A UV map in blender, where all UVs are in the 0 to 1 range.]]
 +
This method is good for things that use tiling textures, like city sets and large landscape models. This allows your set of LOD models to use the same common set of LOD textures, instead of each building having a baked LOD model. Although if your model could save a lot of geometry by baking, that may the better option.
 +
 
 +
The important thing in this method is that in order for the LOD texture to go on the atlas, all the UVs must be within the 0 to 1 range. That is, they must all be in the same UV square, not going across its boundaries. So the first step is to do this, by cutting the UVs up, or squishing them into the bounds. The model will only be seen from very far away, so some squishing and stretching is tolerable. If you have a face that uses the tiling several times over, and can't be cut up, you can also use DynDOLOD's [https://dyndolod.info/Help/TexGen-Configuration stitched object lod] feature.
 +
 
 +
Once the UVs are all condensed, decimate or retopologize as usual. Shrink the first LOD level along its normals by 3-5%. This will prevent flickering as the full model loads in on top of it in game. Now it is ready for export.
 +
 
 +
'''A handy tip''': When making LOD models for a set, keep a separate file with all the related LOD materials collected, so you can then import them and assign them to whichever model you are making.
 +
 
 +
==CK implementation==
 +
For your object to have LOD, you must assign the LOD meshes to the static form. On this form, check the "Has Distant LOD" box, and use the button that is now enabled to open a window where you can assign meshes for each level of LOD. You can assign the same model for all levels, or a different one for each. Or, you could assign a model to just one or two levels, which is useful for medium-sized architecture.
 +
{{note|Using xEdit, it is possible to assign LOD models without enabling the "Has Distant LOD" flag. The LOD will not be used unless the flag is on!}}
 +
If your mod simply adds new buildings or mountains, you're done! If you are creating a new worldspace or a total conversion mod, it's time for [[AU:LOD Generation|LOD Generation]].
 +
 
 +
==See also==
 +
*[[AU:LOD Generation|LOD Generation]]
 +
*[[wikipedia:Level of detail (computer graphics)|LOD]] on Wikipedia

Latest revision as of 11:59, 24 August 2024

< Arcane University:3D Art
A compiled LOD file of Whiterun, viewed in NifSkope.

LOD, or level of detail, is the method used in video games to render distant objects at a lower complexity, for better performance. For objects in Skyrim, this is achieved by using meshes with lower polycount created by the 3D artists. These models are then compiled into groups of 4x4, 8x8, and 16x16 cells during LOD Generation. The resulting compiled nifs are loaded and rendered for cells that are not occupied by or near the player character. This article will detail the methods for creating LOD models for objects in Skyrim.

Since LOD models will only be seen at a distance, not everything needs to have them. LOD is mainly used for architecture, trees, mountains, ships, and similar large objects that would be noticeably absent from a distance. Smaller clutter objects are not noticeable when invisible at a distance, so they don't need LOD models. Trees in Skyrim use a pair of billboards (planes) for LOD, but this only looks good for trees that are more or less symmetrical. Otherwise, they can be implemented as objects instead, using full 3D LOD meshes for the closest LOD models, and billboards farther away.

Overview[edit]

There are four levels of LOD used by Skyrim, referred to as LOD0, LOD1, LOD2, and LOD3. You may also hear them referred to as LOD4, LOD8, LOD16, and LOD32, respectively. This guide will use the former system.

  • LOD0 is the first level, which appears first as the player moves away from the object. This usually happens at a distance of about two cells. Many medium-sized objects only have this first level, and then fade out at greater distances.
  • LOD1 is the second level, which becomes visible several cells away. This is used for larger objects like buildings, trees, and landscape objects.
  • LOD2 is the next level, which is visible only at great distances, and often uses the same model as LOD1. Only the largest objects require a model for LOD2. This is also the level which is shown by default on the map (although this is configurable by the user in an ini file).
  • LOD3 is not used in Skyrim.

Technical constraints[edit]

There are several technical constraints to keep in mind before making your LOD models:

  • No specular: LOD models do not use specular maps, so you can remove this from the material in your 3D package to reduce extra steps after export. This also means that if you create downscaled normal maps, they do not need the specular information in the alpha channel, and can be compressed to BC1 without loss of specular information.
  • No animation: LOD models cannot be animated. If you must have an object that retains its animation at a distance, use the "Is Full LOD" option on the object reference, and be sure the object form has no LOD meshes assigned. Use this sparingly, as the full detail mesh will be loaded no matter where you are in the worldspace.
  • No collision: Since the model will only be loaded at a distance, it does not need collision. If it is included in the nif, it will be ignored at LOD Generation.
  • No BSXFlags: Similarly, the nif does not need BSXFlags, since they too are irrelevant. They will also be ignored if included.

However, some features are supported by LOD:

  • Vertex Colors: LOD models do retain vertex color information, which is useful for maintaining faked shadow detail.
  • Transparency: LOD meshes have a constant alpha testing threshold of 128. Alpha blending is not supported, and alpha testing cannot be turned off. This means there are a few things to note:
    • Any textures that have alpha channels will have transparency in LOD, even if it is not enabled with an alpha property in the nif.
    • The diffuse textures can be compressed to BC1 without a loss of transparency gradients.
    • Keep in mind, as always, that transparency is very resource intensive, and should be used carefully.
  • Glow: LOD models can use the glow shader. Simply add "passthru" to the name of the TriShape in NifSkope, and xLODGen will pass the shader through.

Methods[edit]

With DynDOLOD 3, textures are downscaled and added to the atlas automatically, so generally it is no longer necessary to create downscaled LOD textures. DynDOLOD 3 also can apply texture sets on the fly, so you don't need to create separate LOD models for texture set variants, as long as the full model and LOD model have matching shape names. Polycount will depend on the complexity of the original mesh, and how large it is, so exercise your judgment. A good rule of thumb is to make LOD0 to have 20% of the triangles that the full mesh has, and LOD1 to have 10%. If this brings it down to the low hundreds, that should be all you need.

Method 1: Create extra-low poly and bake[edit]

This method is ideal for objects that already use baked textures, or unique architecture. The workflow is exactly the same as baking from a high poly to low poly model. Simply retopologize your model to have fewer faces, adjust UVs if needed, and bake. Since it will only ever be seen from far away, automatic decimation may even produce an acceptable result. Finally, shrink the first LOD level along its normals by 3-5%. This will prevent flickering as the full model loads in on top of it in game.

Method 2: Adjust UVs and decimate[edit]

A UV map in blender, where all UVs are in the 0 to 1 range.

This method is good for things that use tiling textures, like city sets and large landscape models. This allows your set of LOD models to use the same common set of LOD textures, instead of each building having a baked LOD model. Although if your model could save a lot of geometry by baking, that may the better option.

The important thing in this method is that in order for the LOD texture to go on the atlas, all the UVs must be within the 0 to 1 range. That is, they must all be in the same UV square, not going across its boundaries. So the first step is to do this, by cutting the UVs up, or squishing them into the bounds. The model will only be seen from very far away, so some squishing and stretching is tolerable. If you have a face that uses the tiling several times over, and can't be cut up, you can also use DynDOLOD's stitched object lod feature.

Once the UVs are all condensed, decimate or retopologize as usual. Shrink the first LOD level along its normals by 3-5%. This will prevent flickering as the full model loads in on top of it in game. Now it is ready for export.

A handy tip: When making LOD models for a set, keep a separate file with all the related LOD materials collected, so you can then import them and assign them to whichever model you are making.

CK implementation[edit]

For your object to have LOD, you must assign the LOD meshes to the static form. On this form, check the "Has Distant LOD" box, and use the button that is now enabled to open a window where you can assign meshes for each level of LOD. You can assign the same model for all levels, or a different one for each. Or, you could assign a model to just one or two levels, which is useful for medium-sized architecture.

Ambox important.png NOTE: Using xEdit, it is possible to assign LOD models without enabling the "Has Distant LOD" flag. The LOD will not be used unless the flag is on!

If your mod simply adds new buildings or mountains, you're done! If you are creating a new worldspace or a total conversion mod, it's time for LOD Generation.

See also[edit]