meta data for this page
  •  

Geometry overview

An .stsdk file contains all the geometry data needed for real-time rendering, including:

  • Indexed triangle 3D mesh data to represent the branch, leaf, frond, and other 3D geometry constructs.
  • Separate meshes for each 3D level of detail (LOD). Note that there are per-vertex LOD hints utilized by the SpeedTree shaders to smooth LOD transitions and help prevent popping.
  • The billboard geometry, which, if enabled on export, is stored as the last LOD mesh.
  • Collision objects and bone data.

Vertex definitions

Vertex definitions are chosen at export from the Modeler’s Games Export dialog. Users can define their own vertex declarations using Lua (SpeedTree refers to these Lua scripts “vertex packers.” See Vertex Packing for more information. The Modeler allows users to select different vertex declarations for a tree model’s 3D meshes, billboard geometry, and grass models, which often use lighter vertex definitions due to less complex wind.

Note: The vertex declaration set in the vertex packer for a given .stsdk file not only sets the vertex declaration used in the raw vertex buffer data written to the .stsdk file but it must match the vertex definition in the vertex shader loaded to render it (each is defined by the Modeler and SDK users). The SDK does not guard against this and a mismatch will likely result in a graphics API assertion failure, crash, or undefined rendering.

CCore::Get3dVertexDecl() and CCore::GetBillboardVertexDecl() each return an SVertexDecl object that contains the vertex definitions for each geometry type, but more commonly, users will simply declare their own vertex structures to match their Lua structure definitions used in the Modeler and typecast the raw vertex data to this type. For an example of how this is done, see Accessing 3D Geometry.