Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Instanced drawing for repeated models

Aperta
#327 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
18/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
csharp

Direzione di ricerca

Start with Example 12 and the render path around RenderList.Collect and BuildDraws, then reproduce the 10k and 50k measurements described here and in #64. Prototype persistent per-(mesh, material) instance buffers for Example 12's boxes, wire membership to structural change notifications, and keep material-override or per-object-shader cases as individual draws. Done means draw preparation drops by an order of magnitude at 10k boxes with identical output and the GPU tests still green; #104, #325, #326 and the flat-soa-snapshot-pattern design are the background to read first.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

c:graphics p:medium size:L t:enhancement

Current State

GPU instancing (#104) batches identical mesh and material draws at submission. On the CPU, the shipped Example 12 still prepares 9,996 of its 10,001 boxes as individual draw items. Every frame, the renderer walks all 10k models (RenderList.Collect, ~0.9 ms) and prepares one draw each (BuildDraws, ~1.55 ms), then rebuilds the instance data. After the physics fixes, this is the render-side scaling wall: its cost grows linearly with the object count, even when nothing but poses changed.

Proposal

  • Keep persistent per-batch instance buffers for repeated (mesh, material) models. Membership is maintained by structural change notifications, the way the scene index tracks cameras.
  • Per frame, write only the transforms (ideally a bulk copy from the transform snapshot in the Tier 2 SoA issue) and cull per batch.
  • Feed debris-tier bodies (Tier 3) into the same buffers straight from the physics pose arrays.

Tasks

  • Measure the current per-draw CPU cost at 10k and 50k (Collect, BuildDraws, instance upload) in the exported game.
  • Prototype persistent batches for Example 12's boxes and compare against today's path, including culling and material overrides.
  • Define when a model leaves a batch (unique material override, per-object shader data) and keep those as individual draws.

Acceptance Criteria

  • At 10k repeated boxes, CPU draw preparation falls by an order of magnitude, with identical images (the GPU tests stay green).
  • Steady-state preparation allocates nothing, and per-object CPU cost scales linearly or better.

Related

  • #104 (GPU instancing at submission)
  • #64 (the measurements)
  • #325 (transform SoA, Tier 2) and #326 (two-tier entities, Tier 3)
  • Shared mass4-wiki design: flat-soa-snapshot-pattern (flat snapshots, stable indices, identity maps, structural change notifications, double buffering and compaction), aligned with MASS4ORG/Guinevere#120.
Lingua principale
C#
Stelle
1
Fork
1
Merge medio
1h 46m
PR unite (30g)
41

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di MASS4ORG/Turian

Tutte le issue di MASS4ORG/Turian

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.