rtengine/docs/NOTES_renderer_v3.md

1.7 KiB

GFX/Renderer v3

  • Build around draw indirect
  • Keep many meshlets together in one large buffer
  • Meshlet: 128 triangles
  • Mesh: List of meshlets
  • Do compute based culling per VIEW
  • Each View gets a list of mesh-refs (expanded to meshlet refs), and associated transforms
  • Optional:
    • These are, by default, permanent, allowing us to build a efficient bvh.
    • Mark nodes as deleted, only collapse once the entire subtree is deleted.

Draw/Materials:

  • Culling outputs tri-idx, meshlet for every pixel (For hardware that supports it, this could use raytracing)
  • Meshlet refers to a (sub)material (via index)
  • Per tile, create a list of draw indirect commands and a read-back buffer containing the (sub-)material index for each draw (+ total nr of draws)
  • CPU loops over materials, issueing draw indirect calls upon material changes
  • The ref to a sub-material may be made via meshlet -> material and view type -> sub-material

Some (most) sub-materials could draw into a gbuffer.

SubMaterialData is baked into structs containing constants and/or bindless ids. Kept in one huge buffer SubMaterial:

  • Data
  • PSO Material:
  • View Type -> SubMaterial

Frame Graph - Each view is a pass. Can re-use existing?

Renderer API:

  • CreateMesh(data) -> MeshRef
  • InstantiateMesh(MeshRef) -> MeshRef
  • CreateView(type) -> View
  • AddToView(MeshRef, Transform, Material) -> InstanceRef
  • RemoveFromView(InstanceRef)
  • UpdateInView(InstanceRef, Transform, Material)
  • SetViewCamera(View, Camera)
  • RenderView(View)
  • CreateMaterial(NumSubMaterials, SubMaterialInfo*) -> Material
  • CreateTexture(Format, W, H, NumMipLevels, Optional<InitialData*>) -> Texture
  • EnqueueTextureUpdate(Texture, MipLevel, NewData)