3D Procedural Texture Rendering

I have an issue with 3D ProceduralTextures where the uniforms layer and layerNum usually (but not always) result in WebGL: INVALID_OPERATION: uniform1i: location is not from the associated program. This doesn’t happen in WebGPU and this is why the “3D Procedural Textures” visualization test is currently disabled for WebGPU.
Here’s a Playground. When you run it, you will sometimes see the error (and the output will be wrong) and sometimes everything will be fine.

I think the WebGL error itself may occur if the shader doesn’t reference the uniform (or if it’s been optimized away) so I’m less concerned about that and more with the non-deterministic output.

I can’t take a look right now as I’m still on vacation, but disabling parallel compilation of shaders (https://playground.babylonjs.com/#AYZY4Q#22) causes the error to occur 100% of the time. This might help those who tackle the problem.

Oh, good to know. Thank you for looking at this while on vacation.

It looks like this is an issue with the PostProcess shader and not the ProceduralTexture. If I remove the float uniform, the uniform1f error goes away and the uniform1i one remains.

Bind the sampler to the PP after the procedural texture has been generated.

2 Likes

Ah, yes, good call, @roland.
I think that solves the issue.

2 Likes