Advertisement

How to render two different meshlets at two different LODs in a Mesh Shader?

Started by February 08, 2024 11:01 AM
6 comments, last by giuseppe7 9 months, 2 weeks ago

Hey guys,

I would like to know how to render two different meshlet at two different LOD values.

So, for example, I render the meshletA at LOD1 and I render the mesheletB at LOD2.

Please let me know if this is possible, and if so, how to set it up.

giuseppe7 said:
So, for example, I render the meshletA at LOD1 and I render the mesheletB at LOD2.

I assume your problem is cracks because the boundary between both patches does not match?

The easiest solution seems what Nanite is doing, avoiding the issue by moving boundaries to the interior of a lower detailed patch.

There are a few resources on this, including talks from Epic.
Recently i saw this blog post about the topic (but did not read it):

https://blog.traverseresearch.nl/creating-a-directed-acyclic-graph-from-a-mesh-1329e57286e5

Advertisement

@JoeJ Many thanks for the replay. My goal is to implement a lodding algorithm cluster based both for static and skeletal mesh. I tought to do the LOD selection on the Mesh Shader but I don't know if it's possible. In this way I would do all operations (mesh clustering, cluster culling and LOD selection) on the GPU. So, I would like to know if I can do a per-meshelet LOD selection on a Mesh Shader.

I listened the Epic talk about Nanite. Essentialy they subdivide the mesh in cluster (using METIS library) and then a set of cluster is grouped together. Each clusters that belongs to the same grups must selects the same LOD, this avoid cracks.

The link that you shared me seams very useful. Using a “Nanite aproach” is a path that I could follow to implement my algorithm.

giuseppe7 said:
I tought to do the LOD selection on the Mesh Shader but I don't know if it's possible.

I wonder if selecting a very low LOD would then underutilize the GPU, e.g. if it's only 4 vertices only 4 threads would have work.
Maybe this problem could be minimized with the task shader, but even then it's probably limited to a small number of LODs, probably the highest ones.

But i guess it's always needed to do selection in advance, likely by traversing a hierarchy data structure with CS. Afaik, Epic uses a BVH, also useful for occlusion culling.
But the selection is than a cut through the tree. By caching the cut a traversal can be avoided. We just decide for each node in the cut of the last frame if we go a single level up or down.
Maybe this step can be done by the mesh / task shader then, but idk much about mesh shaders yet.

Edit:
In case you have not thought of it, any such fine grained LOD solution has the problem it can't be ray traced.
If we change just a single patch of geometry on a model, we need to rebuild its BVH for tracing from scratch.
And because subtle changes will happen to any mesh in our scene most likely each frame, we would have to rebuild BVH for the entire scene each frame.

I guess that's a big reason why we don't see any competition for Nanite yet. Probably people wait until the API designers fix their broken RT APIs, which are actually useless if we want to have progress on the LOD problem. >:(

I believe what you are looking for is possible, but not from the same invocation of a mesh shader instance. Take a look at this article from AMD that goes describes how Mesh Shaders work on GCN hardware and see if it shed more light on your issue.
https://gpuopen.com/learn/mesh_shaders/mesh_shaders-from_vertex_shader_to_mesh_shader/

@JoeJ I could do the LOD selection using a DAG and I could this in parallel using the GPU (as Epic said in his talk about Nanite). About ray tracing, I won't apply any ray tracinng in my algorithm, so isn't a problem to worry about.

Advertisement

@cgrant Many thanks for the reply, I will see the link that you sent to me

This topic is closed to new replies.

Advertisement