Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meshlet tracking issue #11518

Open
JMS55 opened this issue Jan 24, 2024 · 2 comments
Open

Meshlet tracking issue #11518

JMS55 opened this issue Jan 24, 2024 · 2 comments
Assignees
Labels
A-Rendering Drawing game state to the screen C-Enhancement A new feature

Comments

@JMS55
Copy link
Contributor

JMS55 commented Jan 24, 2024

Runtime performance:

  • 🔥 Cleanup resource_manager.rs and visibility_buffer_raster_node.rs, improve CPU performance, and add more GPU debug group labels
  • 🔥 Fix all occlusion culling bugs
  • Persistent culling

Runtime performance (low priority):

  • Write a heuristic for software vs hardware raster selection
  • Upload instance uniforms only for changed entities (and see if we can shrink the size too)
  • Single set of passes to render all views at once
  • Instance culling
  • Compute-based material shading
  • Variable-rate shading (compute shader based)
  • LOD bias for shadow views (2 pixels of error instead of 1)

DAG building:

  • Manual vertex locking
  • Larger meshlet groups
  • Vertex attribute-aware simplification
  • Multithread parts of MeshletMesh::from_mesh() maybe? (could use rayon)

Compression:

  • 🔥Implicit tangents
  • 🔥Shrink struct Meshlet bytes
  • 🔥Per-meshlet compressed vertex positions and octahedral encoded normals
  • Meshlet triangle compression
  • Streaming
  • Disk-oriented compression

Tooling:

  • Debug stats + visualizations
  • Asset processor for mesh -> meshlet mesh conversion
  • Docs
@JMS55 JMS55 added C-Enhancement A new feature A-Rendering Drawing game state to the screen labels Jan 24, 2024
@JMS55 JMS55 added this to the 0.14 milestone Jan 24, 2024
@JMS55 JMS55 self-assigned this Jan 24, 2024
github-merge-queue bot pushed a commit that referenced this issue Mar 25, 2024
# Objective
- Implements a more efficient, GPU-driven
(#1342) rendering pipeline
based on meshlets.
- Meshes are split into small clusters of triangles called meshlets,
each of which acts as a mini index buffer into the larger mesh data.
Meshlets can be compressed, streamed, culled, and batched much more
efficiently than monolithic meshes.


![image](https://github.com/bevyengine/bevy/assets/47158642/cb2aaad0-7a9a-4e14-93b0-15d4e895b26a)

![image](https://github.com/bevyengine/bevy/assets/47158642/7534035b-1eb7-4278-9b99-5322e4401715)

# Misc
* Future work: #11518
* Nanite reference:
https://advances.realtimerendering.com/s2021/Karis_Nanite_SIGGRAPH_Advances_2021_final.pdf
Two pass occlusion culling explained very well:
https://medium.com/@mil_kru/two-pass-occlusion-culling-4100edcad501

---------

Co-authored-by: Ricky Taylor <rickytaylor26@gmail.com>
Co-authored-by: vero <email@atlasdostal.com>
Co-authored-by: François <mockersf@gmail.com>
Co-authored-by: atlas dostal <rodol@rivalrebels.com>
@JMS55 JMS55 changed the title Meshlet followup tracking issue Meshlet tracking issue Apr 5, 2024
github-merge-queue bot pushed a commit that referenced this issue Apr 23, 2024
Adds a basic level of detail system to meshlets. An extremely brief
summary is as follows:
* In `from_mesh.rs`, once we've built the first level of clusters, we
group clusters, simplify the new mega-clusters, and then split the
simplified groups back into regular sized clusters. Repeat several times
(ideally until you can't anymore). This forms a directed acyclic graph
(DAG), where the children are the meshlets from the previous level, and
the parents are the more simplified versions of their children. The leaf
nodes are meshlets formed from the original mesh.
* In `cull_meshlets.wgsl`, each cluster selects whether to render or not
based on the LOD bounding sphere (different than the culling bounding
sphere) of the current meshlet, the LOD bounding sphere of its parent
(the meshlet group from simplification), and the simplification error
relative to its children of both the current meshlet and its parent
meshlet. This kind of breaks two pass occlusion culling, which will be
fixed in a future PR by using an HZB from the previous frame to get the
initial list of occluders.

Many, _many_ improvements to be done in the future
#11518, not least of which is
code quality and speed. I don't even expect this to work on many types
of input meshes. This is just a basic implementation/draft for
collaboration.

Arguable how much we want to do in this PR, I'll leave that up to
maintainers. I've erred on the side of "as basic as possible".

References:
* Slides 27-77 (video available on youtube)
https://advances.realtimerendering.com/s2021/Karis_Nanite_SIGGRAPH_Advances_2021_final.pdf
*
https://blog.traverseresearch.nl/creating-a-directed-acyclic-graph-from-a-mesh-1329e57286e5
*
https://jglrxavpok.github.io/2024/01/19/recreating-nanite-lod-generation.html,
https://jglrxavpok.github.io/2024/03/12/recreating-nanite-faster-lod-generation.html,
https://jglrxavpok.github.io/2024/04/02/recreating-nanite-runtime-lod-selection.html,
and https://github.com/jglrxavpok/Carrot
*
https://github.com/gents83/INOX/tree/master/crates/plugins/binarizer/src
* https://cs418.cs.illinois.edu/website/text/nanite.html


![image](https://github.com/bevyengine/bevy/assets/47158642/e40bff9b-7d0c-4a19-a3cc-2aad24965977)

![image](https://github.com/bevyengine/bevy/assets/47158642/442c7da3-7761-4da7-9acd-37f15dd13e26)

---------

Co-authored-by: Ricky Taylor <rickytaylor26@gmail.com>
Co-authored-by: vero <email@atlasdostal.com>
Co-authored-by: François <mockersf@gmail.com>
Co-authored-by: atlas dostal <rodol@rivalrebels.com>
Co-authored-by: Patrick Walton <pcwalton@mimiga.net>
@JMS55 JMS55 removed this from the 0.14 milestone May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Enhancement A new feature
Projects
None yet
Development

No branches or pull requests

2 participants
@JMS55 and others