User Tools

Site Tools


Model renderer (Doomsday 2)

The GL2 model renderer is the primary user of 3D model assets. Whenever a model asset is present in a loaded package, the model renderer loads the 3D model data into memory and, when the model is needed for drawing, prepares the needed OpenGL resources for drawing the model.

The renderer can use 3D models in several ways:

  • Things (mobjs) can be represented using 3D models with a model.thing.* asset.
  • Player weapons (psprites) use the model.weapon.* assets.
  • TODO: other kinds of model assets, e.g., surface decorations.

See also: Supported 3D model formats


Version 1.15

  • Model files are loaded using the Open Asset Import Library. This means a variety of different file formats can be used.
  • Skeletal animation (using bones) is the primary way of animating objects. The current limitation is 64 bones per object.
  • Models can be composed of multiple meshes, each having its own textures.
  • Texture images are automatically collected onto atlases for rendering.
  • There is currently one general purpose OpenGL shader that does per-pixel lighting.
  • There can be 4 types of texture maps per model mesh:
    • Diffuse map: surface color and overall opacity
    • Normal map / height map: surface normals
    • Specular map: specular reflection color and sharpness
    • Emission map: additional light not affected by external light sources
  • Providing the diffuse color map is required, other maps are optional (a default map will be used if one is not specified).
  • Up to four light sources per object, plus an ambient light.
  • Model animation sequences can be triggered when a thing enters a particular state.

Version 2.0

  • model.weapon.* for player weapons (psprites).
  • Animation sequence looping.
  • Animation sequence priority control.
  • Rendering passes can be specified manually, per-mesh with GL state parameters.
  • Doomsday Script timelines.
  • Animated shader variables.
  • Fog.
  • Improved scalability, for instance dynamic atlases for larger sets of models.
  • Specifying a custom shader to be used for a model.

Upcoming features

These are planned for future releases:

  • Material opacity (in addition to opacity from the diffuse map).
  • Multiple model files representing a single object (if needed).
  • Up to four sets of texture coordinates (currently only one set of texture coordinates per mesh is supported).
  • More control over animation: explicit timelines per thing state; movement-based sequences (walking, running, standing).
modding/gl2_model_renderer.txt · Last modified: 2017-03-19 20:33 by skyjake