Skip to content

Importer

KW71 edited this page Apr 3, 2023 · 25 revisions

Bone and node hierarchy

Level of detail (LOD)

Rendering geometry is created from all meshes that are in the imported file. By default, all meshes are imported into LOD0. To change the LOD, a LOD string must appear somewhere in the name. By default, LOD0 .. LOD5 are used (can be changed during import in "Package Properties"). Good practice is using LOD# as a prefix for the mesh name._

To control LOD switching there are two parameters in objdef file for the model: lod_size01 and lod_size12. These values approximately tell the size (diameter of the bounding sphere) of the object on the screen in pixels for switch between LOD 0 and 1, or LOD 1 and 2 respectively.

Other detail level switch points are derived from these two numbers. The screen size for k→k+1-th LOD switch is computed as:

lod_sizek→k+1 = [lod_size12]k / [lod_size01]k-1

So for example with lod_size01:550 and lod_size12:260, switch from LOD2 to LOD3 would happen at

lod_size2→3 = 2602 / 550 ≅ 123 px
lod_size3→4 = 2603 / 5502 ≅ 58 px

This is useful when you want to know what screen size the other LODs should be designed for.

Collision shapes

Collision shapes are used for collision detection in Outerra engine. Collision shapes have to be standalone meshes attached to the central bone hierarchy. Only the FBX Importer (Ctrl+F7) supports importing collision shapes.

Collision geometry is created from meshes that are specifically named. The shape type is determined by the node name prefix. The prefix is filtered out from the resulting node name.

Supported types:

  1. COL_CONVEX (convex hull)
  2. COL_SPHERE
  3. COL_BOX
  4. COL_CYLINDER
  5. COL_CAPSULE
  6. COL_CONE
  7. COL_WHEEL

Note that, with the exception of the convex hull, the mesh itself is not used directly to determine parameters of the shape. Parameters like the radius and height for parametric collision shapes are derived from the mesh’s AABB instead. It’s important to have the pivot in right position; some objects need the pivot in object’s center, others in object’s base (see below).

The meshes are imported into the package as well and can be used for debugging purposes, so it’s a good idea to have the meshes roughly corresponding to actual collision shapes (cylinder should be cylinder etc.).

Resulting collision shape is a union of the primitive shapes present in the model. If the shapes are attached to animated bones, the collision body will be automatically updated with the bones.

Convex hull - COL_CONVEX

There is no check if the mesh is really convex! Convex hull is created from mesh vertices. For performance reasons the triangle count should be kept low. Shading should be set to smooth and UV map disabled to avoid unnecessary vertex splitting.

Note it’s preferable to use the parametric shapes instead of the convex mesh when possible, as they are faster.

Covex hull example

Sphere shape - COL_SPHERE

Pivot point has to be in sphere center. Radius is computed from AABB’s half vector and its X component.

Sphere shape example

Box shape - COL_BOX

Pivot point has to be in the box center. Shape is defined from AABB’s half vector.

Box shape example

Cylinder shape - COL_CYLINDER

Pivot point has to be in the center of the cylinder. Radius is computed from AABB’s half vector along the X axis, and the central axis is aligned with Z axis.

Cylinder shape example

Capsule shape - COL_CAPSULE

Pivot point has to be in the capsule center. Shape is defined by the AABB’s half vector. Radius and central axis are detected automatically.

Capsule shape example

Cone shape - COL_CONE

Pivot point has to be in the center of the cone base. Radius is computed from AABB’s half vector along the X axis, and the height along the Z axis.

 Cone shape example

Cylinder shape for wheel - COL_WHEEL

The basic geometric shape is the same as COL_CYLINDER, with the difference that the wheel collision geometry is not colliding with the terrain. It has to be the child of the wheel bone!

Terrain occluder

The terrain occluders are the special types of the collision shapes, which define the interior of eg. tunnels. The terrain inside of the terrain occluder is not rendered and the collisions are disabled. It also defines a volume of the interior. That means it will not provide any collision responses while it still could be used for test if point is inside of given object. The terrain occluder name must contain special prefix similar to ordinary collision shape, but in the case of the terrain occluder you replace "COL" with "OCC" (eg. OCC_BOX,OCC_CYLINDER ...).

Recommendations:

Keep the count of the terrain occluders as low as you can. Generally the entrance to the underground needs more accuracy, but for the models which are meant to be entirely hidden under the ground the AABB should be sufficient. In the case of the entrance models we advise you to make a little margin which will be hidden in the model geometry.

Characters

Character collision shapes are generated automatically from bone hierarchy and character height (in future we can add additional coefficients to control shape generation).

Default hidden meshes

You can define the hidden meshes in the objdef file. Just add "hidden_meshes" section which holds the array of the names of the hidden meshes.

Note:

When you hide the collision mesh it also disables the collision of given mesh.

Example:

"hidden_meshes": ["mesh1", "mesh2", "mesh3", ...]

Test

Clone this wiki locally