Hi there, I trying to make 3D sprite, with animations (as Doom-like), but it doesn’t work. I trying to do in Blender through a mix shader and export it in glTF, but Blender can’t export material animations. So how can it be done?
glTF format cannot handle animating texture coordinates, so it cannot really be used to hold a sprite sheet.
If you want to make a sprite sheet, then my recommendation is to use Castle Game Engine sprite sheets, with our built-in sprite sheet editor: Sprite Sheets | Manual | Castle Game Engine . See also the “2D game” template for “New Project” from the editor. Alternatively, you can use any sprite sheet creation tool that outputs to Starling or Cocos2D sprite sheet format.
Sprite sheets created this way can be loaded into TCastleScene and are fully useful in 3D too, exactly to make sprite animations like in classic Doom / Duke3d games. You can add TCastleBillboard
behavior to make them always oriented toward the camera. The engine demo examples/creature_behaviors
shows this, with the animated werewolf from a sprite sheet placed in the middle of normal 3D level.
omg thank you very much, it’s suits me perfectly, it works even better than in Godot and UE, thank you
P.S. so if glTF can’t handle animating texture coordinates, how works this? GitHub - ux3d/clip2gltf2: Creates from an animation strip a glTF
Oh, nice, they specify what they use in their README –
This mode uses the optional feature to morph texture coordinates in glTF 2.0: 3.7.2.2. Morph Targets
Linking to glTF spec that indeed says:
Client implementations MAY optionally support morphed
TEXCOORD_n
and/orCOLOR_n
attributes.
I stand corrected then – it is possible in glTF then, and we shall handle it in CGE then at some point, we want perfect glTF support.
( Though, to make it work in your case, I guess Blender would also need to be able to output texture coordinate morphing to glTF – I do not know can Blender do it. But since it is useful and suggested by glTF spec, presumably it can be added to Blender exporter, if it’s not there yet. )