Skip to content
This repository was archived by the owner on Jan 4, 2022. It is now read-only.

Rendering

Porrith Suong edited this page Jan 15, 2021 · 1 revision

UGUIDOTS renders by reading all Canvas entities and iterating through each submesh. The OrthographicRenderSystem internally stores a CommandBuffer and links the CommandBuffer with Orthographic Render Feature.

When the system is destroyed, the internal CommandBuffer is disposed.

During runtime (update loop), the OrthographicRenderSystem iterates through each Canvas entity and fetches the

  • SharedMesh
    • Stores the mesh data needed to actual render the canvas
  • MaterialPropertyBatch
    • Stores material property blocks per submesh
  • DynamicBuffer
    • Stores a dynamic array of entities which links to the common texture associated with the submesh and the common material associated with the submesh

Example

Let's say we had 3 submeshes, which represent 3 images with different textures.

  • Canvas
    1. Image 1 - square texture
    2. Image 2 - circle texture
    3. Image 3 - triangle texture

The Canvas entity will have a MaterialPropertyBatch of 3 elements and a DynamicBuffer<SubmeshKeyElement> with potentially 3 pairs of entities linked.

The MaterialPropertyBatch is a managed component which stores an array of Material Property Blocks.

The MaterialPropertyBatch would look like so:

MaterialPropertyBatch

  • MaterialPropertyBlock 1
  • MaterialPropertyBlock 2
  • MaterialPropertyBlock 3

And the DynamicBuffer<SubmeshKeyElement> would like so:

DynamicBuffer

  1. SubmeshKeyElement
    • Texture 1
    • Material 1
  2. SubmeshKeyElement
    • Texture 2
    • Material 2
  3. SubmeshKeyElement
    • Texture 3
    • Material 3

Depending on the submesh level, the OrthographicRenderSystem will fetch the corresponding MaterialPropertyBlock and SubmeshKeyElement, to fetch the texture and material to apply to the MaterialPropertyBlock.

Clone this wiki locally