Page MenuHomeAnticto

Mutable for Unreal Engine 4 | Add Shape Variations with Mesh Morphs
Updated 129 Days AgoPublic

Overview

This article explains how to create four examples of Customizable Objects involving morph targets, from the simplest to the most complex one. The first one consists in applying a permanent mesh variation (protruding ears) without any parameter, the second example uses a Child Object to modify the nose and creates a toggle to enable or disable the morph, the third one recovers the ear morph but controlling the grade of rotation through a slider and the last example mixes two head morphs applied on the same character’s mesh using graph curves to control their gradual values.

We recommend visiting the Basic Concepts page before start creating any Customizable Object.

Add a simple shape variation

This is the simplest example of a mesh morph in a Customizable Object. An “ear rotated” morph is proposed as a single and constant result.

The resulting Customizable Object of this example can be found in the Village Demo in Content/Examples/HowTo/ShapeVariations named "ShapeVariations"

Assets required

  • One material asset or material instance of a character without parameters (textures included)
  • One skeletal mesh of the character that has mesh morphs and with the previous material applied (one material, no parameters)
The assets used in this example can be found in the Village Demo in Content/HowTo/ShapeVariations

Steps

  1. The first step is to create a basic Customizable Object asset with a Base Object, a Material, and a Skeletal Mesh.

In this example, the Customizable Object asset is named "Shape Variations", the Reference Skeletal is "ShapeVariations_BaseBody", the Material is called “ShapeVariations_M” and the Skeletal Mesh is the same as the Reference Skeletal’s one.


  1. Click and drag from the “Unnamed Material Mesh” connection of the Skeletal Mesh node to create a Mesh Morph node.


  1. With the Mesh Morph node selected, click the “Morph Target” sub tab’s drop-down menu in the Graph Node Properties tab. It opens a list of all the mesh morphs available for this skeletal mesh. Select one.

In this example, the “Ear_rotation” is the chosen morph.


  1. As the objective is to variate a part of the mesh directly and without intermediate results, the "Factor" needed to be applied is a constant value. From the "Factor” connection of the Mesh Morph node create a Float Constant node.


  1. With this last node selected, change or maintain the “Value” sub-tab to “1,0” in the Graph Node Properties tab.

The “Value” ranges from 0 to 1. In this example “1” is set to have the full morph modification.

  1. Link the “Mesh” connection of the Mesh Morph node to the “Mesh” one of the Material node.


  1. Compile. The character must look like this in the Preview Instance Properties tab:

Before compiling

After compiling

Child Object morph variation

The result is similar to the “Add a simple shape variation” example but, in this case, the objective is to add a morph using a Child Object and enclose it in a group to enable or disable it through a toggle button. For creating this example, a prominent nose is proposed as a morph.

Steps

  1. Create a Group node from the “Children” connection of the Base Object node. The Group node allows the end-user to enable or disable the morph through a toggle button or a drop-down menu of options after compiling.


  1. Name the Group node at the Graph Node Properties tab and select a type of choice menu in the “Group Type” sub-tab.

In this example, the Group’s name is “Nose Variations” and the Group Type is “Toggle”.


  1. Drag and drop from the “Objects” connection of the Group node to create a Child Object node.


  1. Name the Child Object node in the Graph Node Properties tab.

In this example, the Child Object is called “Nose Pepper”.


  1. Create a Morph Material node. Link its “Material” connection to the “LOD 0” one of the Child Object node. This node permits choosing the parent's material and accessing the mesh morphs of the skeletal mesh that has this material assigned.


  1. At the Graph Node Properties, and with the Morph Material node selected, choose the parent’s material in the Parent sub-tab. Then, in the Morph Target sub-tab, click in the drop-down menu and choose the morph preferred.

In this example, the Parent’s material is “ShapeVariations_M” and the Morph Target selected is “Nose_pepper”.


  1. Compile. In the Preview Instance Properties tab, the toggle menu of the Child Object should be displayed like in the image below.

Then, check the Preview Instance Viewport tab that no morph is already displayed. The character shouldn’t have changed before enabling the toggle button:

