Mesh shaders - opinions

Hello!

TL;DR: Mesh Shaders are powerful and very flexible and enable developers to make stunning visuals. What is your opinion about them?

I had an opportunity to attend the amazing lecture by Radosław Paszkowski at Digital Dragons 2024 regarding Mesh Shaders and it got me hooked so much. Mesh Shaders are in simple words allowing to process batches of vertices, so simple geometries simultaneously and allowing a lot of visually stunning stuff to be made easily.

This is a relatively new technology, coming to our attention for ~4-5 years now.

There is a shift of thinking between “traditional” pipeline, so vertex and pixel/fragment shaders to Mesh Shaders, but it enables to for example create Tesselation effects way easier (without tesselation shaders). All made out of complex, simple or even empty mesh data. Additionally, meshlets enables amazing culling options.

Imagine you can create geometries procedurally, animate them, for example making acres of grass out of spline data only for each blade, no geometry. Or making interactive snow, where you can modify the geometry of the simplest mesh. Or making complex dissolution animations, not only visual, but really modifying the mesh easily.

Alan Wake 2 is the most famous game utilising them. It was a shock that it required graphics card supporting them to work and difference in performance on technology not supporting it is unbearable.

UE Nanite is of course also utilising Mesh Shaders already to some degree.

Of course it enables a ton of possibilities and performance optimisation, but has caveats. Most important is that it’s a new technology and it’s barely yet adopted, both in software (experimental APIs, vendor specific, lack of debugging tools) and in hardware (now only PCs with Nvidia Turing or AMD RDNA2) and it takes some time for it to be popular or become a standard (which I believe it will become nevertheless) and the second is that it’s way more complex and thus harder to understand.

It’s also not adopted yet on web and mobile afaik, I found an issue on webGPU (Mesh shader support · Issue #3015 · gpuweb/gpuweb · GitHub)

What are your opinions on it? Do you find a place for it in future of Defold’s development?

I think that the short answer is yes, they look really interesting and would/could be a good fit for defold. I haven’t really done anything interesting with mesh shaders yet, but it’s on my radar. However, there are quite a bit of other functionality I’d like to get in first. My somewhat informal roadmap on things I have in the pipe is something like this:

  • instancing (engine done, editor pending)
  • GPU skinning w instance support (not started, but somewhat easy once instancing is in)
  • compute shaders (engine more or less done, very little editor work involved)
  • SSBO support - basically GPU mapped defold buffer api (engine working but needs design)
  • shader pipeline rewrite - simplification of current pipeline and modernization of built in shaders (ie es3/glsl140 by default)
  • WebGPU (started, but not much progress)
  • DX12 (60-ish % done)

… so yeah, a few things in the pipe, but I’d be interested in looking at shaders and perhaps open up the renderer / graphics adapters for extensions, similar to what we have now for native extensions and see if something like mesh shaders would be a good fit for that.

8 Likes