Difference between revisions of "HowTo:Add LODs"

From VsWiki
Jump to: navigation, search
m (check 0_1 name)
(Clarify LOD size parameter)
 
(6 intermediate revisions by 3 users not shown)
Line 5: Line 5:
 
}}
 
}}
 
----
 
----
'''Levels of Detail''', or '''LODs''', are used to help cut down strain on the engine. An LOD mesh is a simplified version of the high-detail (top-level) mesh. When an object is far away from the player, the engine switches to the low-poly LOD so it is easier to render.
+
'''Levels of Detail''', or '''[[Terminology:LODs|LODs]]''', are used to help cut down strain on the engine. An LOD mesh is a simplified version of the high-detail (top-level) mesh. When an object is far away from the player, the engine switches to the low-poly LOD so it is easier to render.
  
 
It's easy to reference LODs from within the xmesh file of the top-level mesh.
 
It's easy to reference LODs from within the xmesh file of the top-level mesh.
 
All you need to do is place an <LOD> tag somewhere betweeen the <mesh> and </mesh> tags. For example:
 
All you need to do is place an <LOD> tag somewhere betweeen the <mesh> and </mesh> tags. For example:
  
  <LOD meshfile="1_1.xmesh" size="1600" />
+
  <LOD size="275" meshfile="1_1.xmesh" />
  
Would reference a LOD to replace the current xmesh when the mesh occupies 40x40 pixels on the screen. (Size is the product of the pixel dimensions.)
+
Would reference a LOD to replace the current xmesh when the mesh occupies less than 275 pixels on the screen. Size is the area of the bounding circle, multiplied by a figure based on the player's detail setting to offset the detail level. Figures on xmesh LOD entries should correspond to medium detail: the LOD switch is visible, but not too much.
  
 
Here is an example of the standard naming scheme for xmeshes:
 
Here is an example of the standard naming scheme for xmeshes:
 
*name.xmesh = the main mesh
 
*name.xmesh = the main mesh
**0_1.xmesh = 1st LOD of main mesh ?? {{Fixme}} - check facts
+
**0_1.xmesh = 1st LOD of main mesh
 
*1_0.xmesh = submesh #1
 
*1_0.xmesh = submesh #1
 
**1_1.xmesh = the 1st LOD of submesh #1
 
**1_1.xmesh = the 1st LOD of submesh #1
Line 30: Line 30:
 
  mesher.exe 2_0.xmesh name.bfxm xba
 
  mesher.exe 2_0.xmesh name.bfxm xba
 
Mesher will automatically append all LODs.
 
Mesher will automatically append all LODs.
 +
 +
For LODs to work, the entries must be sorted by decreasing size.
 +
Basically, "10" means the mesh will be used when it will be drawn in an area 20 pixels wide (10 pixel radius).
 +
The numbers must be conservative, meaning they should be a safe transition point where the different between the meshes is barely noticeable, because user detail levels will take care of the rest.
  
 
==See also==
 
==See also==
 
*See [[Development:Model Guidelines#Polygon/Vertex Count]] for guidelines on LOD polycounts.
 
*See [[Development:Model Guidelines#Polygon/Vertex Count]] for guidelines on LOD polycounts.
 +
*See [[Terminology:LODs]] for a general explanation of LODs.
 +
 
----
 
----
 
{{NAV_Manual |
 
{{NAV_Manual |
Line 39: Line 45:
 
| next=[[HowTo:Add Engine Glow|Adding Engine Glow]]
 
| next=[[HowTo:Add Engine Glow|Adding Engine Glow]]
 
}}
 
}}
 +
 +
[[Category:HowTos|LODs]]
 +
[[Category:Modeling|LODs]]

Latest revision as of 17:43, 26 January 2012

arrow_left.png Editing XMESH arrow_up.png HowTos Adding Engine Glow arrow_right.png

Levels of Detail, or LODs, are used to help cut down strain on the engine. An LOD mesh is a simplified version of the high-detail (top-level) mesh. When an object is far away from the player, the engine switches to the low-poly LOD so it is easier to render.

It's easy to reference LODs from within the xmesh file of the top-level mesh. All you need to do is place an <LOD> tag somewhere betweeen the <mesh> and </mesh> tags. For example:

<LOD size="275" meshfile="1_1.xmesh" />

Would reference a LOD to replace the current xmesh when the mesh occupies less than 275 pixels on the screen. Size is the area of the bounding circle, multiplied by a figure based on the player's detail setting to offset the detail level. Figures on xmesh LOD entries should correspond to medium detail: the LOD switch is visible, but not too much.

Here is an example of the standard naming scheme for xmeshes:

  • name.xmesh = the main mesh
    • 0_1.xmesh = 1st LOD of main mesh
  • 1_0.xmesh = submesh #1
    • 1_1.xmesh = the 1st LOD of submesh #1
  • 2_0.xmesh = submesh #2
    • 2_1.xmesh = the 1st LOD of submesh #2
    • 2_2.xmesh = the 2nd LOD of submesh #2

and so on.

Note that when creating a BFXM file, only the top level xmeshes need to be appened. For instance, if you are compiling the mesh above, all you need to do is:

mesher.exe name.xmesh name.bfxm xbc
mesher.exe 1_0.xmesh name.bfxm xba
mesher.exe 2_0.xmesh name.bfxm xba

Mesher will automatically append all LODs.

For LODs to work, the entries must be sorted by decreasing size. Basically, "10" means the mesh will be used when it will be drawn in an area 20 pixels wide (10 pixel radius). The numbers must be conservative, meaning they should be a safe transition point where the different between the meshes is barely noticeable, because user detail levels will take care of the rest.

See also


arrow_left.png Editing XMESH arrow_up.png HowTos Adding Engine Glow arrow_right.png