Devlog #2: Exploring Rendering Methods


In the previous log, I used the simplest way to create chunk meshes: adding vertices and triangles directly into a mesh, then rendering them with a MeshFilter. Unity, however, provides more advanced rendering approaches worth exploring:

✦ Graphics.DrawMeshInstanced

  • Renders multiple instances using a list of TRS matrices (Transform–Rotation–Scale).
  • Limitation: only 1023 instances per draw call, so larger meshes require more draw calls.

✦ Graphics.DrawMeshInstancedIndirect

  • Similar to DrawMeshInstanced, but can render an unlimited number of instances in a single call.
  • Supports compute shader culling (frustum, backface, occlusion).

🔹 Why render by chunk?

I experimented with different batching strategies and found that processing TRS matrices per chunk is far more efficient than handling them all in a single thread. Plus, splitting the work across multiple threads gave a noticeable performance boost.

🔹 Challenges with Instanced Rendering

Switching to instance rendering came with some issues:

  • Shader Graph incompatibility – Shader Graph doesn’t support per-instance textures, so I had to move to custom HLSL shaders.

  • Data transfer bottleneck – Sending a large amount of TRS data from CPU → GPU every frame caused a severe bottleneck. This can’t be multithreaded, can’t be asynchronous and must happen on the main thread. Because of this, performance actually dropped in large scenes.

🔹 Current solution

I rolled back from Graphics.DrawMeshInstancedIndirect to a more stable approach: Graphics.DrawMesh per frame (instead of using MeshFilter). Surprisingly, this performed much better than expected, giving me a solid baseline to continue building on. And also, I can totally use Shader Graph to visualize my shader.

Leave a comment

Log in with itch.io to leave a comment.