[Work in progress]
(WARNING) The content discussed in this page is directly related to the **Mesh Layout** node. More information about the node can be found in its [[ /w/mutable/unreal-engine-4/user-documentation/nodes/mesh-layout/ | Node Reference page ]].
As told in the [[ /w/mutable/unreal-engine-4/user-documentation/basic-concepts/#texture-layouts | Basic Concepts page ]], in Mutable, UV layouts of every mesh can be separated and organized into blocks to achieve some rendering, optimization and organization benefits. This page explains three examples of usage with the **Mesh Layout** node.
(NOTE) The resulting Customizable Object of this example can be found in the [[ https://work.anticto.com/w/mutable/unreal-engine-4/examples/#village-demo | Village Demo ]] in //Content/HowTo/TextureLayout// named "TextureLayout_Object"
= Texture and Material merge
Mutable allows different meshes' textures to be merged if they share material. This example shows a simple Customizable Object with two Child Objects that either add and remove mesh parts and add and replace textures. The example consist of a yellow and black pillar which can be extended with small pink pillars on the side and a bigger blue base that also removes the original base.
== Assets
{F103299}
> The base object has its UVs ready to be organized in two blocks
{F103301}
> This accessory's UVs will form only one block
{F103303}
> This other accessory's UVs will consist on only one block that will replace a block from its parent
All these skeletal meshes share the same material with only a texture parameter that is the color texture map (shown in the middle of the previous images).
== Object Structure
The node graph of this example consist of a Base Object with two Child Objects. The Child Objects use Extend Material to add meshes and textures to the parent. The second Child Object also removes a mesh part from its parent. This last topic is explained in the next section.
{F103305}
> This is how the Node Graph looks like
== The Mesh Layout blocks
The [[ /w/mutable/unreal-engine-4/user-documentation/nodes/mesh-layout/ | Mesh Layout ]] node must be connected to the left connections in a Skeletal Mesh node, in the material that is going to be separated or set in blocks.
The node allows to set a grid resolution in which to create the blocks. The resolution of the base mesh's Mesh Layout will establish the resolution of all the child meshes of the same Customizable Object hierarchy.
In this example, the base mesh has a resolution of 2x2 and is organized in two blocks. These two blocks were strategically set as the mesh inside one of them will be entirely removed in a future customization.
{F103307}
> In this case, the original texture set in this mesh is 256x256 and the block resolution is 2x2. This means that any block unit of a child mesh will be 128x128.
The following image shows the resulting UV layout if no Child Object is active.
{F103311}
> Resulting UV layouts of each material can be displayed by clicking on the "UV" button in the Preview Instance Viewport tab in Mutable editor.
== Texture Merge
The first Child Object only extends the material of its parent. This means that its mesh is added to the base mesh and its texture is added to the base texture. The block resolution of this child's Mesh Layout is set to 1x1. This 1x1 block will be added to the base blocks.
{F103309}
> In this case, the original texture of this child mesh is 256x256, but as it is set in a 1x1 block, it will be resized to 128x128 when merged with the base object texture.
The following image shows the resulting UV layout with this Child Object active.
{F103313}
> The 1x1 block has been added to the empty spot.
(WARNING) When the number and size of blocks increases (as in the "Bandit_forRPG" character example) Mutable handles the distribution of the resulting merged blocks.
==
= Use blocks for mesh removal
Mutable allows mesh removal by selecting blocks set in their UV layout.
= Use blocks as masks
Several nodes in Mutable allow to select some parts of the mesh by selecting the needed blocks.