Replies: 6 comments 15 replies
-
First step is to collect some hard data. I need to run a couple of different meshes through the converter and collect some statistics on their DAG levels, meshlets per level, meshlet occupancy, etc. I also need to try the new attribute-aware simplification on meshoptimizer main. |
Beta Was this translation helpful? Give feedback.
-
Worth noting in general that you will never have fully balanced workgroups with 64v/64t: on grid-like meshes a 8x4 regular quad grid (8x4 * 2 = 64 triangles) uses 9*5=45 vertices; on the flip side, if you have a lot of disjointed triangles, you will have a lot of vertices but few triangles, e.g. worst case is 21 triangles with 3 unique vertices each => 63 vertices. That's fine in the sense that it's a common property of any clustered renderer to have an imbalance somewhere, just noting that if you expect 64v/64t then that's not going to happen very often. See https://zeux.io/2023/01/16/meshlet-size-tradeoffs/ But otherwise I think it's critical to understand where the issue happens and why; I would probably recommend starting with a reasonably simple mesh that should not have a problem with getting down to very few root clusters and trying to debug the steps that get stuck early. Could also try repeating that with Nanite in UE to understand what data it generates. |
Beta Was this translation helpful? Give feedback.
-
One other note: currently, I'd like to improve this in the future somehow but I'm not sure how 😅 meanwhile I'd note that Nanite uses METIS to recursively split clusters in half until reaching a size close to the max required. It should be simple to try that approach in Bevy; my long term goal is for METIS to be unnecessary in Nanite like pipelines but it's valuable to understand if that's the core part of the issue and to what extent this is better. |
Beta Was this translation helpful? Give feedback.
-
@zeux some questions:
|
Beta Was this translation helpful? Give feedback.
-
@JMS55 I did some more tests in a separate repo. The README has most of what I found interesting. Adding some extended info below. EDIT 06-09-2024: Added stats the other border vertex definition (vertex shared between meshlets instead of based only on geometry). The model's I've choose greatly influence results. Overall problems:
With these 2 issues, I don't think it's possible to create a good DAG. The only solution seems to be randomly removing triangles (!). At higher DAG levels all meshlets are disconnected single triangles. In the logs directory I've added console dumps with stats. These are the same models as I've originally wrote month ago - Jinx (
Ofc. it might sound stupid. You get perfect DAG if you randomly remove triangles! But what are the alternatives? PS. DO NOT LOOK INTO quadric.ts. |
Beta Was this translation helpful? Give feedback.
-
@zeux an issue I've ran into: I keep running into Might be nice to have an override for that. I'm going to try and patch meshopt with a higher limit to allow me to test my code. |
Beta Was this translation helpful? Give feedback.
-
Followup to bevyengine/bevy#14660
In Bevy's Nanite-style renderer, I've run into a couple problems:
Nanite was obviously able to get to much better results, and there are 3 major parts:
For the first two, I use meshoptimizer. The latter I do myself with METIS.
I'm opening this thread to hopefully improve my mesh -> meshlet mesh building code. Maybe meshoptimizer can improve in some way, and my code almost certainly so.
Beta Was this translation helpful? Give feedback.
All reactions