== Overview
This article explains several ways to use [[ https://mutable.games/ | Mutable ]] to remove unseen parts of meshes. The most common examples are the parts underneath cloth pieces from a character's body. In this case, some parts of a character's base body are removed when a shirt, trousers and boots are activated.
Each cloth piece is a Child Object of the body and has a different way to remove meshes.
(WARNING) All the remove mesh type of nodes need a material as reference from which they access to its related mesh. Most of them ask for a parent's material, which means they take it from a higher level in the nodes' hierarchy. If a child object shares the same material with its parent, the removal will only affect the parent's mesh. However, a child object can be affected by these nodes if it has its own material.
(WARNING) We recommend visiting the [[ mutable/unreal-engine-4/user-documentation/basic-concepts/ | Basic Concepts ]] page before start creating any Customizable Object.
= Using a Clipping Volume
This case explains how to remove the part of the body under a long sleeve shirt with a Clip Mesh With Mesh node. The method requires a third volume mesh that, when overlaid to the base body mesh, deletes any face that is entirely within it. Besides this, the mesh to be removed must have the same tag set in the Clip Mesh With Mesh node.
(NOTE) The resulting Customizable Object of this example can be found in the [[mutable/unreal-engine-4/examples/#village-demo | Village Demo ]] in //Content/HowTo/RemoveUnseen// named "RemoveUnseen_ResultExample"
{F86489}
> The clipping volume mesh removes any whole face located in its interior
(IMPORTANT) The clipping volume mesh must be a closed mesh in order to work.
(IMPORTANT) **Clip Mesh With Mesh** node only removes faces from Materials that have the tag assigned in its properties.
== Assets required
* One material asset or material instance of a base character without parameters
* One skeletal mesh of the character with one material slot only
* One material asset of a shirt without parameters
* One skeletal mesh of the shirt with one material slot only
* One skeletal mesh of a clipping volume that overlays the shirt’s one
(NOTE) The assets used in this example can be found in the [[ mutable/unreal-engine-4/examples/#village-demo | Village Demo ]] in //Content/HowTo/RemoveUnseen//
== Steps
1) The first step is to create a basic [[ mutable/unreal-engine-4/user-documentation/create-a-basic-customizable-object/ | Customizable Object]] asset with the **Base Object**, a **Material** node, and a **Skeletal Mesh**. Link all the connections of the same color.
{F86274}
> In this example, the **Customizable Object** asset is named "RemoveUnseen", the **Reference Skeletal** is "RemoveUnseen_BaseBody", the **Material** is called “RemoveUnseen_Body_M” and the **Skeletal Mesh** is the same as the **Reference Skeletal**’s one.
---
2) In this first example, a shirt has to be put on the base character removing the covered part of the character’s body mesh. Moreover, to enable or disable this piece of cloth altogether with the removal of the mesh, a **Group** has to be created.
Create a [[ mutable/unreal-engine-4/user-documentation/nodes/object-group/ | Group]] node from the “Children” connection of the **Base Object**.
{F86276}
---
3) At the Node Properties tab, with the **Group** node selected, write a name in the Group name sub-tab. The Group Type can be left by default in “Toggle”.
{F86278}
> In this case, the group’s name is “Clothes” so it is created to enclose multiple pieces later.
---
4) Create a [[ mutable/unreal-engine-4/user-documentation/nodes/child-object/ | Child Object]] node from the “Objects” connection of the **Group** node. This node permits creating a child asset for this first example.
{F86280}
---
5) In the Object Name sub-tab of the Node Properties tab, write the first piece of cloth’s name.
{F86282}
> In this example, the Object Name is “Shirt”.
---
6) The child object, the shirt, has its own material with its related textures included. For this reason, a new material has to come into play. From the “LOD 0” connection of the **Children Object** drag and drop to create a **Material** node.
{F86284}
---
7) In the Material sub-tab of the Node Properties tab, set the shirt’s material.
{F86286}
> In this case, the Material is “RemoveUnseen_Shirt_M
---
8) Create a **Skeletal Mesh** node and apply the shirt’s mesh on it.
{F86288}
> In this example, the Skeletal Mesh is “RemoveUnseen_Shirt”.
Link its “Unnamed Material Mesh” connection to the “Mesh”’ **Material** node’s one. With this connection, the child object is already created.
---
9) Once the child object is created, the objective of this exercise is to remove the mesh of the character’s body hidden under the shirt using a clipping volume method. Create a [[ mutable/unreal-engine-4/user-documentation/nodes/clip-mesh-mesh/ | Clip Mesh With Mesh]] node from the “LOD 0” connection of the **Child Object** node.
{F86290}
---
10) In the Node Properties tab, select the name of this very Customizable Object asset.
{F86292}
> In this case, the Customizable Object is “RemoveUnseen”.
(WARNING) The name selected here must be the actual name of the active Customizable Object that is being used.
After that, unfold the drop-down menu placed under the previous one and select the material that is wanted to be affected by the clipping.
{F86294}
> In this example, the material is “RemoveUnseen_Body_M”.
(WARNING) The connection between this node and the material or materials affected can be established as well with Tags. The Tag works as a label that has to be created in the active node and added to **Material** nodes to clip its related meshes.
---
11) Create a **Skeletal Mesh** node and, in its Node Properties tab, set the mesh of the clipping volume. This new mesh should overlay the shirt’s mesh volume and contain it inside its own.
{F86296}
> In this case, the skeletal mesh selected is “RemoveUnseen_Shirt_Clipping”.
Link the “Unnamed Material Mesh” connection of the **Skeletal Mesh** node to the **Clip Mesh With Mesh** node’s “Clip Mesh” connection.
{F86298}
---
12) Check that the Source Graph tab looks similar to the image below.
{F86300}
---
13) Compile. In the Preview Instance Properties tab, a toggle button should appear with the child object’s name as the title.
{F86302}
> In this example, the button’s name is “Shirt”.
Enable the “Shirt” button. Now, verify that not only the shirt is applied to the character but also that underneath its mesh the body has been removed.
{F86304}
(WARNING) Change the view mode button on the Preview Instance Viewport tab to change to “Wireframe” when required.
{F86306}
= Remove with vertex-precision
This case explains how to remove the part of the body under long trousers with a Remove Mesh node. This node requires a third mesh that is compared to the mesh to be removed from. The coincident faces are removed.
(IMPORTANT) **Remove Mesh** node only removes the whole faces that are in the same exact location as the mesh that has to be removed from. Other faces are ignored.
{F86491}
> The removal mesh must be a duplicate of the part of the mesh that must be removed
== Assets required
* One material asset of a pair of trousers without parameters
* One skeletal mesh of the preview pair of trousers
* One skeletal mesh of the character’s body removing part
== Steps
(WARNING) Start this second example where the previous one finishes.
1) In this second example, a second child object is to be created. From the “Objects” connection of the **Group** node create a new **Child Object** node.
{F86313}
---
2) At the Node Properties tab, with the **Child Object** node selected, write a name in the Object name sub-tab. Leave by default the other options.
{F86315}
> In this example, the child object is a pair of trousers, so the Object’s Name is “Trousers”.
---
3) This child object uses its own material too, so a **Material** node is required. From the “LOD 0” connection of the **Child Object** node create a **Material** node.
{F86317}
---
4) In the Material sub-tab of the Node Properties tab, set the trousers’ own material. This material doesn’t have any parameters but encloses its own textures.
{F86319}
> In this case, the material selected is “RemoveUnseen_Trousers_M”.
---
5) Create a **Skeletal Mesh** node and, in its Node Properties tab, assign the trousers’ mesh.
{F86321}
> In this example, the skeletal mesh chosen is “RemoveUnseen_Trousers”.
Afterward, link the “meshes” connections of the **Skeletal Mesh** node and the **Material** one between them.
{F86323}
---
6) The second child object is already created. Now, a different method of removing the unseen mesh is required. From the “LOD 0” connection of the **Child Object** node, create a [[ mutable/unreal-engine-4/user-documentation/nodes/remove-mesh/ | Remove Mesh]] node. This node removes coincident identical faces, normally a part of a duplicate of the base mesh.
{F86325}
---
7) In the Node Properties tab, select the parent’s material (the character’s base body one) from which a part of its related mesh is to be removed.
{F86327}
> In this example, the parent's material is “RemoveUnseen_Body_M”.
---
8) Create a **Skeletal Mesh** node and, in its Node Properties tab, select the mesh of the part of the character’s body to remove. This mesh should be an exact copy of the character’s body but well delimited to coincide with the covered area when the trousers are enabled.
{F168184}
> In this case, the skeletal name is “RemoveUnseen_Trousers_Remove”.
Finally link the “Unnamed Material Mesh” connection of the **Skeletal Mesh** to the “Remove Mesh” one of the **Remove Mesh** node.
{F86331}
---
9) Check that the Source Graph looks similar to the image below. The first two child objects are created with two different ways of removing the unseen body’s mesh.
{F102231}
(WARNING) Remember that creating **Comments** to frame or enclose each example (child asset) can help organize better the nodes.
---
10) Compile and check that the new toggle button works well on the character. Verify that the unseen mesh has disappeared as well.
{F86335}
{F86432}
= Plane Clipping method and Remove Mesh
This case explains two mesh removal actions: a pair of boots remove the feet underneath them and also clips the long trousers with a Clip Morph Mesh node. This node allows the boots to cut the trousers and morph them to fit inside the boots.
(IMPORTANT) **Clip Morph Mesh** node only removes whole faces from Materials that have the tag assigned in its properties.
== Assets required
* One material asset of a pair of boots without parameters
* One skeletal mesh of the preview pair of boots
* One skeletal mesh of the character’s body removing part (feet)
== Steps
(WARNING) This example begins where the previous one finished.
1) In this last example, a pair of boots is to be put on the base character. So, a new child asset must be created.
Create a **Child Object** from the **Group** node’s “Objects” connection.
{F102233}
---
2) In the Node Properties tab, write a name for this new child object.
{F86363}
> In this case, the Object Name is “Boots”.
---
3) As this new object has its own material, like all the previous ones, a new **Material** node is needed. Drag and drop from the “LOD 0” of the new **Child Object** node and create a **Material** node.
{F86365}
---
4) Select the **Material** node and, in the Node Properties tab, choose the suitable material for this child object. This material already includes color and normal textures.
{F86367}
> In this case, the Material applied is “RemoveUnseen_Boots_M”.
---
5) Finally, to end with the creation of this last child object, the boot’s mesh is needed. Create a **Skeletal Mesh** node and set up a suitable mesh in its Node Properties tab.
{F86369}
> In this example, the Skeletal Mesh is “RemoveUnseen_Boots”.
Don’t forget to link the “meshes” connections of the **Skeletal Mesh** and **Material** nodes.
{F86371}
(WARNING) To move on to the next step it is recommended to compile and enable the boots.
---
6) In this step, the third removal mesh method is introduced. The** Clip Morph Mesh** node uses a plane from which the mesh is clipped and moreover it can be deformed to suit better its purpose. In this case, the node is needed to remove part of the trousers’ mesh to simulate they are inside the boots when both are enabled at the same time. Create [[ mutable/unreal-engine-4/user-documentation/nodes/clip-morph-mesh/ | Clip Morph Mesh]] from the “LOD 0” connection of the **Child Object**.
{F86373}
---
7) Select the previous node and, in the Bone Name sub-tab of the Node Properties tab, choose a reference bone from the character’s skeleton. This reference acts as the clipping plane origin.
{F86375}
> In this case, as the plane should be placed at the very top of the boots, the nearest leg’s bone is selected, the “mixamorig_RightLeg”.
Afterward, create and name a Tag by clicking the “+” icon. This Tag is used to designate which material or materials are to be affected by this clipping.
{F86377}
> In this example, the name is “Right Boot”.
At the Preview Instance Viewport tab, a plane and a red ellipse should appear placed on the right leg. Now, in the Mesh Clip Parameters sub-tab of the Node Properties tab, move the plane and place it on the top of the boot by clicking and dragging inside the Z button or writing values. Finally, modify the Morph Length if wanted and the Ellipse’s Radius to reshape the cut and the mesh surrounding it.
{F168200}
---
8) After creating the Tag in the **Clip Morph Mesh** node, it has to be added to the **Material** node that is meant to receive its effect. Select the trouser’s **Material** node.
{F102235}
In the Node Properties tab, locate the Tags sub-tab and click the “+” icon to create a Tag. Write the same name as the Tag created in the **Clip Morph Mesh** node.
{F86383}
Now, the trousers’ material is connected to the **Clip Morph Mesh** node, but the clipping would only be effective when both child assets, trousers and boots, are enabled.
---
9) Create another **Clip Morph Mesh** node, this time for the left leg, and connect it to the boot’s **Child Object**’s “LOD 0”.
{F86385}
---
10) This time, in the Node Properties tab, choose the same bone as in the previous **Clip Morph Mesh** node but for the left leg.
{F86387}
> In this case, the bone selected is “mixamorig_LeftLeg”.
Add a Tag and name it.
{F86389}
> In this example, the name is “Left Boot”.
Change the values in the Mesh Clip Parameters sub-tab to be like in the right leg’s node.
{F168198}
---
11) Now, add the left leg’s tag in the trousers’ **Material** node. Select the node and add a new tag. Write exactly the same name as in the left leg’s **Clip Morph Mesh** node.
{F86393}
---
12) To finish the example, the character’s feet should be removed when the boots are enabled. To accomplish it, a **Remove Mesh** node is needed, like the one used in the second example.
Create a **Remove Mesh** node from the “LOD 0” connection of the **Child Object**.
{F86395}
---
13) Once in its Node Properties tab, select the parent material from which the mesh removal has to be done.
{F86397}
> In this case, the parent’s material is “RemoveUnseen_Body_M”
---
14) Finally, create a **Skeletal Mesh** node, and in the Node Properties tab, select the character body part’s mesh to be removed.
{F86399}
> In this example, as the objective is to add boots, the Seketal Mesh selected is “RemoveUnseen_Boots_Remove”.
Remember to link the “meshes” connections of the **Skeletal Mesh** node and the **Remove Mesh** one.
---
15) Check that the Source Graph is similar to the image below.
{F86474}
---
16) Compile. Check that the “Boots” toggle button is displayed in the Preview Instance Properties.
Enable both “Boots” and “Trousers”. Verify that, at the Preview Instance Viewport, the character is displayed with the trousers inside the boots and the result is satisfying.
{F86476}
Check finally that when the boots are enabled, the feet’s mesh disappears.
{F86477}
= Remove body part's blocks
This example features a Remove Mesh Blocks node that allows selecting which part of a character's mesh is wanted to be removed by using the layout mesh blocks. This is an effortless and very flexible method of removal if the layout mesh is separated into logical parts taking into account the needs in advance.
(NOTE) The resulting Customizable Object of this example can be found in the [[mutable/unreal-engine-4/examples/#village-demo | Village Demo ]] in //Content/HowTo/RemoveUnseen// named "RemoveBlocks_ResultExample"
(WARNING) This is a very simple case created to show how the blocks' removal works. This example only uses the assets needed to create a basic customizable object.
== Steps
1) The first step is to create a basic [[ mutable/unreal-engine-4/user-documentation/create-a-basic-customizable-object/ | Customizable Object]] asset with the **Base Object**, a **Material** node, and a **Skeletal Mesh**. Link all the connections of the same color.
{F113671}
> In this example, the **Customizable Object** asset is named "RemoveBlocks", the **Reference Skeletal** is "RemoveBlocks_BaseBody", the **Material** is called “RemoveBlocks_M” and the **Skeletal Mesh** is the same as the **Reference Skeletal**’s one.
---
2) Before using this removal method, the different character's mesh parts should be enclosed into blocks so they can work separately. Create a [[mutable/unreal-engine-4/user-documentation/nodes/mesh-layout/ | Mesh Layout]] node and link it to the "Unnamed Material Layout" connection of the **Skeletal Mesh** node.
{F113673}
(WARNING) The most important thing to keep in mind when using this removal method is that a well-thought-out UV layout should be created beforehand in which each part can be entirely removed by selecting the block that encloses it. If the objective is to create a very flexible and adaptable system of removal, the best thing to do is to separate the mesh into small logical parts so the selection can be more controlled.
---
3) Select the **Mesh Layout** node and create the number of blocks needed to enclose each part of the character’s mesh layout in the Node Properties tab.
{F107387}
> In this example, the grid proportion required is 16x16.
---
4) As explained previously, most "remove mesh" types of nodes need a parent material from which to access the mesh. To accomplish this premise, the removal node should be connected to a Child Object. From the "Children" connection of the **Base Object** node create a **Child Object** node.
{F113675}
---
5) In the Node Properties tab, write a name for this child object.
{F106790}
> In this case, the name is "Remove Body Parts".
---
6) Finally, create a [[ mutable/unreal-engine-4/user-documentation/nodes/remove-mesh-blocks/ | Remove Mesh Blocks]] node and connect it to the "LOD 0" of the **Child Object** node.
{F113677}
---
7) In the Node Properties tab, with the **Remove Mesh Blocks** node selected, a Parent sub-tab with a drop-down menu is displayed and an empty space below is saved for its related mesh layout.
Select the parent's material on which the removal has to be performed and automatically, its mesh layout appears.
{F107379}
Choose the layout blocks that are wanted to be removed.
{F107381}
> In this example, the blocks selected are the ones related to the character's thighs.
(IMPORTANT) A **Remove Mesh Blocks** node doesn't work without a ** Mesh Layout** node connected to its parent's mesh.
---
8) Compile. In the Preview Instance Viewport tab, the character should appear without the part of the mesh whose blocks were selected.
{F107385}