Skip to content
Armory 3D Community Channel edited this page Mar 24, 2023 · 3 revisions

Shape Keys

Enabling Shape Keys

To enable shape keys export in Armory, set the Shape Key option in the Armory render path settings to On. Shape keys will not be exported if this option is set to Off https://i.postimg.cc/cJb9ZW1h/shapekey.png

An introductory video into shape keys for Armory 3D Using shape keys in Armory 3D

Shape key usage

Armory supports a maximum of 32 shape keys per object. Currently only Relative shape keys are supported. Individual shape keys can be muted in Blender. Muted shape keys are not exported. Shape keys can also be used with displacement and skinning.

Since Armory uses texture based shape keys, shape keys with large vertex displacements relative to the base mesh might reduce the accuracy of the result. It is therefore preferable to use shape keys that does not cause large vertex displacements relative to the base mesh.

Note: Objects with and without shape keys should not share a same material.

At runtime, shape keys can be set using both Haxe script and Logic nodes.

Haxe:

var mesh = cast(object, MeshObject);
mesh.morphTarget.setMorphValue("Key 1", 0.75);

Logic Nodes:

Use the Set Object Shape Key node to set the shape key value.

Shape Key Animation:

Simple shape key animations can be achieved by tweening the shape key values at runtime through Haxe script or using a Tween Float logic node.

Shape key implementation

Armory supports shape keys or morph targets through vertex shaders. At export, the shape keys are baked to a texture and stored in the MorphTargets folder in the project folder. The texture is read at runtime along a dedicated UV channel UVMap_shape_key to morph the vertices. Shape key weights/ values are passed in as uniforms to the vertex shader. The resulting mesh is a sum of all shape keys just like in Blender.

Clone this wiki locally