ArchiveXL: dynamic materials
How to use ArchiveXL's new material property interpolation
Summary
Published: May 01 2024 by manavortex Last documented update: May 01 2024 by manavortex
Prerequistes
ArchiveXL >= 1.13 — this will not work with older versions
Assumed skill level
You have a general understanding of how materials work (or read up on it under Material assignment)
You have a Wolvenkit project and a mesh as well as a bunch of .mlsetups
Why is this better than .mi files?
Because it's even lazier: For a mesh with 15 appearances, you need...
legacy | dynamic materials | |
---|---|---|
Appearances | 15 | 15 |
mlmask files | 1 | 1 |
mlsetup fil,es | 15 | 15 |
# | 15 | 1 |
# | 15 | 1 |
# | 15 | 1 |
To be even lazier, check out ArchiveXL: Resource patching and ArchiveXL: Resource linking!
The problem
Normally, your materials look like this: a bunch of different appearances with the same .mlmask
, but one .mlsetup
file for each colour:
![](https://wiki.redmodding.org/~gitbook/image?url=https%3A%2F%2F1427525421-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F4gzcGtLrr90pVjAWVdTc%252Fuploads%252F2K0nMhW42GMxRcGuhCPA%252Farchivexl_non-dynamic_materials.png%3Falt%3Dmedia%26token%3D8b8bf2a6-4762-4693-b536-2fedfd9f7ca2&width=768&dpr=4&quality=100&sign=423b3cb5&sv=1)
The more variations you have, the more duplication you have, because you need to register a materialEntry
for each material, and then create a material for each of those. Traditionally, you do that by duplicating the last entry and changing the depot path. Tedious and not fun, right?
This is where the new technique kicks in.
Step 1: Dynamic material assignments
We start by changing our chunkMaterial
names. By appending the suffix @dynamic
, we're telling ArchiveXL to map them to the CMeshMaterialEntry
with the same name.
Instead of 15 materialEntries
, we're down to one.
![](https://wiki.redmodding.org/~gitbook/image?url=https%3A%2F%2F1427525421-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F4gzcGtLrr90pVjAWVdTc%252Fuploads%252FsWdDdTuGrZpYizb0QHHR%252Fimage.png%3Falt%3Dmedia%26token%3D36bf41dc-dad3-4979-9ae9-7f773541f852&width=768&dpr=4&quality=100&sign=80fa2f40&sv=1)
Step 2: the material instance
Now, we need to adjust the material instances. We can delete all but one, since our @dynamic
will contain everything that we need.
The Flags for any dynamic material must be set to Soft
, and the depot path must start with a *. File Validation will warn you about this.
Since that one won't change, we can leave the MultilayerMask
alone. For the MultilayerSetup, we need to change both the DepotPath
:
![](https://wiki.redmodding.org/~gitbook/image?url=https%3A%2F%2F1427525421-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F4gzcGtLrr90pVjAWVdTc%252Fuploads%252FwG2oFK0x2QJIWs8c24AA%252Fimage.png%3Falt%3Dmedia%26token%3Dd304b736-36c7-419d-85af-cc12fd955fc9&width=768&dpr=4&quality=100&sign=7fc37369&sv=1)
By making the depot path start with a
*
, we tell ArchiveXL that this is a dynamic materialThe value for
{material}
will be passed from the appearance, like this:
![](https://wiki.redmodding.org/~gitbook/image?url=https%3A%2F%2F1427525421-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F4gzcGtLrr90pVjAWVdTc%252Fuploads%252FJjl1C1xkruA3IQCohWuK%252Fimage.png%3Falt%3Dmedia%26token%3Dd18b953b-f0b0-423f-8f2e-30dca15dc0de&width=768&dpr=4&quality=100&sign=135c8f67&sv=1)
... and the rest just works.
You can use dynamic interpolation in pretty much everything — base material paths or material properties. Just remember to set your Flags to Soft
, or it will fail.
Step 3: Appearance expansion
But wait, there's more. After using dynamic materials, we've been able to reduce the number of material entries and instances, but there is still a lot of repetition between the appearances - if you've followed this guide so far, each of your appearances has a chunkMaterials
list that looks the same as all the others except for the different material name. It would be great if we could get rid of that repetition, and we can, with Appearance Expansion.
And it's very simple to do. You simply assign empty chunkMaterials
lists to all your appearances except the first one, and ArchiveXL will automatically use the first appearance as a template and generate the chunkMaterials
list by substituting the appearance name:
![](https://wiki.redmodding.org/~gitbook/image?url=https%3A%2F%2F1427525421-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F4gzcGtLrr90pVjAWVdTc%252Fuploads%252FQyAtC88pSS1XkxUkYoM4%252FarchiveXL_appearance_expansion.png%3Falt%3Dmedia%26token%3Deefde57a-7f34-490d-b8c5-51af49d21e2a&width=768&dpr=4&quality=100&sign=6fc02a33&sv=1)
Now, you only have to maintain one chunk list, and the rest of your appearances are simplified down to a single name and nothing else.
Last updated