Now, click on the toggle button and the morph should be applied:

The first constant example can also be done by following this second example's steps disregarding the Group node step.

Control the amount of a morph with a slider

In this example, the mesh morph is used as the final shape of a gradual modification of the mesh. The variation between this morph and the default mesh offers a great number of modifications. The same exercise of the ears’ rotation is proposed but with all the intermediate shapes available by moving a slider.

Steps

This example begins where the previous one finished.
  1. Check that the Source Graph tab is similar to this image below.

Create Comment boxes if wanted to arrange and organize the nodes in the Source Graph tab.

  1. As in the first example, create a Mesh Morph node from the “Unnamed Material mesh” connection of the Skeletal Mesh node. Then, at the Graph Node Properties tab select the preferred morph in the Morph Target sub-tab.

In this example the morph selected is “Ear_rotation” again.


  1. The objective is to have a slider to control the intermediate values of the Mesh Morph node. In this case the Float Parameter is the required node. Create a Float Parameter node dragging from the “Factor” connection of the Mesh Morph node.


  1. Select the Float Parameter node and change the Default Value number if wanted in the Graph Node Properties tab. Write a name in the Parameter Name sub-tab.

In this example, the Default Value is 0, so by default the morph is not applied at all. The Parameter Name is “Ear Rotation”.


  1. Link the “Mesh” connection of the Mesh Morph node to the “Mesh” one of the Material node.


  1. Compile. In the Preview Instance Properties tab, a new slider must appear next to the Float Parameter’s name.


  1. Check that the ears rotate when moving the slider.

Mix two morph targets with a curve-based slider

In this last example, a Curve asset is used to mix two head morphs (an elongated and a blunt one) with the base shape. This asset permits combining multiple morphs through curves that can be reshaped, if wanted, to avoid its linearity. Moreover, a slider takes part in this case to control the Curve asset's horizontal axis: the graduation starting from the first morph, passing through the base mesh and arriving at the other morph.

Assets required

  • One curve asset

Steps

This example begins where the previous one finished.
  1. Check that the Source Graph tab is similar to this image below.


  1. Create a new Mesh Morph node from the “Mesh” connection of the previous Mesh Morph node (Ear Rotation Example). Unlink the “Mesh” connection of the Mesh Morph node and the Material node.

To accumulate morphs, the Mesh Morph nodes must be serially connected to each other between the Skeletal Mesh node and the Material one.

  1. At the Graph Node Properties, select a morph in the Morph Target sub-tab.

In this example, the Morph Target applied is “Head_crushed”.


  1. From the previous Mesh Morph node’s “Mesh” connection, create another Mesh Morph node.


  1. At the Graph Node Properties, select another morph in the Morph Target sub-tab.

In this example, the Morph Target applied is “Head_eggShaped”.


  1. As the Mesh Morph’s transformation must be based on curves’ values to control the variations, a Curve node is required. Create a Curve node.


  1. At the Graph Node Properties, select a curve in the Curve Asset sub-tab.

In this example, the Curve Asset selected is “ShapeVariations_Curve”.

Click the Curve Asset thumbnail to get inside the asset and modify its curves or other properties if wanted.

In this example, two curve's channels are used: “R” linked to the “Head Crushed” morph and “G”, to the “Head Egg Shape” one. These curves begin with the first morph at 100% (the other one at 0%), pass through a 0% of both morphs in which the base mesh is shown and, finally, end with the last morph at 100% (the first one at 0%). The horizontal axis's values are the ones that gradually go from one morph to another passing through the base mesh in the middle. Moreover, the shape of the curves describes the behavior of the progression, so in this example, the variation is slightly more abrupt in the middle of the graph than in the two ends.


  1. Link the “Curve 0” connection of the Curve node to the “Factor” one of the first Mesh Morph node (Head_crushed) created in this example. Do the same with the “Curve 1” connection and the second Mesh Morph node (Head_eggShape).
When linking a connection of a Curve node to a Mesh Morph node, the curve's channel that represents it gets related to the morph. The first connection is equivalent to the first channel in the Curve Asset and it proceeds equally with the following ones.

