feat(instances): Order each mesh's instances by a key

Ouverte
#44 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
48/100
Type d'issue
Fonctionnalité
Clarté
Plutôt claire
Activité
Active
Stack technique
react-native, typescript

Piste de recherche

Start with the kind API where visible and pose are defined, then trace the compute pass cull and its sorter to see how mesh instance lists are recorded. Inspect how cameras.current is exposed to description functions and identify the point where culling requires cull: true. The change is complete when an order hook returns a per-instance number, visible rows are sorted ascending within each mesh, and existing behavior remains unchanged for kinds without the hook; the depth-only and cross-mesh sorting questions still need resolution.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

A renderer draws each mesh's instances in row order. With blend: 'translucent' in a description without passes.accumulation and passes.revealage, a far instance can cover a near one of the same mesh. A program can order its own drawings before record, but not the instances inside one mesh's draw.

Add an order hook to the kind, beside visible and pose: a 'use gpu' function that returns a number per instance. Culling renderers list each mesh's visible rows by that number, ascending, in every description, sorting with sorter in the compute pass cull already records into. The hook reads the description's camera through cameras.current, so back to front is one line:

order: (instance) => {
  'use gpu';
  return -std.distance(cameras.current.$.position, instance.position);
},

The same hook covers front to back for opaque overdraw, or a fixed layer per world-space UI panel. The kit names no sort modes. It requires cull: true, as from and to do, and kinds without it keep today's lists and allocate nothing new. Meshes keep drawing in the order they gained instances, so the order holds within a mesh, not across meshes or drawings.

Open: whether depth-only descriptions such as shadows skip the sort, and whether one u32 key with the mesh in its high bits sorts every mesh's stretch of the list in one pass.

Langage dominant
TypeScript
Étoiles
69
Forks
7
Merge moyen
1 h 48 min
PR mergées (30 j)
15

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de software-mansion/typegpu-kit

Toutes les issues de software-mansion/typegpu-kit

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.