Texture Layouts - anticto/Mutable-Documentation GitHub Wiki
As introduced in the Basic Concepts page , UV layouts of every mesh can be managed by Mutable to optimize its use. They can be separated and organized into blocks to achieve some rendering, optimization and organization benefits. This page explains three examples of what it can do.
Texture and Mesh Section merge
Mutable allows the textures of different meshes to be merged if they share material. This example shows a simple Customizable Object with a Child Object that adds a mesh and its texture to a base one. The example consists of a yellow and black pillar which can be extended with small pink pillars on the side.
Assets
The base object has its UVs ready to be organized in two blocks
This accessory's UVs will form only one block
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 a Child Object. The Child Object uses an Extend Mesh Section modifier to add a mesh fragment with its texture to the base mesh.
The UV layout settings
In the properties tab of the the Skeletal Mesh Node , it 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.
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.
Resulting UV layouts of each mesh section can be displayed by clicking on the "UV" button in the Preview Instance Viewport tab in Mutable editor.
Texture Merge
The Extend Mesh modifier extends the mesh sections it is applied to, based on its tags (see Tags and Modifiers). This means that its mesh is added to the modified mesh section and its textures are added to the modified section's textures. The block resolution of this child's Mesh Layout is set to 1x1. This 1x1 block will be added to the base blocks.
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 modified object texture. If the texture was already 128x128 no resizing would be applied.
(IMPORTANT) Texture size and block resolution must be planned when creating asset's UV layouts in order to have the most optimized and desired quality and appearance.
The following image shows the resulting UV layout with this Child Object active.
The 1x1 block has been added to the empty spot.
Resulting Textures
The following images show the resulting textures.
When there is only the base mesh
When the child mesh is active
Use blocks for mesh removal
Mutable allows mesh removal by selecting blocks in their UV layout. This can be achieved with the Remove Mesh Blocks modifier node.
In this extension of the previous example, a bigger and blue base is added to the yellow pillar. A part of the yellow pillar mesh will be overlapped by the new blue base, so this part will be removed.
Assets
This other accessory's UVs will consist on only one 2x1 block that will replace a block from its parent.
Object Structure
A second Child Object has been added to the example. This child has the same structure as the previous one but with the addition of
How it works
In this case, the child mesh has a UV layout grid with a resolution of 2x2 with only a 1x2 block.
One of the two blocks of this child will be placed in the empty space of the base layout and the other will replace the removed mesh of the base mesh.
In addition to the Mesh Layout node, this Child Object has a Remove Mesh Blocks modifier node that affects the Base Object mesh section. When the right tags are set in the Node Properties tab, the UV layout of the modified mesh is displayed and UV layout blocks can be added. The Remove Mesh Blocks node will remove any mesh that is inside any of these blocks.
In this case, the top-right 1x1 block is selected. This block contains the black base part of the yellow pillar. This part will be removed.
When the Customizable Object is compiled and the blue base Child Object is active, the black base is removed and the blocks of the new blue base are merged to the resulting UV layout.
Resulting textures
The following image shows the resulting texture when the second Child Object is applied.
Example with a complex block structure
The following images show the block structure of the Customizable Object example character "Bandit_forRPG".
Mesh Layout node properties showing the block structure of the character.
Parameters of the instance set to default
Instance example with its resulting color texture
Another instance example with its resulting texture