In this example, only two channels are used.


  1. Create a Float Parameter node from the “Input” connection of the Curve node. This node creates the controller slider based on the horizontal axis's values of the Curve asset.


  1. At the Graph Node Properties, and with the Float Parameter node selected, write a name in the Parameter Name sub-tab and change the Default Value if wanted.

In this example, the Parameter Name is “Head Shape” and the Default Value is “0.5” since it is the value in which the influence of the two morphs is zero.


  1. Finally, link the “Mesh” connection of the last Mesh Morph node to the “Mesh” one of the Material node. Now, all the Mesh Morphs are connected to the default mesh and the shape variation can be controlled by sliders.


  1. Compile. The new "Head Shape" slider has been added. The Preview Instance Properties should look similar to this:


  1. After compiling, the character shouldn’t have changed at all (the Float Parameter's default value is 0.5, in which both morphs are at 0%). When moving the slider to each end, the head’s shape should variate. In the in-between values of the parameter, intermediate morph values should be obtained as well.

In this picture, the “Head Shape” slider is set by default at 0.5, so the mesh is the base one.

In this picture, the “Head Shape” slider is set at 0, so the “Head_Crushed” morph has been fully applied.

In this picture, the “Head Shape” slider is set at 1, so the “Head_EggShape” morph has been fully applied.

Last Author
laura
Last Edited
May 23 2020, 11:29 AM

Event Timeline

laura created this object.Mar 19 2020, 11:42 AM
laura created this object with visibility "Public (No Login Required)".
laura created this object with edit policy "All Users".
laura edited the content of this document. (Show Details)Mar 23 2020, 4:45 PM
laura edited the content of this document. (Show Details)Mar 23 2020, 5:07 PM
laura edited the content of this document. (Show Details)
laura published a new version of this document.
marc edited the content of this document. (Show Details)Mar 23 2020, 10:07 PM
laura edited the content of this document. (Show Details)Mar 24 2020, 12:58 PM
laura edited the content of this document. (Show Details)Mar 24 2020, 6:52 PM
laura edited the content of this document. (Show Details)Mar 25 2020, 10:06 AM
laura edited the content of this document. (Show Details)Mar 25 2020, 10:09 AM
laura edited the content of this document. (Show Details)
marc edited the content of this document. (Show Details)Mar 25 2020, 4:36 PM
marc edited the content of this document. (Show Details)Mar 25 2020, 4:40 PM
marc edited the content of this document. (Show Details)Mar 25 2020, 4:47 PM
marc edited the content of this document. (Show Details)
marc edited the content of this document. (Show Details)Mar 25 2020, 5:03 PM
marc edited the content of this document. (Show Details)
marc edited the content of this document. (Show Details)Mar 25 2020, 5:06 PM
marc edited the content of this document. (Show Details)Mar 25 2020, 5:10 PM
laura edited the content of this document. (Show Details)Mar 25 2020, 6:43 PM
laura edited the content of this document. (Show Details)Mar 26 2020, 10:34 AM
laura edited the content of this document. (Show Details)Mar 26 2020, 12:02 PM
laura published a new version of this document.
laura edited the content of this document. (Show Details)Mar 26 2020, 12:51 PM
laura edited the content of this document. (Show Details)Mar 31 2020, 12:19 PM
laura edited the content of this document. (Show Details)Apr 2 2020, 9:59 AM
laura edited the content of this document. (Show Details)May 18 2020, 6:41 PM
laura edited the content of this document. (Show Details)May 20 2020, 6:32 PM
laura edited the content of this document. (Show Details)May 21 2020, 11:38 AM
laura edited the content of this document. (Show Details)May 21 2020, 11:41 AM
laura edited the content of this document. (Show Details)May 21 2020, 1:21 PM
laura edited the content of this document. (Show Details)May 21 2020, 2:25 PM
laura edited the content of this document. (Show Details)May 21 2020, 3:41 PM
laura edited the content of this document. (Show Details)May 23 2020, 11:29 AM