Indirect Drawing sample using WGSL

I recently learned about Indirect Drawing in WebGPU and tried it out in Babylon.js.
This sample draws multiple shapes and materials (coins and gems) in a single GPU-driven pass, and on top of that the physics simulation also runs in WGSL.
There used to be a bug where the objects would inexplicably drift to one side after falling, but I fixed it with the help of Claude Opus 4.8.
(WebGPU only — please select WebGPU in the Playground.)

babylonjswebgpuindirectdrawing004

8 Likes

It seems to maintain 60 FPS even with 100,000 coins falling.

6 Likes

OMG this is insane!

1 Like