struct

FSubstrateCodec

The two-slab G-Buffer codec, mirrored from Engine/Shaders/Private/Lighting/ Substrate.hlsli. Slab 0 is the ordinary G-Buffer; this describes slab 1, which rides the sixteen bits the tier-7 escape frees from clear-coat duty. The shader and this struct are pinned against each other by the substrate-codec-test row — a bit layout with two writers and no test is how the anisotropy nibble drifted before it was centralised.

Module
AssetSystem
Header
#include "AssetSystem/Assets/MaterialGraph.h"
Namespace
Mowo

Properties

TypeNameDescription
static constexpr uint32_tExtendedSlotTier 7's low five bits name an extended slot; slot 1 is Eye, so Substrate takes slot 2 and shading-model id 9. Renderer/Material.h has no EShadingModel entry for it yet (that header is outside the material path), so this is where the reservation lives. Default 2u.
static constexpr uint32_tModelIdDefault 9u.
static constexpr uint32_tRt3aByteDefault 0xE2u.
static constexpr uint32_tMaxSlabsTwo slabs, fixed. Not a budget knob yet: widening it needs a G-Buffer target, which is a renderer-owned change (plan §2). Default 2u.
static constexpr floatSheenTintDefault 0.35f.

Public functions

ReturnsNameDescription
floatF0FromCode
uint32_tF0ToCode
uint32_tPackTop
floatUnpackCoverage
floatUnpackRoughness
floatUnpackF0
uint32_tUnpackAlbedoMode
floatRt3RRT3.R/G are UNORM bytes.
floatRt3G
uint32_tFromRt3

Function details

F0FromCode

C++
static float F0FromCode(uint32_t code)

F0ToCode

C++
static uint32_t F0ToCode(float f0)

PackTop

C++
static uint32_t PackTop(float coverage, float roughness, float f0, uint32_t albedoMode)

UnpackCoverage

C++
static float UnpackCoverage(uint32_t packed)

UnpackRoughness

C++
static float UnpackRoughness(uint32_t packed)

UnpackF0

C++
static float UnpackF0(uint32_t packed)

UnpackAlbedoMode

C++
static uint32_t UnpackAlbedoMode(uint32_t packed)

Rt3R

C++
static float Rt3R(uint32_t packed)

RT3.R/G are UNORM bytes. The +0.5 on the way back is load-bearing: a UNORM round-trip of 200/255 lands at 0.78431375 and truncating gives 199.

Rt3G

C++
static float Rt3G(uint32_t packed)

FromRt3

C++
static uint32_t FromRt3(float r, float g)
Generated from AssetSystem/Assets/MaterialGraph.h via assetsystem.json · Nov 4, 2026Version 1.0.0