cesium icon indicating copy to clipboard operation
cesium copied to clipboard

Custom shader not applied when glTF has no material

Open javagl opened this issue 3 weeks ago • 1 comments

What happened?

When a glTF does not have an (explicit) material (meaning that it uses the default material), then a CustomShader that is applied to the tileset that contains that glTF does not have an effect.

Here is an archive that contains two tilesets and glTFs, once without a material, and once with a material, and a sandcastle with a custom shader, to illustrate the effect.

Cesium CesiumJS issue 13073 Custom Shader not applied for glTF without material 2025-12-03.zip

I also noticed some crashes when trying to define a vertex shader in cases like this. Depending on where exactly the issue will be addressed, a dedicated test for a glTF without a material and a custom shader that defines a vertex shader should be included in the testing plan.

Reproduction steps

Serve the contents of the ZIP archive on localhost, and run the Sandcastle from the ZIP file. For the tileset that uses the glTF without the material, the custom shader is not applied. For the tileset that uses the glTF with the material, the custom shader is applied. (This can be toggled by commenting one line in/out in the sandcastle)

Sandcastle example

See archive

Environment

Browser: N/A CesiumJS Version: 1.136.0 Operating System: N/A

javagl avatar Dec 03 '25 15:12 javagl

An aside, as pointed out by @mzschwartz5 internally: It might be worth trying out whether the custom shader works when the REPLACE_MATERIAL mode is used (instead of the default MODIY_MATERIAL). I'd still consider the current behavior to be a bug, but it may help to narrow down the reason, and maybe help to find a solution.

javagl avatar Dec 03 '25 16:12 javagl