bw logo

Chapter 37. .visual

Defined in various sub-folders under the resource tree <res> (for example, <res>/environments, <res>/flora, <res>/sets/vehicles, etc...), the .visual file format specification is illustrated below:

<root>

  NodeSection 1

   <renderSet>
     <treatAsWorldSpaceObject> [true|false]  </treatAsWorldSpaceObject>
    +<node>                     string       </node>
     <geometry>
       <vertices>       object.vertices  </vertices>
       <primitive>      object.indices   </primitive>
      +<primitiveGroup> integer
         <material>
           EffectMaterial 2
         </material>
       </primitiveGroup>
     </geometry>
   </renderSet>

   <boundingBox>
    <min>   float float float   </min>
    <max>   float float float   </max>
   </boundingBox>

  *PortalSection 3

  *<boundary>
     <normal> float float float  </normal>
     <d>      float              </d>
    ?PortalSection 4
   </boundary>
  
</root>

Grammar of visual file

The list below describes the tags in the visual file:

  • boundary

    Section describing the planes surrounding the visual, much like the boundingBox section.

    These planes define a convex hull around the visual.

  • boundingBox

    Minimum and maximum XYZ coordinates of the model's bounding box.

    If visual has skinned vertices or animation, then this section is the visual's initial pose's bounding box.

  • d (section boundary)

    Distance along the normal between boundary and origin.

  • EffectMaterial

    For details, see EffectMaterial section.

  • geometry (section renderSet)

    List of geometries used by this renderSet.

  • material (section renderSet/geometry/primitiveGroup)

    Properties for the primitive group's material, such as shader, collision flags, maps, etc...

  • max (section boundingBox)

    Maximum extents of model's bounding box

  • min (section boundingBox)

    Minimum extents of model's bounding box

  • node (section renderSet)

    Node referenced by this renderSet.

  • NodeSection

    For details, see NodeSection.

  • normal (section boundary)

    Normal of the plane surrounding the visual.

  • PortalSection (main section, and boundary)

    For details, see PortalSection.

  • primitive (section renderSet/geometry)

    The name of the primitives used by this geometry (loaded from .primitives file — for details on this file's grammar, see .primitives).

  • primitiveGroup (section renderSet/geometry)

    Settings for primitive group.

    Primitive group is a group of triangles that share the same material properties.

  • renderSet

    Section for one or more objects with same transforms.

  • treatAsWorldSpaceObject (section renderSet)

    Determines if lighting and other position-based properties are passed to shader in world space.

  • vertices (section renderSet/geometry)

    The name of the vertices used by this geometry (loaded from .primitives file — for details on this file's grammar, see .primitives).

37.1. NodeSection

The grammar for the NodeSection is described below:

<node>

   <identifier> string </identifier>

   <transform>
     <row0>  float float float  </row0>
     <row1>  float float float  </row1>
     <row2>  float float float  </row2>
     <row3>  float float float  </row3>
   </transform>
    
  *NodeSection

</node>

Grammar of NodeSection in visual file

The list below describes the tags in NodeSection:

  • identifier

    Node's unique ID.

    The root node must be called Scene Root.

  • row0, row1, row2, row3

    Node's transform matrices.

  • transform

    3x4 matrix defining node's transform relative to the parent node.

37.2. PortalSection

Portals describe the line of sight into neighbouring chunk, and should be present only in shells.

The grammar for the PortalSection is described below:

<portal> [heaven|invasive|Empty]

    <uAxis>  float float float  </uAxis>
  +3<point>  float float float  </point>

</portal>

Grammar of PortalSection in visual file

The list below describes the tags in PortalSection:

  • point

    XYZ coordinates of one of portal's corners.

  • type

    Describes the type of portal being defined.

    Can have the following values:

    • heaven

      Outside lighting will be applied to shell, and from inside it you will be able to see outside chunks.

    • invasive

      Portal will have same properties as a heaven portal, but shell will also be visible from outside chunks.

    • Empty

      Portal will be purely a connecting one. This type can only be linked to other connecting portals.

  • uAxis

    The cross vector for the coordinate system of the portal points.

    The up vector is calculated by taking the cross product of the boundary's normal and the uAxis.