Skip to content

Custom shader not applied when glTF has no material #13073

@javagl

Description

@javagl

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions