I use blender to generate a very simple cube, assign it a base color and a blend shape that shrinks the cube in one dimension. After these, I save the cube as a gltf file. Then, in gltf viewer powered by three.js (e.g., https://gltf-viewer.donmccurdy.com), dragging on the blend shape will change the “color” of the cube.
This seems odd. I’m pretty new to this space. Is this a bug or a feature?
I’m attaching the blender python script, the generated gltf file as well as a video clip for the color changing effect.
import bpy cube = bpy.data.objects['Cube'] mat = cube.data.materials mat.use_nodes = True mat.node_tree.nodes['Principled BSDF'].inputs.default_value = (0.1, 0.2, 0.3, 1) sk_basis = cube.shape_key_add(name='Basis') sk_basis.interpolation = 'KEY_LINEAR' sk = cube.shape_key_add(name='Key') sk.interpolation = 'KEY_LINEAR' for i in range(4): sk.data[i * 2 + 1].co.z = -1 for i in range(4): sk.data[i * 2].co.z = -1
gltf file: Dropbox - 1.glb - Simplify your life