Render chunk
A render chunk, or simply "chunk", is the encapsulated data required to issue a single* draw call. This includes a material, a vertex buffer, an index buffer and a small amount of metadata. A 3D mesh is comprised of a number of render chunks. The render chunk's material may be shared with other render chunks in the same mesh or other meshes in the same asset.
Render chunks are a data packet (ie. noun) rather than an action on the GPU (ie. verb). The act of submitting a render chunk to the GPU for rendering is known as a draw call.
There are numerous cases where the use of a single render chunk may technically result in multiple draw calls; eg.
- where the chunk's parent mesh is present multiple times in the scene.
- where a multi-pass material is used (in Trainz, this is currently limited to a depth prepass used for some materials, the details of which are trainz-version specific).
- for shadow rendering.
- when the scene is rendered from multiple views (for example, for true reflection rendering).
There are also some cases where multiple render chunks may be rendered in a single draw call. This can only occur in cases where the chunks all share a single material:
- mesh stitching
- hardware instancing
- import-time or load-time optimization of the chunks' parent mesh.
Chunks inherit animation from their parent mesh. This is shared between the chunks of the same mesh instance, but not between separate mesh instances, even if they represent the same mesh file on disk.