Road-hog123

Render Order

Rendering is the process of converting the 3D world into the 2D image that is displayed on your monitor. The 3D world is made up of triangles which are drawn to this image one after the other—the order in which they are drawn is the render order.

Triangles are drawn in batches called "draw calls" where all the triangles have the same material—each material in a mesh file is drawn in order, triangles with the same material remain in the same order as in the mesh file. Each mesh file is rendered in the order that it is defined within an asset's config file. The assets are then rendered in creation order (the first vehicle to be spawned is rendered first, and so on) within the following groups:

  1. Skybox, sun, moon, stars, etc.
  2. Objects with rendertype presurface
  3. Terrain
  4. Objects with rendertype surface
  5. Splines
  6. Objects with rendertype on_surface
  7. Wet road effects (both puddles and moisture)
  8. Objects with rendertype 1
  9. Objects with rendertype 2 (normal objects)
  10. Objects with rendertype 3
  11. AI vehicles, and the user vehicle when it is viewed from outside
  12. Objects with rendertype 4
  13. User vehicle from the driver or passenger view

You can choose which rendertype an object uses with the [rendertype] keyword.

As each triangle is drawn to the screen one after the other, the game also keeps track of how far away from the camera each screen pixel is, such that triangles that are further away from the camera don't overwrite and appear on top of surfaces that are closer. This works great for opaque surfaces, but not as well for translucent surfaces which prevent the drawing of further-away triangles that are rendered after them even if the triangles should be visible through the translucent surface. For this reason it is important to consider the order that triangles are rendered, and is why this wiki page exists.

Triangles are translucent when their material is rendered with "blend" alpha (see [matl_alpha]), regardless of the opacity of the texture at any given location.

When to use which rendertype