Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Instanced drawing for repeated models

Abierto
#327 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
18/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
csharp

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.
Lenguaje dominante
C#
Estrellas
1
Forks
1
Merge medio
1 h 57 min
PR fusionados (30 d)
36

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de MASS4ORG/Turian

Todos los issues de MASS4ORG/Turian

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.