-
Notifications
You must be signed in to change notification settings - Fork 15
Texture Packing
Mutable can also do Texture Packing. When set to do so, Mutable not only modifies Textures but also Skeletal Mesh UVs. This packing is done at runtime and it it can: reorder existing blocks, remove unused blocks or even add new blocks.
-
Reorder Blocks: Blocks will be packed to optimize Texture space.
-
Remove Blocks: Clipping all vertices of a block removes it. Also blocks can be directly removed with the Remove Mesh Blocks node.
-
Add Blocks: Using the Extend Mesh Section node, you can extend a both the geometry and Texture. Textures are extended by adding additional blocks to already exsiting packing. See Extend Mesh Section node for more details.
Warning
Texture Packing is costly. Only use if it necessary (reduce draw calls, reduce Texture size...).
Texture Packing configuration is split two places:
- In Material's Texture Parameter (Material Modify and Mesh Section nodes).
- Skeletal Mesh nodes (Skeletal Mesh, Skeletal Mesh Parameter and Table nodes).
Warning
Only Mutable Texture can be packed. Object ones cannot.
The UV Packaging Settings defines the maximum number of blocks that Texture or UV will have. This is an upper limit so it is possible to have a resulting packing with fewer blocks than the specified here.
Using the Layout Editor, you can specify, per Mesh Section and UV Channel, the block that will compose the resulting packing.
Layout Stragtegy:
- Resizable: Legacy, do not use. It allows to exceed the maximum number of blocks.
-
Fixed: Enables Textue packing.
- Automatic Blocks Strategy:
- Grid Size: Resolution, in blocks, of the current Mesh Section.
- Max Grid Size: Legacy, do not use.
- Reduction Method: How blocks will be reduced if they do not fit the final packaing.
- Overlay: Disables Texture packing.
[!NOTICE] Reduction Method Halve is the most performant one.
In addition, you can specify per block settings:
- Block Priority: Higher priority blocks will be reduced first if necessary. The higher the value, the higher the priority.
- Reduce Symmetrically: If set to true, both axis will be reduced at the same time.
- Reduce by Two: Only used with Unary Reduction Method. Blocks will be recuded by 2 units instead of 1.
Several nodes manage texture UV layouts, and some use UV layout blocks to control their operation, like the Remove Mesh Blocks modifier node.
A Mesh Section may have several UV channels (usually for texturing), and you can specify how each is managed:
- Try to optimize the layout automatically. This is the default.
- Manually optimize the texture layout blocks. The user will define the texture blocks in the properties of each relevant node.
- Don't manage the layout and leave the mesh data unmodified. This is necessary if the channel is used for special purposes in the material, or if none of the textures sampled with these UVs is managed by Mutable (Pass-through textures).
These properties appear in the Skeletal Mesh and Table nodes, for each layout of each mesh section.
-
Mesh Section: selects which mesh section to edit (by LOD and material name). In the Table node you also pick among the meshes in different columns; rows all share the same layout properties.
-
UV Channel: selects which of the section's UV channels you are editing.
-
Layout Strategy: the main layout setting:
- Overlay: leaves the UV coordinates untouched, so merged sections overlap. Useful when assets are pre-planned to avoid layout conflicts (e.g. reserving space for each swappable part). Mutable performs no layout optimization and doesn't modify the textures on this channel.
- Resizable: packs the blocks and extends the textures as needed when blocks don't fit. Useful when the layout's contents vary a lot; final textures may be larger or smaller than the source.
- Fixed: like Resizable, but only up to Max Grid Size (see below); beyond that, blocks are shrunk to fit. Useful to enforce a texture budget when assets aren't planned for it.
With Resizable or Fixed, the layout is split into blocks — created manually in the Layout block editor, automatically, or a mix. Two restrictions apply:
- Every vertex must belong to a block, or it ends up in a random one.
- In UV space, a face cannot cross block boundaries, or it would be stretched across the texture.
With Resizable or Fixed, any geometry not assigned to a manual block is split automatically, creating new blocks alongside the manual ones.
-
Automatic Blocks Strategy: how new blocks are created.
- Rectangles: creates grid-aligned rectangular blocks, splitting as much as possible without triangles crossing grid boundaries. Tune with the Grid Size property.
- UV Islands: bounds each UV triangle island with a grid-aligned rectangle and generates a texture mask per island (since they may overlap). More CPU-expensive.
-
Automatic Merge Blocks Strategy: (only with UV Islands) controls how generated blocks are merged:
- Merge child blocks: a UV island fully inside another's bounding rectangle is merged into it.
- Don't merge: no merging.
-
Consolidate Blocks: a layout-editor button that converts the previewed automatic blocks into manual ones, so their properties can be edited.
The Layout Blocks editor shows a mesh section's UV channel, with tools to create blocks manually and preview the automatic ones.
- Manual blocks appear in yellow, with a knob to resize them.
- Selected manual blocks turn blue and offer extra properties via right-click (see Advanced properties below).
- Automatic blocks appear in grey and can't be edited; any texture mask shows in red over the masked faces.
Add and remove blocks from the toolbar. Select them by right-clicking, or right-drag for a rectangle selection. Zoom with the mouse wheel and pan with the middle button. The right-click menu can reset the view to the 0,0–1,1 UV space, or delete/duplicate the selected blocks.
Automatically generated LODs can move UVs, pushing a vertex outside a block that was correct at LOD 0. Mutable moves it back automatically but warns by default. These warnings can be suppressed with:
- Ignore Unassigned Vertices Warning: ignore this warning when compiling.
- First LOD to ignore: ignore warnings from this LOD onward (only when the option above is enabled).
With the Fixed strategy, blocks may need shrinking to fit. You can set per-block priorities (manual blocks only, via their right-click menu); lower-priority blocks shrink first.
Some layout operations let you define a block's faces with a texture mask, set via the Block Mask option in a selected block's right-click menu.