You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
KHR_materials_variants is a ratified glTF extension that allows defining different material variants for meshes. The extension defines a set of 'variant names' that can be activated. For each mesh primitive, the extension defines the material that should be used when a certain variant is activated.
It should be possible to extract the information about material variants from a glTF asset, and select the active material variant in CesiumJS, switching the material/textures at runtime.
Related:
An older issue that describes the goal of dynamically changing textures: Support ability to dynamically change a 3D model's texture #5094
This already summarizes some possible approaches, and has some references to the KHR_materials_variants extension. Some of the discussion there is a bit out-dated, though (as it refers to older versions and implementations), and was not targeted at explicitly supporting KHR_materials_variants
The first step would be to transport the information about the KHR_materials_variants extension through the Model.fromGltf loading process. This may already raise some tricky low-level questions (e.g. whether the textures should be loaded immediately, or only when a certain material variant is activated), but should be doable
Based on that, one could expose the information about the material variants on an API level. Clients should be able to do basic things like
in a sandcastle. (Eventually, there might even be a UI for that)
Support for material variants on a tileset level:
The issue in cesium-native describes a concept for storing material variants information on the level of a tileset. The summary is:
The tileset JSON contains metadata that includes an array of strings with the TILESET_MATERIALS_VARIANTS_NAMES semantic
These strings are the material variant names that are expected to be present in all glTF assets that are used as the tile content in this tileset
Setting a certain "active" material variant on the level of the tileset will activate this variant in all glTF tile contents that are currently loaded for that tileset
The text was updated successfully, but these errors were encountered:
tl;dr:
KHR_materials_variants is a ratified glTF extension that allows defining different material variants for meshes. The extension defines a set of 'variant names' that can be activated. For each mesh primitive, the extension defines the material that should be used when a certain variant is activated.
It should be possible to extract the information about material variants from a glTF asset, and select the active material variant in CesiumJS, switching the material/textures at runtime.
Related:
This already summarizes some possible approaches, and has some references to the
KHR_materials_variants
extension. Some of the discussion there is a bit out-dated, though (as it refers to older versions and implementations), and was not targeted at explicitly supportingKHR_materials_variants
cesium-native
: Support forKHR_materials_variants
incesium-native
and implementations cesium-native#676This referred to support of
KHR_materials_variants
incesium-native
on the level of the glTF files, and on the level of tilesets (more on that below).The first step would be to transport the information about the
KHR_materials_variants
extension through theModel.fromGltf
loading process. This may already raise some tricky low-level questions (e.g. whether the textures should be loaded immediately, or only when a certain material variant is activated), but should be doableBased on that, one could expose the information about the material variants on an API level. Clients should be able to do basic things like
in a sandcastle. (Eventually, there might even be a UI for that)
Support for material variants on a tileset level:
The issue in
cesium-native
describes a concept for storing material variants information on the level of a tileset. The summary is:TILESET_MATERIALS_VARIANTS_NAMES
semanticThe text was updated successfully, but these errors were encountered: