Hi team,
In need of a PBR splatmap/terrain material, i found this one,
made by @Raggar i believe.
It works in webgl1 & 2, but fails to compile in webgpu.
Errors are very generic.
Unable to compile effect:
…shader code block
Error: GLSL compilation failed
Trying next fallback.
Unable to compile effect:
…shader code block
Any ideas?
You can’t pass samplers to functions in WebGPU (when converting glsl to wgsl). A simple way to deal with it is to tag a function with #define inline to instruct Babylon to inline the function:
1 Like
Thanks! this fixes the compilation errors, but the results are now different 
I was cleaning up a bit in the code earlier.
This is because the inlining process isn’t foolproof, it’s string-based and quite simple.
In this case, there’s a collision with variable names after inlining: there’s a uv1 variable (as well as uv2/uv3) declared in the main function and a uv1 variable (uv2/uv3) in the col function.
To solve the problem, you can rename uv1/uv2/uv3 in the col function:
1 Like
Brilliant, thanks so much!
Shaders still make my mind hurt 
Here’s the so-far cleaned up version for anyone interested in the future.
I simplified it, made it static (4x4) 16 texture support with a (2x2) 4-in-1 splatMap.