LOD: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (: corrected link)
(: updated vert limit info)
Line 32: Line 32:
To demonstrate the complexity of the LOD selection, and the effect the resolution name has on LOD switching, a series of tests have been documented here: [[Operation_Flashpoint:_Resolution_LOD_Samples | Resolution LOD Samples]]
To demonstrate the complexity of the LOD selection, and the effect the resolution name has on LOD switching, a series of tests have been documented here: [[Operation_Flashpoint:_Resolution_LOD_Samples | Resolution LOD Samples]]


The modelgeometry in each LOD needs to be below a "maximum polygoncount". This "maximum polygoncount" varies depending on how your model looks. The actual limit is based off [http://wiki.polycount.com/wiki/VertexNormal vertex normals] and according to some tests and documentation of DirectX9 this appears to be 2^15 = 32768 vertex normals  (Information provided by community member PuFu). DirectX9 is used in ArmA, Arma 2 and Arma 3. The total amount of triangles you can use therefore depends on the [http://www.ericchadwick.com/examples/provost/byf2.html#wts Smoothing splits and UV splits] in your model. If you exceed the limit, loading your model may crash the game or it simply won't display it. You can check it in Objectbuilder by loading up Bulldozer - if the LOD is not displayed, you are above the limit. Modern 3D modelling tools also offer native or user created tools to check the amount of vertex normals. Please remember that this is the absolute maximum you can use - this does not mean you should fully utilize it on every object.
The modelgeometry in each LOD needs to be below a "maximum polygoncount". This "maximum polygoncount" varies depending on how your model looks. The actual limit is based off [http://wiki.polycount.com/wiki/VertexNormal vertex normals] and according to some tests and documentation of DirectX9 this appears to be 2^15 = 32768 vertex normals in Arma 2 and early Arma 3. Latest version of Arma 3 has a limit of 2^32=4.3billion vertex normals limit (Information provided by community member PuFu). DirectX9 is used in ArmA, Arma 2 and Arma 3. The total amount of triangles you can use therefore depends on the [http://www.ericchadwick.com/examples/provost/byf2.html#wts Smoothing splits and UV splits] in your model. If you exceed the limit, loading your model may crash the game or it simply won't display it. You can check it in Objectbuilder by loading up Bulldozer - if the LOD is not displayed, you are above the limit. Modern 3D modelling tools also offer native or user created tools to check the amount of vertex normals. Please remember that this is the absolute maximum you can use - this does not mean you should fully utilize it on every object.





Revision as of 12:08, 9 June 2016

What's a LOD?

LODs.gif

LOD means Level of Detail, and is a method of defining, via different variations of a model, how high or low the viewable quality of the model should be, and how it should interact with the environment.

<resolution>

Truck-ResLOD.jpg

In Open-World 3D Games (including all Arma Titles) it is standard practice to swap out high-resolution Models with medium- or low-resolution models at far distance from the observer. This is done to prevent excessive demand of computing ressources. Without the resolution LOD technique, the games would be unplayable due to bad performance.

The switching of different resolution LOD in OFP and Arma is automatic, based on various factors / in-game conditions (e.g. view-distance, number of objects, video quality, CPU utilization, etc.). In Arma 3 the number of the resolution LOD has no impact and there is no way to specify which LOD is to be used at which range. The algorithm needs enough different resolution LOD to be effective. Therefore the modeller needs to provide multiple resolution LOD with different polygon-density. They should be ordered according to their polygoncount (highest polycount has number 0 (or 1), second highest one number 1(or 2) and so on)

Arma 3 example:

Model -no identifier defined- res 1 res 2 res 3 res 4 res 5 res 6
T-100 Varsuk Points 27600 18400 11500 5100 2500 800
Faces 14100 9100 5500 2300 1200 350
Sections 12 12 12 12 11 7


A common practice is to half the polygon amount for the next lower resolution LOD by ~2 As a guideline, the lowest resolution LOD should have a polygoncount of somewhere around 500 and as few sections as possible. If a resolution LOD has far below 500 Polygons, the amount of sections has a much bigger impact on performance then the Polygoncount (e.g. it doesnt really matter if a resolution LOD has 50 or 400 Polygons, it does matter alot more in this case if it has 1 section or 4 sections). This has to do with how draw-calls work (instructions that the CPU sends to the GPU)

In addition to reducing the polygon density, it is best practice to also reduce shader complexity and the amount of textures used - because those too eat valuable ressources. The lowest resolution LOD won't need a normalmap and propably not even a specular or gloss map (test it for your object).

This LOD shouldn't contain any empty Named Selections which are used in animations or by the game engine (wheels, etc.), as that might cause the game to crash once the LOD becomes active. To demonstrate the complexity of the LOD selection, and the effect the resolution name has on LOD switching, a series of tests have been documented here: Resolution LOD Samples

The modelgeometry in each LOD needs to be below a "maximum polygoncount". This "maximum polygoncount" varies depending on how your model looks. The actual limit is based off vertex normals and according to some tests and documentation of DirectX9 this appears to be 2^15 = 32768 vertex normals in Arma 2 and early Arma 3. Latest version of Arma 3 has a limit of 2^32=4.3billion vertex normals limit (Information provided by community member PuFu). DirectX9 is used in ArmA, Arma 2 and Arma 3. The total amount of triangles you can use therefore depends on the Smoothing splits and UV splits in your model. If you exceed the limit, loading your model may crash the game or it simply won't display it. You can check it in Objectbuilder by loading up Bulldozer - if the LOD is not displayed, you are above the limit. Modern 3D modelling tools also offer native or user created tools to check the amount of vertex normals. Please remember that this is the absolute maximum you can use - this does not mean you should fully utilize it on every object.


The default Named Property for resolution LOD's is: LodNoShadow=1

Geometry

Truck-GeoLOD.gif

Defines where the model will collide with other objects.
Should be very simple, and has to fulfill the following criteria in order to work:

  • Object must be named ComponentXX (where XX is a consecutive number between 01 and 99).
  • Must have 'Mass' (Alt-M).
  • Must be closed and convex. Always validate your Geometry LOD. (Validating Geometries).
  • It must be smaller then the size limit.

If the geometry LOD is larger then the size limit, it gets glitchy (collision does not work for example and the object may disappear at certain view angles). The exact value of the limit is not yet known, but it's somewhere around 50-60 meter from the center of origin (meaning that your object can be 100m wide/long at max if it is symmetrical to the center of origin). According to reports there is no limit skywards, so you could make a tower of 200m height. Note that if your object requires a roadway LOD, you need to stay within the roadway size limit, which is smaller.


Geometry objects should have a thickness of at least 0.5 meters in order to work properly.

TIP: Oxygen2/Objectbuilder can do ComponentXX naming automatically. [Structures->Topology->Find Components]

Arma 3:

  • Geometry LOD is used for Collision if one of the colliding Objects is not a PhysX simulated Object. For example living Soldiers are not PhysX objects. Tank-Soldier Collision is therefore determined by Geometry LOD, even-though the Tank is a PhysX simulated Object.
  • For PhysX Objects the Mass value and the Mass distribution is critically important for the Objects physical behavior [Keywords: "Inertia" and "Moment of Inertia" ]
  • The default Named Properties for the Geometry LOD are: canocclude=0 and canbeoccluded=1 (for Vehicles, Characters and Weapons)


Geometry Phys

Arma 3 only

Defines the collision model that is used in a collision between two PhysX Objects.

The same criteria like for the Geometry LOD apply. The detail should be even lower then in the Geometry LOD if possible, as PhysX collisions are computationally more expensive. The difference is that Geometry Phys does not contain Mass information. For helicopters, cut the blades and any non critical structures out of the PhysX LOD, otherwise the rotor blades can cause critical failure. For tanks or other vehicles with turrets/ large cannons it is best practice not to include the cannon barrel or long protruding turret parts in the PhysX LOD. The rotation of turrets is not limited by forces, therefore the collision of a barrel with the environment will cause the tank or other PhysX objects to move (often very violently, causing serious glitches and flying tanks).

NOTE: Requires Objectbuilder to be selectable in the LOD list. Oxygen2 does not have this capability.

NOTE: Grenades are currently PhysX objects, that means they do use this LOD instead of Fire Geometry.

Fire Geometry

Defines where the model will collide with bullets & rockets. If this LOD is not present the Geometry LOD will be used instead. Should be simplified as much as possible, but can be a bit more complex then Geometry or Geometry Phys

  • Object must be named ComponentXX (where XX is a consecutive number between 01 and 99). (see Geometry LOD)
  • Must be closed and convex (see: Validating Geometries).

Proxies for the driver & passenger must be present into this LOD as well (they can be copied from the Resolution LOD). Otherwise the units will be invincible. One should also do any geometry validation before adding the proxies, otherwise they will not be functional.

Arma 3:

All Components should have a damage material applied. This defined the penetrability of the object and the impact effect type. There are two possibilities for Materials: Normal Materials or Plate Materials.

  • Plate Materials have a pre-defined thickness. It doesnt matter how thick the modelled component in the Fire Geometry is.
  • Normal Materials only define material characteristics. The thickness is determined by the modelled component.

Example: A component representing a Wall with a thickness of 2m is modelled in the Fire Geometry. If we apply concrete.rvmat it will behave like a 2m thick concrete wall. If we apply concrete_plate.rvmat, it will behave like a 30mm thick concrete wall.

NOTES:

  • If no materials are applied, Arma 3 will default to a nonpenetrable material with dirt impact effect type
  • If during binarization, the P: drive is not properly set up the referenced materials won't be found -> default to dirt impact type
  • Arma 3 has many materials that can be used directly or as base for custom materials, they can be found in "...\arma3\addons\data_f.pbo\penetration\"
  • Arma 3 Plate materials are usually 30mm thick. Armour plate materials are the only ones with different thicknesses.
  • The penetration system does not work well reliably modelled plate thicknesses below 10mm. If you want plate thicknesses smaller then 5mm, model firegeometry with at least 10mm but apply custom plate materials for decreased thickness.

For more details on how Damage&Penetration interact see Arma 3 Damage Description

Hit-points

Hit-pointLODs define, via unconnected named vertexes, where certain destroyable parts of a model are (e.g. wheels, lights, etc.).

NOTE: The spacing between the points needs to be tuned in close correlation with the Hitpoint Config Class in the Objects Config and the Fire Geometry

For more details on how Damage&Penetration interact see Arma 3 Damage Description

Memory

Named Selections that are used to define lights, vehicle entry points, etc., as well as control points for Animations.

TIP: For memorypoint creation in an external modelling tool that has no OFP/Arma export plugin, you can create a triangle in the external modeller. Place one or two vertices of the triangle where you need them. Import the triangle(s) into Oxygen2/Objectbuilder. Delete the obsolete point(s) of the triangle.

You can animate Memory LOD Selections via model.cfg just like any ordinary LOD. However, it is not guaranteed that this will work for the thing you intent to. Particles for example ignore animated memorypoints, they always use the default position from Objectbuilder. Same holds true for gun/cannon Memorypoints on vehicle turrets. Vehicle Reflector class lights however do animate properly.

Paths

Important LOD for AI path finding. With the help of this LOD the AI can find its way through objects (such as buildings). Not required for objects that don't require AI pathfinding. It consists of an interconnected mesh. All path vertices's must be connected by polygons.

Vertices where the AI can stop must be defined by named selection with ascending number ("posXX" where XX is the number). Those points can be used by scriptcommand <link>buildingpos and in the Mission editor for placing Units. Name selections called "inXX" (where XX is a number) serve as AI access points (doorways, ramps, etc) to the building. Those positions have to Every point where AI could stop, must be defined by named selection with ascending number The specific named selections must be based on class definition

AI ignore the Geometry LOD when on a pathway. This means that they can walk through walls if you dont set up your pathway to lead around obstacles.

There is an old tutorial if you need to see how it needs to look http://ofp.gamepark.cz/_hosted/brsseb/tutorials/lesson8/lesson8_l.htm

Roadway

If a units is supposed to be able to stand on top of a model, that surface has to be defined by a RoadwayLOD.

Make sure that a RoadwayLOD doesn't overlap with a GeometryLOD, or the unit will start to wobble at those points.

The roadway LOD does not work if components are further away from the center of origin then 36 meter. Therefore you can make 72m long bridges at most. If that is not sufficient for your object then you need to split your model into multiple smaller segments with a seperate .p3d modelfile each.

This LOD is used to determine the sound environment effects the player hears. The used environment effect are defined by the texture of the roadway LOD surface the player are standing on. The texture name corresponds to classes in CfgSurfaces.

LandContact

Where the object touches the ground. (Defined by a single vertex per contact point.)


ViewGeometry

The visible geometry of the model.

As an example: If you have an object with this LOD properly configured, you will not be able to spot other units through the model. AI will not be able to spot other units through the model.

View - Cargo

Truck-View-Cargo.jpg

What a cargo passenger can see of the model.

In vehicles of the class "Car", the player will always see this view, whether he's the driver, co-driver or cargo. (Unless the "View - Pilot" is defined. Then that view is taken for any position inside the vehicle.)

View - Cargo - Fire Geometry


View - Cargo - Geometry

View - Commander

What the commander can see of the model.

In vehicles, this will be the commander's first person view of the model.

View - Commander -Fire Geometry


View - Commander -Geometry


View - Gunner

What the gunner can see of the model.

In vehicles, this will be the gunner's first person view of the model.

View - Gunner - Fire Geometry


View - Gunner - Geometry


View - Pilot

What the pilot/driver can see of the model.

In vehicles of the class "Car", the player will always see this view, whether he's the driver, co-driver or cargo. Players position in the LOD is determined by his proxy position.

View - Pilot - Fire Geometry


View - Pilot - Geometry


ShadowVolume

This LOD is used to cast shadows on the ground, other objects and on the object itself. Shadow LOD should be simplified compared to resolution LOD, but can be more detailed then Geometry/Fire Geometry LOD. Shadow LOD must be slightly shrinked compared to resolution LOD (in 3dsmax you can use a push modifier to do this), otherwise the Model may look partly or completely shaded in the game. There are usually two Shadow LOD's - one detailed for close range and one very simple one for long distances. LOD must be:

  • Closed
  • Triangulated
  • Sharp Edges

ArmA/OFPE only: Typically named ShadowVolume 0.000 (Few features) and ShadowVolume 0.100 (same amount of features as the main visual model (i.e. equipment, weapon systems, etc).(Also see this article)