Skip to content

Allow 3D models to be instanced in the renderer #54

@Raelr

Description

@Raelr

Description

When repeating the use of certain 3D objects, we can improve performance and usability by allowing these objects to be instanced. This would allow multiple to be handled in a single draw call.

To enable this, we'd need to change our ModelRenderer and 3D model reading functions to the following:

  • Change the StaticMesh class to allow an 'instanced' configuration. This config will add a Mat4 transform instanced variable to the vertex attributes.
  • Change the VertexBuffer class to track partitions and bind to those partitions when needed. The reason for this is that we need to effectively split our vertex buffers into two parts - the instanced parts and the per-vertex parts. The instanced parts should be smaller and self-contained while the per-vertex parts will likely be much larger. When we bind the buffer, the buffer should be able to bind both parts of the vertex buffer for us.
  • Change the StaticMesh class to accept textures for sub-sections of the mesh where available. This should be configured per-submesh.
  • Change ModelRenderer to account for instanced meshes when drawing.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestrenderRelating to the engine's renderer

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions