teassy000 / vulkage

Other
0 stars 0 forks source link

[meshlet] use seamless lod for each instance as Nanite-style #4

Open teassy000 opened 4 months ago

teassy000 commented 4 months ago

currently, the meshlet's lod follows the mesh, meaning each mesh instance has its own lod. I would like to generate lod for each meshlet in the runtime. This causes the seams and makes the material discontinue.

here's some resource that could help:

Improve support for cluster simplification https://github.com/zeux/meshoptimizer/pull/704

Cluster-based rendering, Nanite-style (200M triangles in 1ms) https://www.youtube.com/watch?v=7JEHPvSGaX8

Multiresolution structures for interactive visualization of very large 3D datasets https://d-nb.info/997062789/34

teassy000 commented 1 week ago

this is done by integrating the meshoptimizer's nanite demo with some modifications. For now, I use the original pipeline which is pretty neat for the traditional lod selection method: [select LOD] --> [get cluster data range] --> [dispatch mesh(task) shaders]. With the seamless lod method, the [dispatch mesh(task) shaders] took all the clusters in the mesh, then do the cut in the task shader stage, which led to a lot of overhead, and even worse in the late draw stage( almost 99% of them will return).

In the MatrixScene with default camera sets: the original pipeline is around 700fps and the new one is 400fps. Here's some optimization that might help:

  1. add a compute stage and do the dag cut before the task stage.
  2. find a better way to do the partition instead of metis.
teassy000 commented 6 days ago
  1. add a compute stage and do the dag cut before the task stage.

here's some info may helps:

bazhenovc: Esoterica new renderer - mesh rendering pipeline https://www.youtube.com/watch?v=8gwPw1fySMU

jms55: Virtual Geometry in Bevy 0.15 https://jms55.github.io/posts/2024-11-14-virtual-geometry-bevy-0-15/

they seems use a compute shader do the work that I do in the task shader.