ACF_CHR_Customization (Shadows & Black Flag Resynced) - Kamzik123/AnvilToolkit-Resources GitHub Wiki

This tutorial explains how the ACF_CHR_Customization material template works in Assassin's Creed Black Flag Resynced (it's the same template that Assassin's Creed Shadows uses for character gear). This is the shader behind recolourable outfit pieces. It splits a mesh into up to six recolourable zones, and each zone gets its own colour, pattern, surface material and roughness, plus global grunge, aging and emission.

You'll learn:

  • what each texture in the material's TextureSet is for, channel by channel
  • how to paint a zone map that the game reads correctly
  • what the "Mask1" names in build tables and texture sets mean (they're two different things)
  • how patterns, palette colours and surface materials get picked per zone
  • how emission works, and why it isn't zoned

Prerequisites: You should already know how a Material references a MaterialTemplate and a TextureSet, and how to replace a TextureMap. If not, read the Materials & TextureSets and Texture Viewer pages first.


Table of Contents


Overview

ACF_CHR_Customization is a skinned, deferred, double-sided character shader. There are two versions:

Template Use
ACF_CHR_Customization Standard customizable gear
ACF_CHR_Customization_Emission Same shader plus a glow driven by a mask (see Emission)

The colours you see in-game mostly don't come from the albedo texture. The shader works like this:

Zone Map ──► which zone (0–6) is this pixel in?
                β”‚
                β–Ό
     that zone's parameters ──► tint colour, pattern, palette colours,
                                surface material, roughness
                β”‚
                β–Ό
     + Albedo (base detail)  + Normal (shape, spec occlusion, roughness scale)
     + Grunge map (dirt, wear, emissive mask)
                β”‚
                β–Ό
             final pixel

The textures you author for a mesh tell the shader where each zone is and what the base surface detail looks like. The colours, patterns and materials themselves are parameters, so the same textures can be recoloured without touching an image.


The TextureSet: Which Map Goes Where

The shader reads four textures from the mesh's TextureSet. Two of them sit in slots whose names don't match what they hold:

TextureSet slot Shader input What it really is
Emissive Zone Map Zone ID map + wear/AO mask. Not an emissive texture.
Diffuse AlbedoMap Base colour / surface detail
Normal NormalMap 2-channel normal + specular occlusion + roughness scale
Mask1 GrungeMap Grunge, colour variation, wear, emissive mask

Everything else the shader uses (pattern library, palette, surface detail library, weave, weather layers, stencils) is supplied by the engine. See Engine-Side Textures You Don't Author.

The Emissive slot holds the zone map. If you put an actual glow texture there, the shader reads it as zone IDs and your outfit's zones break.


Zone Map (Emissive Slot)

RGB: Colour-Coded Zones

The zone map is colour-coded. It is not a gradient or a set of per-channel masks. For each texel, the shader checks which of R, G and B are above 0.5 and turns that combination into a zone number:

Paint colour RGB (0–255) Zone
${\color{#000000}β–ˆ}$ Black 0, 0, 0 0 (base, not customizable)
${\color{#0000FF}β–ˆ}$ Blue 0, 0, 255 1
${\color{#FF0000}β–ˆ}$ Red 255, 0, 0 2
${\color{#FF00FF}β–ˆ}$ Magenta 255, 0, 255 3
${\color{#00FF00}β–ˆ}$ Green 0, 255, 0 4
${\color{#00FFFF}β–ˆ}$ Cyan 0, 255, 255 5
${\color{#FFFF00}β–ˆ}$ Yellow 255, 255, 0 6
${\color{#FFFFFF}β–ˆ}$ White 255, 255, 255 ❌ Invalid, don't use

The zone number then selects that zone's parameters: Zone<N>Albedo, Zone<N>Roughness, Zone<N>PatternID, Zone<N>SurfaceDetailID, the pattern transform and the three palette indices.

Disabled zones fall back to zone 0. If Zone<N>Enabled is 0, every pixel painted with that zone's colour is treated as zone 0 (the base material). An unassigned colour therefore shows up as plain base material, with no error. If a region "isn't taking colour", check this first.

Alpha: Wear / Occlusion Mask

The zone map's alpha is not part of the zone ID. It's a wear and occlusion mask, used in two ways:

  • saturate(A + 0.4), smoothstepped β†’ the micro-visibility / ambient occlusion term.
  • min(A + 0.25, 0.98) β†’ gates where aging and grunge build up.

In practice:

Alpha Effect
Dark Crevices: more occluded, collects more dirt and aging
Bright Exposed surfaces: cleaner, less occluded

A baked cavity or AO map (tweaked to taste) works well as a starting point for this channel.

Painting a Zone Map Correctly

The shader uses hard thresholds, so the RGB channels have to be clean:

  • Use only 0 or 255 per channel. Any value in between can land on the wrong side of the 0.5 threshold.
  • No anti-aliasing on zone borders. Paint with a hard, aliased brush or use selection fills, and turn off smoothing and feathering. A soft edge between red and blue produces stray magenta pixels (zone 3) along the border.
  • Don't resample with filtering. If you resize the map, use nearest neighbour.
  • Never use white. It doesn't decode to a valid zone.
  • Remember the alpha. An export with a blank or fully opaque alpha gives a uniformly "exposed" surface, so you lose the crevice dirt and occlusion.

Albedo Map (Diffuse Slot)

The albedo is the base colour and surface detail that the zone tint, patterns and grunge are applied on top of.

Channel Use
RGB Base albedo
A Coverage / opacity mask

The albedo still adds detail even where a zone tint is applied. The shader blends the base map's micro-contrast back over the recoloured result, and this blend fades out with camera distance. For best recolouring results, keep strong hue out of customizable regions and let the zone colour provide it.


Normal Map (Normal Slot): B and A Are Not Normal Data

Resynced normal maps are two-channel. Only R and G hold the tangent-space normal, and Z is rebuilt in the shader:

x = R * 2 - 1
y = G * 2 - 1
z = sqrt(1 - xΒ² - yΒ²)

This leaves B and A free, and the shader uses them for something else:

Channel Use
R, G Tangent-space normal X / Y
B Specular / micro occlusion. Wear reduces it (max(B - wear * 0.2, 0)) and roughness suppresses it. Dark blue = areas with no specular (seams, thread valleys, cavities).
A Roughness scale. Multiplies the zone's Zone<N>Roughness value.

Normal alpha is relative roughness

Normal-map alpha does not set roughness directly. It scales the roughness the zone already has:

roughness β‰ˆ Zone<N>Roughness Γ— NormalMap.A
  • Alpha 1.0 (white) β†’ the zone's authored roughness, unchanged
  • Darker alpha β†’ glossier than authored

So you can't make a surface rougher than its zone allows by painting the alpha. If a zone is authored fully rough, a white alpha keeps it fully rough and nothing brighter exists. Use the alpha to add glossy variation (worn shiny spots, polished edges) inside a zone.

If you're converting a standard 3-channel normal map: move or keep X/Y in R/G, then replace B with a specular-occlusion mask (white if you have none) and set A to a roughness-scale mask (white if you have none). A leftover normal-Z in blue looks like random specular occlusion.


Grunge / Wear Map (Mask1 Slot)

All four channels of this map have separate jobs:

Channel Use
R Grunge coverage: where dirt shows. Gated by GrungeIntensity / GrungeOpacity.
G Grunge colour variation: blends between GrungeColorDark and GrungeColorLight.
B Wear / aging coverage. Multiplied with the zone map's alpha, so wear needs both this channel and an exposed/crevice area to show up.
A Emissive mask. Used only by the _Emission variant and ignored by the standard shader.

Grunge also roughens the surface (roughness = min(roughness + grunge, 0.95)). Dirty areas never become glossy.

If GrungeOpacity is 0, the R/G channels have no effect. When grunge "doesn't show", check that value before the texture.


Emission (the _Emission Variant)

Emission is not zoned. The _Emission variant has a single global EmissiveColor for the whole material, with no per-zone emissive colour.

The emissive mask is the alpha channel of the grunge map, processed like this:

e   = sRGBToLinear(saturate(grunge.a))
e   = pow(e, EmissivePower) * EmissiveIntensity
rgb = (e == 0) ? 0 : (2^e - 1) * 1.831e-4 * EmissiveColor.rgb

This has two consequences that make emission look "zoned" when it isn't:

  1. The response is strongly non-linear. The value goes through sRGB decode, then a power curve, then an exponential. Dark greys produce almost nothing, the top of the range becomes very bright, and small greyscale steps turn into distinct brightness bands.
  2. Pure black is fully off. Exactly 0 is clamped to black, so black means no emission at all, not a dim glow.

To get separate emissive "zones", paint them as different grey levels in the grunge alpha and adjust EmissivePower until the bands separate the way you want. All of them share the same EmissiveColor, so different glow colours on one material aren't possible.


Per-Zone Parameters

Each of zones 1–6 has its own block of parameters. Zone 0 (base) has a smaller set (Zone0Roughness, Zone0SurfaceDetailID, Zone0SurfaceDetailScale).

Parameter What it does
Zone<N>Enabled Turns the zone on. When 0, the zone's pixels fall back to zone 0.
Zone<N>Albedo Zone tint colour (Color in BuildTables)
Zone<N>Roughness Base roughness of the zone, scaled by normal-map alpha
Zone<N>SurfaceDetailID Which surface material (cloth, leather, metal…) the zone uses. (0 = none)
Zone<N>SurfaceDetailScale Tiling of that surface detail
Zone<N>PatternID Which pattern from the pattern library (0 = none)
Zone<N>Color1/2/3Index Palette entries used to colour the pattern
Zone<N>PatternTransform Pattern tiling (XY) and offset (ZW). Default (8, 8, 0, 0)
Zone<N>PatternRotation Pattern rotation
Zone<N>PatternRoughness Roughness where the pattern is drawn
Zone<N>PatternMetalnessThreshold Lets the pattern drive metalness (-1 = off)
Zone<N>UsePaintedMetal Painted-metal look for metal zones
Zone<N>UsePatternBlend / UsePatternClamping Pattern blending / UV clamping

Template defaults are neutral: albedo white, no pattern, palette indices 0, roughness 1.

Surface Detail: Picking a Zone's Material

The zone map only says which zone a pixel belongs to. The zone's material type (leather, wool, worn metal…) comes from Zone<N>SurfaceDetailID, which is a parameter and not part of any texture you author.

  • SurfaceDetailID is 1-based. 0 = no surface detail, 1 = the first entry in the surface detail library, 2 = the second, and so on.
  • Each library entry declares a material class. The class sets the roughness range (clean β†’ worn) and the metalness from a table built into the shader:
Class Roughness clean β†’ worn Metal Character
0 0.35 β†’ 0.75 0.95 Coated / worn metal
1 0.30 β†’ 0.75 0.90 Worn metal (variant)
2 0.50 β†’ 0.95 0 Rough cloth / canvas
3 0.30 β†’ 0.95 0 Cloth with sheen (velvet-like)
4 0.30 β†’ 0.95 0 Napped fabric
5 0.30 β†’ 0.65 0 Smooth leather
6 0.55 β†’ 1.0 0 Wool / coarse cloth
7 0.0 β†’ 1.0 0 Generic full range
8 0.10 β†’ 0.70 1.0 Polished metal
9 0.35 β†’ 0.65 1.0 Brushed metal
10 0.40 β†’ 0.70 1.0 Satin metal
11 0.0 β†’ 1.0 0 Default / none

The "character" names are inferred from the numbers. The shader doesn't store names. The class values themselves come straight from the compiled shader.

Where on that clean β†’ worn range a pixel ends up depends on Zone<N>Roughness Γ— NormalMap.A together with the surface detail texture, plus a small constant bias.

Example: to make the magenta region worn metal, paint it magenta (zone 3) and set Zone3SurfaceDetailID to a metal entry. You don't need to change the zone map to give that region a different material later. Changing the ID is enough.

Patterns and Palette Colours

When Zone<N>PatternID is non-zero (also 1-based, 0 = no pattern), the shader takes that pattern from the pattern library and colours it with three palette colours looked up from a palette texture:

pattern.B  β†’  ramp between the three palette colours:
              0.0 ──── Dark (Color3) ──── 0.5 ──── Mid (Color2) ──── 1.0 ──── Light (Color1)
pattern.A  β†’  coverage: how strongly the pattern replaces the zone colour

The palette indices correspond to the build table's PatternColorLightIndex (Color1), PatternColorMidIndex (Color2) and PatternColorDarkIndex (Color3). Each index is an entry in the palette texture, so you pick colours by number, not by RGB value.

The pattern also blends in its own normal detail, moves roughness toward Zone<N>PatternRoughness, and can set metalness through Zone<N>PatternMetalnessThreshold.

Global Parameters

These apply to the whole customizable material, across all zones:

Parameter Build table What it does
GrungeIntensity / GrungeOpacity MaskN_GrungeIntensity Strength of grunge (0 = off)
GrungeColorDark / GrungeColorLight β€” The two grunge colours selected by grunge-map G
Aging MaskN_Aging Strength of the weathering / aging layers (0 = off)
WeaveTearing MaskN_WeaveTearing Fabric weave tearing / fraying amount
WornMetalColor, WornMetalRoughness β€” Look of worn metal
SurfaceDetailUVSize, SurfaceDetailNormalIntensity β€” Global tiling and strength of the surface detail
HueFactor, SaturationFactor, ValueFactor β€” HSV adjustment (defaults 0.5 / 0.5 / 1). Not active in every shader permutation.
Stencil… β€” Emblem / decal system (see below)
EmissiveColor, EmissivePower, EmissiveIntensity β€” _Emission variant only

Engine-Side Textures You Don't Author

The shader binds several more textures. These are shared engine resources, or they're swapped in per instance by the customization system. You won't normally replace them for an outfit:

Texture What it does
PatternArray Library of pattern images. Selected per zone by PatternID.
PatternLUT Palette of colours, point-sampled. Indexed by the Color1/2/3Index values.
SurfaceDetailArray Library of surface materials (cloth, leather, metal micro-detail). Selected per zone by SurfaceDetailID.
Weather Map A / B (ACF_CHR_CharacterLayerA/B_Map) Weathering layers, driven by Aging
Weave Map / Weave Normal Tiling fabric weave detail, used by WeaveTearing
Stencil Atlas / Diffuse / Normal Emblem / decal overlay, swapped per instance when a stencil is applied

Practical: Make a New Customizable Texture Set

  1. Start from an existing customizable piece. Copy a material that already uses ACF_CHR_Customization and give it a new TextureSet (see Materials & TextureSets for duplicating with unique IDs).
  2. Plan your zones. Choose up to six regions that should recolour separately (e.g. 1 = coat cloth, 2 = leather trim, 3 = metal buckles). Everything else stays black (zone 0).
  3. Paint the zone map, following the rules above: flat colours from the zone table, no anti-aliasing, no white.
  4. Put an AO/cavity mask in the zone map's alpha. Dark in crevices, bright on exposed surfaces.
  5. Prepare the normal map: R/G = normal, B = specular occlusion (white if none), A = roughness scale (white if none).
  6. Prepare the grunge map: R = dirt coverage, G = dirt colour variation, B = wear coverage, A = emissive mask (black if not using emission).
  7. Assign the slots: zone map β†’ Emissive, albedo β†’ Diffuse, normal β†’ Normal, grunge β†’ Mask1.
  8. Set the per-zone parameters (enable each zone you painted, then choose its colour, surface detail and pattern) in the material or the build table's MaterialMask1 entry.
  9. Test in-game. Then check Troubleshooting if something looks off.

Troubleshooting

Symptom Likely cause
A painted region shows plain base material Its Zone<N>Enabled is 0 (falls back to zone 0), or the colour isn't an exact zone colour
Thin lines of the wrong colour along zone borders Anti-aliased / blurred edges between zone colours
A region behaves completely wrong It's painted white, or a channel value isn't 0/255
Surface is too glossy and you can't make it rougher Normal alpha only scales Zone<N>Roughness. Raise the zone's roughness instead.
Random-looking dark specular patches A real normal Z was left in the normal map's blue channel
No dirt even with a painted grunge map GrungeIntensity / GrungeOpacity is 0
No wear even with grunge-map B painted Zone map alpha is bright everywhere (wear needs both) or Aging is 0
Emission is either invisible or blown out The curve is non-linear. Adjust grey levels and EmissivePower.
Want two glow colours on one material Not possible. EmissiveColor is global. Split into separate materials.
Zones got "replaced" by a glow texture Something was put in the Emissive slot, which holds the zone map

Quick Reference Summary

TextureSet slot Shader input R G B A
Emissive Zone Map colour-coded zone ID (RGB together) ← ← wear / AO mask
Diffuse Albedo base colour ← ← coverage
Normal Normal normal X normal Y specular occlusion roughness scale (Γ— Zone<N>Roughness)
Mask1 Grunge grunge coverage grunge colour variation wear / aging coverage emissive mask (_Emission only)

Zone colours: black 0 Β· blue 1 Β· red 2 Β· magenta 3 Β· green 4 Β· cyan 5 Β· yellow 6 Β· (never white)

  • Zones are picked by colour (each RGB channel > 0.5 or not). Disabled zones β†’ zone 0.
  • Material type per zone = Zone<N>SurfaceDetailID (a parameter, 1-based, 0 = none).
  • Pattern per zone = Zone<N>PatternID (1-based) + three palette indices (Light / Mid / Dark).
  • Roughness = zone roughness Γ— normal alpha (alpha can only make the surface glossier).
  • Emission = one global colour, masked by grunge alpha through a steep curve. No per-zone emission.
  • MaterialMask1–4 in build tables = up to four customizable materials per outfit piece, each with its own zone map and parameter set.