Skip to content

Converting Shape Keys to Attributes for use in Geometry Nodes

00004707 edited this page Aug 10, 2023 · 6 revisions

In this example you will learn how to create an attribute that holds the position of vertices of a selected shape key.

The attribute will be used to apply the shape key using geometry nodes.

  1. Select a mesh with shape keys

    • To make the process less confusing, set all shape keys values to 0.

    blender_Z7GSOmfVKk

  2. Convert Shape Key to Vertex Attribute

    • Locate the Attributes menu in Properties panel

    blender_AtXgXOT9WP

    • Open the menu under the minus button, and select Create From Mesh Data

    blender_nUjmIWI9nI

  3. Select Data Source

    • In Data select the Position from Shape Key. It should be located in second column.

    blender_O80LdYblQ2

    The entries on this list are grouped by domain that they are stored in, and most of those groups are located in separate columns.

    Shape keys positions are stored in vertex domain, UV seams are stored in edge domain, and so on.

  4. Select the source Shape Key

    • In "Shape Key" select the shape key you would like to use and press OK

    blender_rVDVOjoPj1

    Batch convert To Attributes tickbox will convert all shape keys to multiple attributes with one click.

  5. A new attribute will be created

    • A new attribute will show up on the list, that holds the position of vertices when the shape key value is set to 1.0

    blender_Om3WwRzV7E

  6. Create a new geometry nodes setup with Set Position and Named Attribute nodes.

    blender_wkJJduDw40

  7. Select the new attribute

    • In Named Attribute node, select the new attribute by clicking on the box next to Name input.

    blender_kpMXD5wSyA

    • The output will change to Vector type.
  8. Plug in the Attribute output to the position node

    • The mesh will change it's shape as if the shape key value was set to 1.0

    blender_bzjN5PLcbi

  9. Your mesh should be deformed in same way as setting the shape key value to 1.0

blender_Wfi7nrwFWJ.mp4

By using Position Offset from Shape Key, you can create an attribute that can be used with Offset input of Set Position node instead.

This can be useful to mix multiple shape keys.

Limitations

Be aware of that the attribute will not update the positions if you change the shape key. The attribute grabs and stores the values at the time of creating it, so you will have to create a new attribute after updating the shape key.

However, if the name of attribute is the same as the old one, there will be no need to modify the geometry nodes setup.

Other uses

This technique can be applied to also create attributes that hold UV Seams, bevel weights and other data stored in meshes.

It also allows use of mesh data that is not yet available in Geometry Nodes and shader editor as a dedicated node.

Attributes can also be used in Shader Editor to create some effects. Here is an example with displacement input set to Position Offset from Shape Key attribute, rendered in Cycles.

blender_1a9SzOc4dE