Blendshape

From UMAWiki
Jump to: navigation, search

Blendshapes (also called Morphs) are supported in the UMA system. They can be authored and imported into Unity on a FBX. Then when creating a slot they will transfer over and be stored on the slot to be accessible when the slot is part of the final UMA.

Workflow

Example Slot Data Asset with Blend Shape data on it.

1) Create mesh with blendshape or morph data on it. Refer to the modeling packaged used for how to do this.

2) Import your FBX in to unity. Make sure the "Import Blendshapes" option is checked on the FBX.

3) Build a slot like normal.

4) Verify in the slot data that the blendshape exists.


Usage

There are two main uses for blendshapes. Animation and as another form of mesh customization.

Animation

On umaData exists the function:

public void SetBlendShape(string name, float weight)

Typically, this would be called from the DynamicCharacterAvatar, for example:

avatar.umaData.SetBlendShape("example", 0.5f)

A script could be set to cycle through (0-1) a blendshape over time to create an animation.

Customization

The other use is for character customization and tying in with the DNA system. This is currently an advanced manual process.

1) Create a new DynamicDnaAsset and add the name of the DNA sliders you want to affect your various blendshapes.

2) Create a MorphSetDnaAsset. Found by right mouse clicking, Create->UMA->DNA->Morph Set DNA. Add an entry for each DNA name and associate it with a blendshape name.

3) Create an empty gameobject, put a BlendShapeDnaConverterBehaviour script on it. Make it a prefab and remove the gameobject.

4) Add the DynamicDnaAsset and the MorphSetDnaAsset to the converter's fields.

5) For each race you want this DNA associated with, go to the raceData and add this converter to it's list of converters.

You will now be able to set the value of the DNA associated with a blendshape and UMA will attempt to set that blendshape automatically if it is found.

See Also

https://docs.unity3d.com/Manual/BlendShapes.html