Hey team! I need your help:)
I’ve ported the full PBR shader (yeah the big monster) to WGSL
This was quite of a massive work. I also included port of nme to wgsl!
If you have time and you are currently targetting webgpu for your apps/games, can you please take that branch and test if everything work?
Port PBR material to WGSL by deltakosh · Pull Request #15333 · BabylonJS/Babylon.js (github.com)
By default the PBR materials will go to the wgsl code path. (you can still turn that off with a parameter in the material constructor)
Thanks for the help!!
26 Likes
Awesome! Does this mean that material plugins will support wgsl as well?
2 Likes
to be fair, I believe material plugin should work directly (as long as you provide wgsl and not glsl)
1 Like
cc @roland : For now I’m forcing the PBR material of the GreasedLines to be GLSL only:
Port PBR and Background materials to WGSL by deltakosh · Pull Request #15333 · BabylonJS/Babylon.js (github.com)
This will need you to also port your shaders to pure wgsl to support both (later :))
1 Like
pjoe
August 1, 2024, 8:59am
6
FWIW: looks to be working well:
(Had a .glb lying around from playing with Halo MCC model export)
2 Likes
pjoe
August 2, 2024, 4:45pm
8
Btw. I had a wasm version of naga (wgpu shader transpiler) some way back. Lemme know if that would be useful.
You can see it sort of working here: https://wasm-shaders.pjohnsen.com/
Yeah unfortunately (or fortunately depending on how you think about it), I’m doing the conversion manually to ensure max perf
2 Likes
I think this one messed up the PBRCustomMaterial
Cannot read properties of undefined (reading ‘replace’)
I can not seem to repro with your playground @aWeirdo
1 Like
pjoe
August 5, 2024, 7:06pm
13
Hmm just tried the GI samples in 7.19, they are giving WGSL errors, maybe from this?
Here is the error I see (Chrome, Windows):
Error while parsing WGSL: :232:1 error: invalid character found
#extension GL_EXT_draw_buffers : require
^
- While validating [ShaderModuleDescriptor "fragment"]
- While calling [Device "BabylonWebGPUDevice0"].CreateShaderModule([ShaderModuleDescriptor "fragment"]).
Whilst @Deltakosh is on a path to migrate it all, there are still material plugins not migrated which currently breaks in your playground.
You can workaround it by forcing GLSL in the playground https://playground.babylonjs.com/#VW8IG3#84
Sorry for the inconvenient.
1 Like
@sebavan & @Deltakosh
As of 7.19.0 i can’t repro either, must have been fixed already
2 Likes
pjoe
August 6, 2024, 2:38pm
16
The GI one still fails for me when using WebGPU/WGSL on 7.19.1
NOTE: @sebavan ’s version forces using GLSL on WebGPU
Here is a version with ForceGLSL=false
: https://playground.babylonjs.com/#VW8IG3#85
It must use the flag because the GI code is generating GLSL so it must be compiled