Skip to content

Chunk rendering performance improvements #202

@Moneyl

Description

@Moneyl

Chunk rendering perf is really bad in the C# port right now. Can take 3-7ms to render a large building. Some ideas on how to improve it:

  • Try uploading per object constants all at once into an SSBO. Use the firstInstance field on CmdDrawIndexed to pass the index of the object. This will eliminate all the push constant commands and just have a single SSBO upload per frame.
  • Try uploading per object constants into a big buffer all at once
  • See if using a UBO for per object constants instead of push constants is faster.
  • Try limiting UBO/push constant changes. This actually hurt performance when I first tried it with push constants.
  • Look into occlusion culling. Chunks are made of many small pieces and most are occluded at any given moment when the building is undamaged. Should make this approach very effective I believe. I believe some approaches use bounding boxes. It looks like the cchk files already have bboxes for each subpiece. Will want to make sure that's the case first by porting the box/line/other primitive render functions.
    • Could use gpu based culling by doing basic render pass that draws bboxes of each chunk subpiece
    • Or maybe build a quadtree/octree or something from the subpiece bboxes and do a bunch of raycasts from the camera. Measure how much time this takes the CPU on a make with many chunks to see if its feasible.
  • Look into frustum culling. Will be more help when dealing with multiple buildings.
  • Read articles about right efficient vulkan renderers to see if I'm shooting myself in the foot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions