Reconstructing Stylized Character Rendering — Part 1: A Hybrid Deferred–Forward Pipeline

Stylized characters need per-material directions, lookups, and lighting rules while participating correctly in scene occlusion and composition. This implementation keeps ordinary scene rendering on UE’s deferred renderer. Characters retain BasePass depth, GBuffer, and identity data, while a dedicated CharacterForward pass generates their opaque color.

This article follows the pipeline through character color generation and subsequent modifications. Forward rendering here means a dedicated character shading path inserted into the deferred frame loop, rather than project-wide Forward Shading. P1 covers the pipeline and color responsibilities; P2 develops the algorithms for individual parts; P3 will address temporal processing, Bloom correspondence, body-skin bindings, and pixel-level validation of the multiplicative shadow overlay.

Continue reading: Reconstructing Stylized Character Rendering — Part 2: Part-specific Materials and Shading Algorithms.

For graphics programmers and technical artists working on UE renderer integration, the article connects architecture, the current implementation, and static capture results. The material comes from UE 5.8 research and read-only replay of existing captures by the evidence provider; the engine was not rerun during this editorial work. Public engine APIs retain their names, project-specific identifiers use neutral names, and abbreviated code is not a complete patch.

Who Is Responsible for Character Color Within a Frame?

In the current static view, BasePass supplies geometry and identity, shadow resolve supplies visibility, and CharacterForward writes opaque character color. Extruded-shell outlines, separate translucency attachments, and the display chain subsequently modify the result according to their respective rules.

Figure 1: Actual execution chain of the final static view
Figure 1: Execution relationships established by saved events and the fixed source revision. The gray temporal branch did not contribute to this output. This is a particular static view, not a universal UE frame sequence across all configurations.
Stage What it provides Responsibility for character color
BasePass Depth, normals, material identity, and required payloads Prepares geometry; does not implement complete character lighting in this scheme
Shadow Resolve Visibility from depth, normals, and atlases Produces shading inputs without directly writing character color
CharacterForward surfaces Joint evaluation of material, object, light, and shadow inputs Writes opaque character color
Outline priming and color Extruded depth, stencil, outline color, and velocity Priming establishes conditions; color draws modify covered regions
AfterDOF and Compose Accumulated translucent color, transmittance, and Modulate Writes separate attachments before compositing into the main color target
Bloom / UberPost / FXAA Display input, color transforms, and final output Actual display chain of this frame; detailed reconstruction assessment belongs in P3

The hybrid scheme assigns responsibilities and restricts the tracked default direct-lighting, indirect-lighting, and reflection consumers in the current legacy static path to avoid duplicate contributions. Ordinary scene geometry continues to use deferred lighting; characters retain geometry and identity writes while delegating opaque color to the dedicated forward path. Substrate, front-layer rendering, special lighting permutations, and other platforms require separate validation. The sequence applies to this static view; the complete result follows.

Figure 2: Unity original on the left; current UE reconstruction on the right
Figure 2: Unity original on the left; current UE reconstruction on the right. The compositions are not registered pixel by pixel. Fabric, mask, and hair-tip differences remain, so this comparison cannot establish a whole-image reconstruction percentage.

Reading the Stage Evidence

The stage overview comes from the same 1920×1080 view containing the main character draws. Depth, GBuffer, character shading, translucency, and post-processing checkpoints are connected through view constants or actual resource bindings. Shadow atlas and Bloom dimensions are noted separately. Tiles are arranged by dependency, not as separate passes executing in left-to-right order.

Figure 3: Key stages from the same static capture
Figure 3: Key stages from the same static capture. The top row shows geometry, identification, and the state before color takeover; the middle row shows shadow resources and character shading; the bottom row shows separate translucency attachments, composition, and final output. Each image is explained later. Black attachments retain their actual content.

Read these images according to their data types. Normal colors encode direction, character classification colors encode enumeration values, and shadow grayscale encodes visibility; none uses final-image color grading. HDR color images are divided by PreExposure=2.4505558 and then use the fixed viewing transform sRGB(x/(1+x)), with 0EV additional exposure. This transform supports intermediate-stage comparisons; it is not the original game’s or UE’s final display curve. Final images already in display space are not transformed again.

Figure 4: Visualization legend for the stage images
Figure 4: Visualization legend. Depth, normals, classification, shadows, and velocity use separate ranges and encodings. Brightness cannot be compared directly across different data types.

Within-frame stage comparisons establish which stage wrote what. Feature-toggle experiments establish the effect of changing a feature. Original-versus-UE comparisons establish remaining appearance differences. These forms of evidence are not interchangeable. Pixel-change counts below come from the delivered numerical records. Raw floating-point bytes are not distributed with the blog, and PNGs cannot reproduce the complete HDR difference calculation.

Scope of the Current Execution Chain

A capture may include warm-up, screenshot operations, and views of different sizes. This discussion concerns the 1920×1080 segment containing the main character draws. After character surfaces, translucent color and modulation factors first enter their respective AfterDOF targets and are only later composed into the main scene color. Draw order and the order of writes to a shared color target therefore require separate checks. A shadow-overlay event occurring after transparent hair cards does not establish that both sequentially modify the same HDR texture.

Why CharacterForward Takes Over Character Color

This scheme retains both deferred rendering and forward shading. Ordinary scene geometry follows UE’s deferred system; characters participate in depth and GBuffer preparation, then obtain opaque color through a dedicated CharacterForward pass. Project-wide Forward Shading is not enabled, and characters are not removed from scene geometry. The hybrid division concerns color evaluation; geometry, occlusion, and subsequent composition still share data.

Stylized Shading Needs Material and Lighting Context Together

Conventional deferred shading writes surface properties into a GBuffer for later lighting stages to read. This separation reuses a common lighting path for standard surface responses. These characters, however, simultaneously require dual hair normals, grooming directions, a facial SDF, object-local coordinates, and multiple ramps and LUTs. Some define surface orientation, some shape highlights, and others control light–dark boundaries. A single roughness value or normal cannot replace them.

Lighting-dependent lookups in particular cannot all be compressed into fixed surface properties during BasePass. Facial SDF sampling direction depends on the main light in face-local space; hair highlight coordinates depend on view, light, and part directions together. Performing these calculations during deferred lighting would require transmitting the relevant intermediates, material resource indices, or other data.

A deferred route can support these features through a custom Shading Model, an extended GBuffer, or additional resource access; stylization is not inherently incompatible with deferred shading. The engineering cost lies in storing data, recovering material context, and maintaining branches for individual parts. Additional buffers and reads may also increase bandwidth use. The dedicated forward pass brings material resources, object data, and lighting inputs into one evaluation context during character drawing, reducing the need to carry part-specific data through a common GBuffer.

Forward shading has costs too. Retaining character geometry passes and then drawing dedicated color adds submission and shading work, along with resource binding and isolation of default color consumers. Without like-for-like GPU measurements, the hybrid scheme cannot be claimed to be faster. Expressiveness and responsibility boundaries are the primary reasons for choosing it.

Lights Need Not All Contribute Through the Same Per-Light Sum

Stylized characters often assign different roles to the main light, local fill lights, and environment contributions. The main light organizes major light–dark regions, local lights emphasize particular parts, and environment terms supply additional color and reflection. Repeating and summing the same toon curve for every light can disrupt the intended tonal relationships. The current part-specific code retains separate directional gates, environment weights, and local responses to control their contributions to final color.

Deferred lighting can also be customized this way, but a dedicated forward entry point makes per-material inputs and combination rules easier to retain. Choosing forward rendering does not automatically provide correct fill, shadows, or highlights. These resources still require explicit production and binding; the real stage images later in the article check whether that data chain actually executes.

What Artistic Highlight and Fill Controls Are For

Character lighting must convey form, material, and visual emphasis as well as respond to the scene. Hair highlights reveal strand flow and volume; facial light–dark boundaries affect facial readability; local bright edges on sleeves and shoulders separate silhouettes from the background. These are artistic design objectives, not evidence that the current static implementation is stable in every environment and animation.

‘Virtual highlight’ may refer to authored material directions and specular lobes, auxiliary lights used to shape form, or compensation added during reconstruction. These sources need separate evidence and maintenance considerations.

Source Example in this implementation Purpose and current limits
Authored material specular response Dual hair normals, grooming directions, shifted tangents, and 2D lookups Shapes highlight bands and their colors; remains light- and view-dependent. Detailed algorithms are covered in P2
Part-specific local-light response Separate local lights and rim gates for fabric, skin, and hair Emphasizes selected parts rather than applying one shared Fresnel term. Some inputs and occlusion still come from fixed capture records
Visual compensation during reconstruction Historical artificial highlight ring, local gains, and some current scale adaptations Must be distinguished from source mechanisms. The historical artificial ring is disabled and is not part of the retained highlight mechanism

The evidence establishes part directions, captured local lights, and distinct gates, but does not establish a virtual light that always faces the camera. Before discussing why a region is bright, determine whether its source is material specular response, local lighting, environment reflection, or additional geometry coverage.

Artistic controls cannot replace diagnosis. If the dedicated PS already produces a correct highlight that a later transparent layer overwrites, adding fill accumulates extra energy. Once the overwrite is fixed, that extra energy causes overbrightness. The historical example retained later in this article shows why artistic adjustments require correct color production and composition first.

Responsibilities Supported by Different Integration Routes

Material nodes can express some shading arithmetic, while light traversal, resource production, and draw state belong to other renderer layers. The following table compares integration routes by those responsibilities.

Integration route Available facilities Main limitation for this goal Choice here
DefaultLit plus material nodes Standard surface properties and default engine lighting and shadows Changing surface properties alone cannot reproduce all part-specific lighting and draw layers Baseline for analysis, not the main final character shading route
Compute all color in Unlit/Emissive Direct control over output color Requires explicit light, shadow, and object data; nodes alone still cannot change draw state Used only for specific purposes such as the multiplicative shadow overlay
Project-wide Forward Shading Engine forward-lighting infrastructure Changes the entire project’s rendering route without automatically reproducing source part algorithms Not used
Post-processing only Existing screen inputs such as SceneColor and Depth Unsuitable for reconstructing per-material textures, complete tangent bases, and geometric layers Limited to display and composition responsibilities
Dedicated CharacterForward within Deferred UE scene geometry and object systems, plus a dedicated material-shading entry point Requires engine changes to collection, scheduling, binding, and default composition boundaries Current implementation

The implementation retains UE components, skeletal Vertex Factories, visibility, instance culling, depth, and GBuffer paths. Its takeover covers opaque character shading, dedicated screen-space shadow resolve, some outline states, and exit rules for default color consumers. Transparent hair cards and the display chain remain connected to existing systems.

Figure 5: Dependencies in the hybrid pipeline
Figure 5: Hybrid pipeline dependencies. Ordinary scene geometry continues to receive default lighting, while characters retain geometry data and enter dedicated shading. The stages represent responsibilities and dependencies, not the complete capture’s pass-by-pass timeline.

Characters opt out of duplicate lighting in the currently integrated default color consumers while retaining BasePass geometry and identity writes. Without depth and surface identity, downstream occlusion and screen-space processing would lose their basis. Velocity is maintained separately by the actual geometry and extrusion paths. Dedicated color draws reuse Vertex Factory and BasePass VS inputs, then shade through a separate PS without executing the complete default BasePass lighting path again.

BasePass Supplies Geometry and Character Identity First

Geometry required for subsequent shading already exists before characters receive their dedicated surface color. This view’s BasePass binds scene color and five GBuffers simultaneously. This is an MRT (Multiple Render Targets) configuration. Depth-stencil is a separate attachment; Velocity is not in the MRT list at this point.

Attachment View format in this frame Relevant data
SceneColor RGBA16F Scene color before character color takeover
GBufferA R10G10B10A2 UNORM World normals and a separate 2-bit object field
GBufferB BGRA8 UNORM Metallic, Specular, deferred-side roughness, and ShadingModel ID
GBufferC BGRA8 sRGB Base color; Alpha in this permutation is not directly interpreted as AO
GBufferD BGRA8 UNORM CustomData attachment; its existence does not mean it contains the facial SDF
GBufferE BGRA8 UNORM Precomputed shadow factors, not dedicated shadow-resolve output
SceneDepth / Stencil D32S8 Geometric occlusion and stencil state

Depth Establishes Surface Position

Figure 6: Linear view depth after BasePass
Figure 6: Linear view depth after BasePass, decoded using this view’s reversed-perspective projection and 10cm near plane. The viewing window is fixed at 2–6m; out-of-range values saturate, and DeviceZ=0 is marked separately. The studio backdrop also has geometry depth.

Depth constrains receiver position. Shadow resolve then uses camera matrices to reconstruct that position and project it into the atlas. Final color alone cannot recover these conditions. A temporarily black character must therefore remain in the depth path.

Figure 7: Raw DeviceZ from the same depth attachment, mapped to grayscale over 0–1
Figure 7: Raw DeviceZ from the same depth attachment, mapped to grayscale over 0–1. This and the preceding metric depth image are two representations of the same data, not two geometry stages.

Direct DeviceZ mapping produces small grayscale differences across visible geometry. A fixed 2–6m window for linear view depth makes relative distance easier to distinguish. Darkness may result from a narrow value range, while out-of-window saturation comes from display clipping; neither establishes missing geometry. Position reconstruction still requires original values and the projection relationship. A windowed PNG cannot recover complete depth data.

Normals and Material Identity Serve Different Consumers

Figure 8: GBufferA world normals
Figure 8: GBufferA world normals, decoded and normalized before mapping direction to RGB. Colors represent world-space directions, not material base color or reflection.
Figure 9: ShadingModel ID decoded from the low four bits of GBufferB.A
Figure 9: ShadingModel ID decoded from the low four bits of GBufferB.A. Pink is ID14, CharacterNPR. This identifies character shading, not individual hair, clothing, or body parts.

The classification record contains 411142 CharacterNPR pixels. Part selection still requires material bindings and shader permutations; the pink region cannot recover material slots. Normals supply surface orientation to consumers such as screen-space shadows. Classification and normals originate in the same geometry preparation but have different responsibilities.

Figure 10: GBufferC base-color visualization
Figure 10: GBufferC base-color visualization. This is a surface payload, not SceneColor after dedicated lighting. The attachment uses an sRGB view; all GBuffers must not be decoded in one common color space.
Figure 11: Deferred-side roughness in GBufferB
Figure 11: Deferred-side roughness in GBufferB. The current character branch fixes this field at 1. Dedicated Forward shading still obtains roughness from its own material inputs; this image does not imply that every character surface uses roughness 1.

Geometry payloads and dedicated-shading parameters must be distinguished. Some fields are neutralized to restrict default color contributions, while the dedicated PS still needs the original material parameters. Substituting observed GBuffer values directly into the dedicated BRDF confuses the two paths at their data inputs.

Inspect GBuffer Scalars and Empty Payloads Per Channel

Adjacent channels of one GBuffer can have different meanings. Metallic and Specular in B are deferred-side scalar payloads, while identity occupies the low Alpha bits. Alpha in A is another packed object field. Each channel therefore needs its own visualization and grayscale interpretation.

Figure 12: GBufferB.R metallic payload, displayed over 0–1
Figure 12: GBufferB.R metallic payload, displayed over 0–1. This is still geometry preparation, not the final brightness of metallic reflection.
Figure 13: GBufferB.G Specular payload, displayed over 0–1
Figure 13: GBufferB.G Specular payload, displayed over 0–1. It is recorded separately from metallic and cannot directly be called the pixel’s current specular contribution.
Figure 14: GBufferA packed 2-bit Alpha
Figure 14: GBufferA packed 2-bit Alpha. Although adjacent to RGB normals, it is neither an additional AO map nor the character classification stored in GBufferB.
Figure 15: Actual GBufferC.Alpha payload
Figure 15: Actual GBufferC.Alpha payload. The inspected compiled face output is near zero here, with only a quantization offset. Default-permutation assumptions cannot turn it into complete material AO.

Black or repeated values also require explanation. The inspected face shader does not write the target corresponding to GBufferD. Binding the attachment does not establish an implemented facial SDF. GBufferE carries precomputed shadow factors and is separate from the character shadow mask subsequently generated by Compute.

Figure 16: Recorded GBufferD.R attachment
Figure 16: Recorded GBufferD.R attachment. All four D-channel visualizations in this package are identical, so R represents them here. An empty payload does not establish that a facial direction field was written.
Figure 17: Recorded precomputed shadow factors in GBufferE.R
Figure 17: Recorded precomputed shadow factors in GBufferE.R. All four channel visualizations in this package are identical. This attachment is not the dedicated screen-space shadow resolve.

These observations concern only this capture’s encoding and data. The gallery retains every channel for consistency checks. To explain the implementation, first determine which fields are valid from current compiled outputs, then trace their consumers. An allocated channel does not justify inventing a function for it.

Material Identity, Shader Permutations, and Parameter Inputs

Dedicated shading must first select the correct program from material identity. An editor-selectable enumeration must pass through the compilation environment, GBuffer encoding, and draw classification before it becomes an executable character path.

Check Material Enumeration and GBuffer Encoding Separately

Material enumeration values and shader encoding values differ in the current code. A simplified excerpt follows:

// EngineTypes.h: key mapping in the current source
MSM_CharacterNPR UMETA(DisplayName="Character NPR"),

return (InShadingModel == MSM_CharacterNPR) ? 14u : (uint32)InShadingModel;
// ShadingCommon.ush
#define SHADINGMODELID_CHARACTERNPR 14

The material-side value of MSM_CharacterNPR is 13; GBuffer writes use 14 through the mapping above. The compiler must also set MATERIAL_SHADINGMODEL_CHARACTERNPR. Without it, the preprocessor may remove the relevant #if branch. If parameter changes have no effect, first confirm that the corresponding shader branch was compiled.

The current HLSLMaterialTranslator.cpp sets the compilation define as follows:

if (EnvironmentDefines->HasShadingModel(MSM_CharacterNPR))
{
    OutEnvironment.SetDefine(TEXT("MATERIAL_SHADINGMODEL_CHARACTERNPR"), TEXT("1"));
}

This is only one part of registration. Complete integration also involves material display strings, material properties, GBuffer encoding, render routing, and corresponding shader support. Adding an enum alone does not complete engine integration.

Shader Permutations Select Character Parts

The current FCharacterForwardPassMeshProcessor::Process() reads ECharacterNPRPart. It normally uses the material’s part enumeration, with a CharacterPartType scalar fallback for historical materials, then selects the FCharacterPartDim permutation.

// Current source excerpt: enumeration and historical scalar parsing branches are omitted
FCharacterForwardPS::FPermutationDomain PermutationVector;
PermutationVector.Set<FCharacterForwardPS::FCharacterPartDim>(PartIndex);

FMaterialShaderTypes ShaderTypes;
ShaderTypes.AddShaderType<FCharacterForwardPS>(PermutationVector.ToDimensionValueId());

Indices are Body=0, Skin=1, Eye=2, and Hair=3. Facial and non-facial skin are distinguished within Skin. This avoids consuming another global Shading Model ID for every part and avoids making the dedicated per-draw forward stage infer its current part from the GBuffer.

Early designs considered nested static switches in one master material. The current implementation explicitly selects PS permutations in the Mesh Processor. This selection path determines which program actually runs for a part.

Reuse Vertex Inputs While Keeping Pixel Shading Independent

The pass obtains TBasePassVertexShaderPolicyParamType but uses its own FCharacterForwardPS pixel shader. It can therefore reuse UE’s Vertex Factory, skeletal-mesh, and interpolated-input facilities while implementing independent shading.

TMeshProcessorShaders<
    TBasePassVertexShaderPolicyParamType<LightMapPolicyType>,
    FCharacterForwardPS> PassShaders;

// GetBasePassShaders(..., &PassShaders.VertexShader, nullptr)
// nullptr means the default BasePass Pixel Shader is not requested here.

Resource access, coordinates, material inputs, and output layouts must follow UE’s actual conventions. Reusing a Vertex Factory reduces integration code; tangent handedness and object axes still require separate checks before and after FBX import.

Figure 18: Standard material outputs, explicit parameter bindings, and frame/object resources are separate inputs
Figure 18: Standard material outputs, explicit parameter bindings, and frame/object resources enter through different paths and meet in the character shader. Matching parameter names alone do not establish a connection.

What Material Graphs, Instance Parameters, and Uniforms Carry

Standard outputs such as BaseColor become PixelMaterialInputs, available to the custom PS through functions such as GetMaterialBaseColor. Adding an MI parameter named HairSomething does not automatically create a global HLSL variable with that name. This implementation adds a C++ binding layer that resolves parameters from MaterialRenderProxy, packs them into declared shader vectors, or binds texture resources.

A parameter takes effect only when the asset contains it, instance overrides resolve, the C++ binding name is correct, and the shader has a consumer. A material-instance panel screenshot establishes at most the first two conditions, not that the GPU is using the value.

Standard material outputs compile into PixelMaterialInputs. C++ resolves and packs instance scalars and vectors; explicit SRV/Sampler bindings provide textures. Per-object paths provide object data, while RDG/Uniform paths provide frame resources such as shadows and views. Each entry point in the diagram needs separate verification.

Early build scripts connected _Retain0 to an expression that ultimately evaluated to zero to retain some parameter paths. This was a historical asset-building technique, not an emissive effect or evidence that all lighting was written through Emissive. Newer output interfaces also provide material endpoints such as GetCharacterSourceBaseDiffuse0 and GetCharacterSourceShadowColor00. Shaders check their presence through NUM_MATERIAL_OUTPUTS_... and retain the older path when absent. Interface availability does not mean every master material in this static baseline has migrated to it.

Two Pitfalls in Recovering Parameters from Resource Layouts

Early research recorded 160-byte Body and 400-byte Hair per-material cbuffers. These are resource-layout measurements. Dividing by 16 to obtain 10 and 25 does not give scalar parameter counts; it gives float4-register equivalents that may include vectors, padding, and packed fields. A 400-byte buffer holds at most 100 32-bit components, not necessarily 25 exposed material parameters, and cannot directly recover the source material Inspector’s organization.

Similarly, TEXCOORD0–8 in a pixel shader does not require nine mesh UV sets. Interpolator semantics may carry world position, normals, tangents, colors, and other intermediates. Asset auditing must trace each component’s producer and consumer. UV1 carries packed smooth normals for outlines here; primary texture coordinates, skinned normals, and tangent sign have separate roles.

These corrections affect implementation directly. Rebuilding materials and meshes around ’25 scalar parameters and nine UV sets’ would add unsupported data without explaining the source shader.

From Visibility Collection to RDG Raster

RDG (Render Dependency Graph) describes pass and resource dependencies, while a Mesh Processor turns visible meshes and materials into draw commands. The following starts where objects enter the drawing system.

Figure 19: Material and compilation paths above; current-view runtime path below
Figure 19: Material and compilation paths above; current-view runtime path below. ShaderMap selection during draw construction does not imply recompilation every frame. Registered caching support and actual mesh caching eligibility are shown separately.

Both Static and Dynamic Meshes Must Enter the Dedicated Pass

The first step is visibility and mesh classification. Static meshes use bUseCharacterNPRMaterial to add commands to EMeshPass::CharacterForwardPass. Dynamic meshes set the pass bit according to ViewRelevance.ShadingModelMask and increase the visible mesh-element count. Both entries are required: a visible static test object does not establish that skeletal characters will render.

Excerpt from the current dynamic entry:

if (ViewRelevance.ShadingModelMask & (1 << MSM_CharacterNPR))
{
    PassMask.Set(EMeshPass::CharacterForwardPass);
    View.NumVisibleDynamicMeshElements[EMeshPass::CharacterForwardPass] += NumElements;
}

The second step is the Mesh Processor. It checks again for CharacterNPR and Opaque/Masked blending, then obtains the correct Vertex Factory’s BasePass VS and one of four part-specific custom pixel shaders. This second filter is necessary: primitive relevance classifies visibility but does not replace final checks on each MeshBatch’s material and blend mode.

The third step is engine registration. The current source reads:

REGISTER_MESHPASSPROCESSOR_AND_PSOCOLLECTOR(
    CharacterForwardPass,
    CreateCharacterForwardPassProcessor,
    EShadingPath::Deferred,
    EMeshPass::CharacterForwardPass,
    EMeshPassFlags::CachedMeshCommands | EMeshPassFlags::MainView);

This registers both the creation function and PSO collector on the Deferred path. CachedMeshCommands declares pass-level caching support; whether a character draw is actually cached depends on mesh eligibility. PrimitiveSceneInfo.cpp currently includes !bUseCharacterNPRMaterial in bSupportsCachingMeshDrawCommands, excluding CharacterNPR static meshes from that cache path.

Material Shaders Receive the Current Surface Inputs

FCharacterForwardPS is registered through IMPLEMENT_MATERIAL_SHADER_TYPE to MainPS in /Engine/Private/CharacterForwardPass.usf. It is a material shader rather than a pure GlobalShader limited to global uniforms, so it can access material expression outputs and texture parameters. The shadow compute shader is a GlobalShader with a different responsibility.

IMPLEMENT_MATERIAL_SHADER_TYPE(, FCharacterForwardPS,
    TEXT("/Engine/Private/CharacterForwardPass.usf"), TEXT("MainPS"), SF_Pixel);

BasePass VS still produces surface interpolants. After reading material properties, the PS constructs local GBuffer-style structures for computation. This does not mean a complete GBuffer is written to GPU memory a second time. The actual render targets are only SceneColor/Velocity; the end of the source clears unrelated GBuffer MRT output macros and retains the required outputs.

Shared engine inputs include view, main-light, reflection, and shadow-resource paths. Dedicated logic handles object bases reconstructed from RDC, local-light records, color endpoints, and lookups. Sharing FOpaqueBasePassUniformParameters establishes data access, not automatic equivalence between source APV, every local-light type, or reflection-capture selection and UE.

Scheduling Position and Explicit Resource Dependencies

The relevant current call order in DeferredShadingRenderer.cpp is RenderLights, conditional RenderMegaLights, RenderTranslucencyLightingVolume, then RenderCharacterForward, followed by front-layer translucency and later processing. Current calls and branches define the execution scope; old comments do not establish implementation status.

RenderCharacterForward first checks r.CharacterForward.Enable, obtains each view’s ParallelMeshDrawCommandPasses[CharacterForwardPass], and skips views without a pass or without draw eligibility. It sets the appropriate GPU mask, view parameters, and viewport, and builds rendering commands through GPU Scene/Instance Culling. It does not manually iterate character actors and issue RHI draws.

Excerpt from the current RDG submission:

Pass->BuildRenderingCommands(
    GraphBuilder, Scene->GPUScene, PassParameters->InstanceCullingDrawParams);

GraphBuilder.AddPass(
    RDG_EVENT_NAME("CharacterForward"),
    PassParameters,
    ERDGPassFlags::Raster,
    [&View, Pass, PassParameters](FRDGAsyncTask, FRHICommandList& RHICmdList)
    {
        SetStereoViewport(RHICmdList, View, 1.0f);
        Pass->Draw(RHICmdList, &PassParameters->InstanceCullingDrawParams);
    });

RDG parameters gather View, BasePass Uniform, ReflectionCapture, VirtualShadowMapSamplingParameters, instance-culling parameters, and CharacterForward’s own uniform, and declare MRT and DepthStencil bindings. RDG uses the declared reads and writes to establish dependencies and resource state transitions. Passing a texture pointer alone does not provide that scheduling information.

Trace Each Data Handoff Through a Fabric Surface

Consider the current MI_Example_cloth_01. What appears as one fabric surface involves a SkeletalMeshComponent material slot, visible MeshBatch, Vertex Factory, material RenderProxy, and final Draw Command. These are distinct objects with different update timing.

At the asset level, M_CharacterNPR_Cloth1122 declares surface parameters and resources. Material compilation generates standard surface evaluation code, while CharacterNPR identity includes it in dedicated shader compilation. Visibility determines whether the mesh enters CharacterForwardPass for the current view; the Mesh Processor then obtains the material’s Body permutation, selecting the part program for this draw.

At submission, the skeletal Vertex Factory supplies current-pose vertices, UVs, and tangent bases, interpolated to the PS through a BasePass VS-compatible layout. Material expressions provide BaseColor, Normal, Metallic, Specular, and Roughness; explicit C++ resource bindings add custom Ramp/Packed inputs; RDG uniforms provide View, lighting, and screen-space shadows. These three input groups meet in the PS to supply the fabric color-endpoint and specular calculations discussed here.

Finally, linear color from the dedicated PS is pre-exposed and written over character coverage in the existing SceneColor. Ordinary surface draws preserve existing Velocity, while later outline draws use their own state. Translucency may still overwrite the same pixel afterward, so fabric-draw output validation and final-image validation are separate tasks.

Handoff Data transferred Common failure
Material asset → RenderProxy/ShaderMap Valid parameters, resource references, and available shaders Stale compiled results after changing an instance parent, or incompatible default sampler types
Visibility → Mesh Pass Visible MeshBatch and part material Static entry integrated but skeletal dynamic entry omitted
Vertex Factory → PS Current skinned position, UVs, tangent basis, and handedness Rewritten VS omits skinning/tangent conventions
RDG → Raster Produced mask, correct view, and target state Resource bound to the wrong uniform slot, or an incorrect previous-stage target
PS → SceneColor Pre-exposed RGB for the current draw Duplicate exposure, incorrect BlendWriteMask, or incorrect LoadAction
Current draw → Final frame Color retained or composed as intended Translucent redraw, shadow overlay, default composition, or display processing changes color again

These handoffs define the inputs and outputs of dedicated shading. Reusing UE’s Vertex Factories and scene mechanisms lets changes focus on the new shading and composition responsibilities.

Resource declarations belong to this execution chain. A Texture2D declaration only establishes that the shader has an input. Confirming the correct view and frame requires tracing from the RDG producer through uniform bindings to the SRV on the actual draw.

PSO Descriptions Must Match the Actual MRT Configuration

A PSO (Pipeline State Object) fixes shaders and associated draw states. Its precache description must match the actual targets and states.

The current CollectPSOInitializers sets the target count to 2, assigns the Velocity format to the second target, and clears the remaining target configuration. This matches the actual SceneColor+Velocity bindings.

RenderTargetsInfo.RenderTargetsEnabled = 2;
RenderTargetsInfo.RenderTargetFormats[1] = FVelocityRendering::GetFormat(ShaderPlatform);
RenderTargetsInfo.RenderTargetFlags[1] = FVelocityRendering::GetCreateFlags(ShaderPlatform);
for (uint32 i = 2; i < MaxSimultaneousRenderTargets; ++i)
{
    RenderTargetsInfo.RenderTargetFormats[i] = 0;
    RenderTargetsInfo.RenderTargetFlags[i] = ETextureCreateFlags::None;
}

This is one distinction between integrating with UE and writing HLSL: render states, cached draw commands, PSO declarations, and actual outputs must agree. Compiling one shader successfully does not establish a correct complete pipeline.

Surfaces have four compiled permutations, and PSO collection enumerates the available shaders for these parts. Collector integration establishes the corresponding baseline configurations only; outline modes, platforms, and dynamic states still require individual coverage.

ShaderMap and DDC determine whether file changes reach the current draw. The research verified versions using compilation markers, GUIDs, and captured shaders. File timestamps cannot replace this check, and an incorrect fallback can still produce a plausible screenshot.

Keep Dynamic Inputs and Serialization Boundaries Separate

Material parts and stable render states can participate in draw-command construction. Changing data such as per-frame pose, main-light, and object frames should travel through dynamic inputs rather than being fixed in an unsuitable cache layer. The current fixed capture vectors still need to be generalized accordingly.

Extending Shading Model enumerations affects asset serialization. Early design notes identified risks around changes to sentinels such as MSM_FromMaterialExpression. Existing validation covers the static character scene; compatibility across project assets and other engine material types still requires checking.

The implementation currently uses the legacy path, so the project’s Substrate configuration matters. Switching to Substrate, upgrading the engine, or adding platforms requires rechecking material compilation, GBuffer encoding, and the dedicated pass. The September static screenshots are not compatibility certification.

Shadows Form a Resource Chain with Explicit Consumers

Each shadow-mask pixel depends on receiver position, light projection, atlas region, depth conventions, bias, and filtering. Establish correct visibility before explaining how materials turn it into shading. Fabric may use it to blend color endpoints, while hair may select separate channels.

Produce the Mask and Bind It Through the Correct Uniform

Figure 20: Shadow resources in RDG
Figure 20: Shadow RDG resource flow. Solid lines show the current full-resolution path; gray dashed lines show the retained half-resolution/diagnostic implementation. Atlas selection and channel semantics retain the adaptation limits of the current reconstruction route. The diagram reflects the existing implementation.

Custom screen-space shadows are produced in RDG by BuildCharacterForwardShadowMask, not initiated from a material graph. The function receives SceneTextures, the current View, selected main-character ShadowInfo, and local-light ShadowInfo. It registers existing atlases as RDG External Textures together with world/screen-to-shadow matrices, atlas dimensions, tile boundaries, and depth parameters.

Main-character shadow selection currently targets a PerObject inset atlas. It traverses candidate FProjectedShadowInfo entries, prioritizes those matching the static research light direction, and then compares area. It explicitly avoids treating an arbitrary whole-scene CSM cascade as the complete shadow input. This is not a general CSM/VSM cascade-selection implementation; the selection still contains scene-directed adaptation.

Compute has two execution routes:

The active full-resolution route directly produces a sampleable full-resolution visibility mask from scene depth and shadow atlases. The retained diagnostic route first creates a half-resolution mask, then performs horizontal filtering, vertical filtering, and upsampling.

The source variable remains named HalfShadow, but its size is FullExtent when full resolution is enabled. A HalfRes resource name therefore does not establish active half-resolution blur. The current full-resolution branch skips the three later filtering steps and returns this texture directly. Its occlusion counts and mapping calculations are discussed below.

The resulting texture enters FForwardBasePassTextures.ScreenSpaceShadowMask, then reaches the custom PS through CreateOpaqueBasePassUniformBuffer. This reuses UE’s resource-delivery path while leaving channel semantics to the character implementation. Current intermediate-texture comments define R as the shared directional carrier, G as local light 9 visibility, and B as the hair-specific directional depth-conversion result. Part shaders select their consumers; source t3.G and UE intermediate G must not be paired merely because their letters match.

Figure 21: Shadow inputs, encoding, and part-specific consumers
Figure 21: Shadow data relationships in the fixed source revision. Channels describe the current UE interface and are not automatically equivalent to identically named source-texture channels.

Shadows cast by characters onto the scene and occlusion received by character surfaces share geometry and light information but are different outputs. Casting requires geometry in shadow depth; receiving requires reconstructing receiver position, projecting into the atlas, and evaluating visibility. Self-shadowing means a receiver is occluded by the character itself and does not require a separate self-shadow texture.

Current input selection also includes tile boundaries, projection matrices, dimensions, and offsets. Returning default visibility when inputs are invalid is fallback behavior, not proof that source occlusion has been reconstructed. Validation of a local hair kernel likewise does not establish complete fabric, skin, and arbitrary-scene occlusion coverage.

Figure 22: Current directional shadow atlas, 2048×1024
Figure 22: Current directional shadow atlas, 2048×1024. The red rectangle comes from the shader’s sample clamp range and marks valid sampling bounds. Grayscale represents stored depth, not lighting visibility.
Figure 23: Current local shadow atlas, 2048×2048
Figure 23: Current local shadow atlas, 2048×2048. Its resource and valid range are bound separately from the directional shadow. Image size or dark silhouettes cannot identify the tile.

Who Reads Each Channel, and When Does It Produce a Visible Shadow?

Shadow resolve produces visibility data without directly modifying character color. CharacterForward subsequently reads it at screen coordinates, decodes it, and uses it in the appropriate part-specific shading branch. The following conventions belong to the current UE implementation, not to identically named channels in arbitrary source resources.

Channel Stored quantity Main current consumer Effect on final shading
R Shared directional shadow visibility Relevant ordinary fabric/body and non-facial skin branches Fabric combines visibility with Packed.B and Ramp Alpha to select color endpoints; non-facial skin also uses shared occlusion. Facial skin has separate SDF and material gates
G Hair local-shadow visibility Captured local-light branch for hair Controls this light contribution together with local-light directional support; not a global AO term darkening the entire character
B Selected hair directional-shadow visibility Hair-specific directional-shadow branch Provides independent directional occlusion for hair, retaining a depth interpretation distinct from shared R
A Constant 1 No current additional shadow consumer Reserved; produces no shadow distribution

RGB is written as sqrt(visibility) and squared before consumption. Decoded 1 means unoccluded, 0 means occluded, and intermediate values mean partial visibility. A dark mask region changes a part’s lighting only if the corresponding material branch actually reads and uses it. Dark mask pixels are therefore not equivalent to black pixels in the final screenshot.

For example, fabric uses shadows to select light and dark color endpoints rather than multiplying all composed color toward black. Environment reflection, local lights, and other material terms retain separate combination rules. G constrains the corresponding hair local light and does not automatically darken sleeves. Eyes currently retain a separate simplified path; sharing character identity does not establish consumption of every channel.

The following images cover atlas inputs, stored resolve values, and decoded values. Pure-white A records a constant. R/G/B contain spatial occlusion information whose effect must be interpreted alongside the corresponding material results.

The Active Route Resolves at Full Resolution

The current CharacterForwardShadowChain.usf explicitly uses capture 26’s full-resolution depth-atlas resolve. The half-resolution separable-box route remains for diagnostic A/B comparisons. The earlier four-stage low-resolution design must not be presented as the current default.

The captured kernel has 16 offset groups, each using gather4, for 64 depth-comparison samples per kernel evaluation. Total work also depends on branches, resolve extent, and other channel calculations. Rotation depends on pixel position in a 4×4 pattern, while offset radius also depends on atlas-width conventions. These details affect blocker counts and filter footprints and need individual records rather than the blanket label PCF.

Figure 24: Stored R channel of the full-resolution resolve
Figure 24: Stored R channel of the full-resolution resolve. This UNORM value holds sqrt-encoded shared directional visibility, not linear visibility.
Figure 25: Linear visibility after squaring R; black is occluded and white is visible
Figure 25: Linear visibility after squaring the same R channel; black is occluded and white is visible. Stored and decoded values come from one resource, not two competing shadow algorithms.

Although the debug resource name contains HalfRes, its actual size here is 1920×1080. G and B retain hair-local and selected hair-directional visibility respectively; A is 1. Other channel images remain in the stage index. These images establish that the resolve resource exists and is consumed by subsequent shading, not that a fabric-shadow toggle experiment has been completed.

From Shared Directional Visibility to Hair-Specific Visibility

R’s grayscale image explains shared directional visibility only. G and B serve hair’s local and directional paths, so their spatial distributions need not match R. These are receiver-space intermediates; fabric and skin do not thereby acquire the hair branch.

Figure 26: Sqrt-encoded shadow-resolve G, displayed over 0–1
Figure 26: Sqrt-encoded shadow-resolve G, displayed over 0–1. This carries hair-local visibility.
Figure 27: Linear visibility after squaring the same G channel
Figure 27: Linear visibility after squaring the same G channel. The comparison shows an encoding relationship, not an algorithm improvement or lighting toggle.
Figure 28: Sqrt-encoded shadow-resolve B
Figure 28: Sqrt-encoded shadow-resolve B. It retains selected hair-directional visibility separately from shared R.
Figure 29: Decoded linear visibility from the same B channel
Figure 29: Decoded linear visibility from the same B channel. Black is occluded and white is visible. Dark-region shapes alone cannot identify this as whole-scene AO.

Constant channel: A=1 (white throughout)

Figure 30: Actual shadow-resolve A output is 1
Figure 30: A is reserved and explicitly written as 1. White is the actual data; it contains no additional shadow distribution. The thumbnail links to the complete original image.

Squaring values between 0 and 1 lowers their grayscale intensity, so decoded images may look darker than stored images. This comes from an explicit numerical-domain conversion, not additional occlusion. Sampling stored values without squaring changes the visibility response even when the resource, dimensions, and bindings are correct.

Integer Comparison Masks Affect Visibility Mapping

One significant correction concerned the sign interpretation of source integer comparison masks. DXBC all-bit comparison masks, integer arithmetic, and conversion to float jointly determine the final sign. Translating them as ordinary 0/1 values can reverse shadow mapping.

Excerpt from the current mapping function:

const float SignedCoverage = BlockerCount * (1.0f / 32.0f) - 1.0f;
const float CapturedSign = SignedCoverage < 0.0f
    ? -1.0f : (SignedCoverage > 0.0f ? 1.0f : 0.0f);
const float SignFlip = PreserveLegacySharedSign ? -CapturedSign : CapturedSign;
const float CurveX = 1.0f - SignFlip * SignedCoverage;
const float CurveX3 = CurveX * CurveX * CurveX;
const float BlockerDepthBlend = saturate(
    (PositiveDepthDeltaSum / BlockerCount) / max(ReceiverDepth, 1.0e-8f));
const float CubicVisibility = lerp(CurveX3, CurveX, BlockerDepthBlend);
return saturate(0.5f - 0.5f * SignFlip * (1.0f - CubicVisibility));

The complete function also handles zero blockers explicitly rather than importing source NaN/saturate behavior into HLSL without explanation. PreserveLegacySharedSign deliberately retains the historical deviation in R shared by other parts. The hair fix isolates its corrected result in B to avoid simultaneously changing unaudited fabric and skin paths.

Depth Direction Is Resource-Specific

A blanket ‘Unity uses ordinary Z and UE uses reversed-Z, so apply 1-z everywhere’ is incorrect. Captured camera depth, the source character-shadow atlas, and UE’s native shadow writer can use different conventions. The current hair-shadow path converts writer and receiver depth according to actual evidence rather than merely reversing the comparison sign.

HairReceiverDepth = 1.0f - HairInputDepth applies only to this input path. Changing global Z rules could break other correctly handled paths.

After Matching the Kernel, Check Geometry Inputs

Early diagnosis found no occlusion in source samples for the left hair strands while the corresponding UE atlas kernel still contained many blockers. Further mapping-curve adjustments could not fix this discrepancy. Investigation continued into the actual depth writer, caster geometry, receiver coordinates, filter footprint, and offsets.

The research used DebugThread to recompute compute-shader depth and counts, distinguishing integer ray locations from center-depth sampling conventions. With 8×8 thread groups, pixel (895,221) maps to group (111,27,0) and thread (7,5,0); screen coordinates are not passed directly to the debugging interface.

Shadow projection, filtering, and shared channels still differ from the source pipeline. The fitted special shadow-writer branch is disabled by default. Matching source kernel constants has been established, but pixel-exact equivalence of the complete shadow chain remains unverified.

CharacterForward Takes Over the Same SceneColor

Once the dedicated PS owns character color, any additional contribution from default systems needs an explicit reason. Beyond direct light, BasePass precomputed indirect light, GI, AO, skylight, and reflections each have separate consumers. Editing one deferred-lighting branch cannot isolate them all.

Figure 31: SceneColor before the first character color draw
Figure 31: SceneColor before the first character color draw. Characters have already supplied geometry and identity but remain mostly black; the studio backdrop retains its existing color.
Figure 32: SceneColor after CharacterForward surfaces and the current extruded color draws
Figure 32: SceneColor after CharacterForward surfaces and the current extruded color draws. Both surface and subsequent extruded color draws have executed, placing character color in the existing target.
Figure 33: Same-coordinate fabric close-up before and after color takeover, left to right
Figure 33: Same-coordinate fabric close-up before and after color takeover, left to right. Both use the same HDR viewing transform. This is an event-stage comparison, not a feature-toggle experiment.

Between the two checkpoints, 421268 raw RGB pixels changed, confirming that the CharacterForward pass group modified SceneColor. The ending checkpoint already includes extruded color draws, so this count includes both surface and outline writes. Their independent contributions require checks around individual draws or through PixelHistory. The subsequent ReflectionEnvironmentAndSky event produced zero raw RGB changes in the inspected target. That result is limited to this event in this frame; other GI, AO, reflection paths, and configurations require separate checks.

Figure 34: Nonzero RGB differences across CharacterForward color takeover
Figure 34: Nonzero RGB differences across CharacterForward color takeover. The 421268 changed pixels come from a same-target stage comparison including surface and extruded color writes within the interval. They cannot be separated into independent coverage counts. The mask was generated by offline numerical comparison.
Figure 35: RGB difference mask for the inspected reflection event after CF; black means no change
Figure 35: RGB difference mask for the inspected reflection event after CF. Black means no change in this comparison, not a missing export or validation of every reflection configuration.

The first image locates actual dedicated-color changes; the second checks whether a later consumer changes color again. Their bright and dark masks answer different questions. Apparent visual stability is only a clue. The zero-change finding also relies on the handoff’s raw RGB comparison; inspecting a black image cannot replace numerical checking.

Separate Neutralized Geometry Fields from Dedicated Material Values

The current BasePassPixelShader.usf writes fixed values into some CharacterNPR geometry-buffer channels:

if (GBuffer.ShadingModelID == SHADINGMODELID_CHARACTERNPR)
{
    GBuffer.Roughness = 1.0f;
    GBuffer.GBufferAO = 1.0f;
}

Another branch clears BasePass indirect-light contributions:

DiffuseIndirectLighting = 0;
SubsurfaceIndirectLighting = 0;
IndirectIrradiance = 0;

This prevents the path from adding character environment lighting before the dedicated pass composes it again. GBuffer Roughness=1 is an isolation strategy for downstream reflection consumers, not a requirement that dedicated character highlights use roughness 1. Similarly, fixing GBuffer AO at 1 does not establish complete exclusion of every screen-space AO path; each consumer still requires inspection.

The regular deferred-light shader excludes SHADINGMODELID_CHARACTERNPR. A condition in one shader file does not validate every rendering permutation. Clustered lighting, alternative lighting paths, platforms, and Substrate combinations require separate acceptance checks.

Restrict Default Lighting Consumers Individually

Figure 36: Isolation of default color consumers
Figure 36: Isolation of default color consumers. Red indicates isolation within the corresponding CharacterNPR branch, not a global disabling of scene effects. The character PS uses actual material values; neutralized GBuffer fields serve default consumers only. The diagram reflects the existing implementation.

Suppose dedicated Forward shading correctly outputs character color C. If default GI subsequently adds A, default AO multiplies by k, and default reflections add R, the final result becomes (C+A)×k+R. Adjusting C’s intensity alone cannot correct every surface because A, k, and R vary with normals, position, roughness, and view direction.

The current code handles these entries separately:

  1. BasePass: character GBuffer Roughness/AO are neutralized to 1, and precomputed Diffuse/Subsurface Indirect and IndirectIrradiance are cleared. This geometry-stage contract serves default consumers. The dedicated PS still obtains actual Roughness from material inputs; the mask material is not permanently changed to roughness 1.
  2. Default deferred direct lighting: DeferredLightPixelShaders.usf excludes CharacterNPR at the lighting entry. The shared BxDF fallback remains to preserve transparent paths that still depend on it.
  3. Default indirect/reflection composition: applicable CharacterNPR branches in DiffuseIndirectComposite.usf omit default indirect light and set AO to 1. Relevant skylight and reflection branches in ReflectionEnvironmentPixelShader.usf exclude CharacterNPR.
// DiffuseIndirectComposite.usf: source excerpt.
#if SUBSTRATE_ENABLED == 0 && !FRONT_LAYER_TRANSLUCENCY
const bool bIsCharacterNPR =
    Material.GBufferData.ShadingModelID == SHADINGMODELID_CHARACTERNPR;
#else
const bool bIsCharacterNPR = false;
#endif

// After the subsequent AO calculation:
FinalAmbientOcclusion = bIsCharacterNPR ? 1.0f : FinalAmbientOcclusion;
// The later indirect-light entry also checks IsValid(Material) && !bIsCharacterNPR.

The conditional-compilation scope is an implementation boundary. It does not establish equivalent isolation for Substrate, every front-layer route, or every special lighting path. Current validation is limited to the static legacy CharacterNPR research route.

Ordinary translucency may still call the shared BxDF function, so CharacterNPR’s IntegrateBxDF cannot be globally zeroed. This implementation excludes characters at the deferred-light entry while preserving the shared fallback.

Likewise, source Scene Depth/Stencil and UE CustomDepth are different resources. Setting CustomStencil on a component does not automatically modify stencil bits in the current scene-depth attachment. The stencil contract must be established alongside actual attachments and draw states.

Assign Depth, Stencil, and Velocity Per Draw

Attachment Bindings Define the Pass’s Available Resources

Excerpt from the current RenderCharacterForward():

PassParameters->RenderTargets[0] = FRenderTargetBinding(
    SceneTextures.Color.Target, ERenderTargetLoadAction::ELoad);
PassParameters->RenderTargets[1] = FRenderTargetBinding(
    SceneTextures.Velocity, ERenderTargetLoadAction::ELoad);
PassParameters->RenderTargets.DepthStencil = FDepthStencilBinding(
    SceneTextures.Depth.Target,
    ERenderTargetLoadAction::ELoad,
    ERenderTargetLoadAction::ELoad,
    FExclusiveDepthStencil::DepthWrite_StencilWrite);

The current pass includes outline and stencil experiments and binds SceneColor, Velocity, and writable depth-stencil, so its PSO configuration must match that MRT layout. The older description of SceneColor alone with read-only depth no longer applies. A Velocity binding establishes attachment availability; velocity output across dynamic material types still requires motion validation.

Surfaces Preserve Existing Velocity; Outlines Handle New Coverage

Figure 37: Depth, stencil, velocity, and subsequent coverage
Figure 37: Depth, stencil, velocity, and subsequent coverage. Pass-level target bindings are distinct from per-draw write masks. Shell priming applies only to modes that require it; later translucency and shadow overlays do not share the body’s state. The diagram reflects the existing implementation.

RDG binds SceneColor and Velocity with ELoad to preserve existing contents. DepthStencil also loads existing data and declares depth and stencil write access. This defines what the pass may use; per-draw BlendWriteMask, DepthWrite, and StencilWriteMask determine actual writes.

Ordinary character surfaces currently use CW_RGB, CW_NONE: SceneColor RGB is written while existing Velocity is preserved. Depth uses CF_DepthNearOrEqual without depth writes. Stencil writes only bit 0x10, with reference 16, preserving other bits. Source Equal state is not copied literally to every surface.

DrawRenderState.SetBlendState(
    TStaticBlendStateWriteMask<CW_RGB, CW_NONE>::GetRHI());
DrawRenderState.SetDepthStencilState(
    TStaticDepthStencilState<
        false, CF_DepthNearOrEqual,
        true, CF_Always, SO_Keep, SO_Keep, SO_Replace,
        true, CF_Always, SO_Keep, SO_Keep, SO_Replace,
        0xFF, 0x10>::GetRHI());
DrawRenderState.SetStencilRef(16);

Outlines then override their state to write color and extruded-shell velocity. Modes requiring it first write shell depth and then draw color with Equal testing. This separates existing body velocity from velocity needed for newly covered outline pixels. The specific VS extrusion and reconstruction modes follow below.

Uniformly rebuilding bit4 occupancy on current surfaces is a UE protocol adaptation, not an exact reconstruction of source eyebrow/eye bit4 write history. Source records establish actual test states; equivalent behavior across every occlusion layer and dynamic frame still requires event-level and temporal evidence.

Figure 38: DSV stencil bit4 at the BasePass checkpoint
Figure 38: DSV stencil bit4 at the BasePass checkpoint. Zero here does not mean later character-surface and outline stages leave this bit unchanged. This is distinct from the ShadingModel ID14 classification image.

Stencil visualizations must identify their sampling point. Not seeing later bit4 writes during BasePass is an ordinary lifecycle difference. This image neither represents final-frame stencil nor allows later stencil rules to be projected backward onto earlier coverage.

Actual Changes from Priming to the First Outline Color Draw

This capture completes an initial batch of ordinary surfaces, then reaches three extruded-depth priming checkpoints before subsequent extruded color draws. Raw RGB changes by zero across the first priming operation; the first extruded color draw changes 611 pixels. Priming establishes depth conditions for later coverage and must not be depicted as an already visible outline-color layer.

Figure 39: Same-region close-up around the first extruded color draw
Figure 39: Same-region close-up around the first extruded color draw. This shows a small outline change from one event, not a complete outline on/off experiment.
Figure 40: Nonzero RGB differences from the first extruded color draw
Figure 40: Nonzero RGB differences from the first extruded color draw. This is an offline difference mask, not a newly added engine mask pass.
Figure 41: SceneColor after the initial ordinary character-surface draws
Figure 41: SceneColor after the initial ordinary character-surface draws. The fixed HDR viewing transform provides a comparison baseline for subsequent extruded-depth and color stages.
Figure 42: SceneColor after the first extruded-depth priming operation
Figure 42: SceneColor after the first extruded-depth priming operation. RGB matches the previous checkpoint; this pass primes depth rather than producing visible outline color.
Figure 43: Zero nonzero-RGB difference mask across the first priming operation
Figure 43: The RGB difference mask across the first priming operation is zero. The word depth in the filename does not denote a depth difference; this mask compares color.
Figure 44: SceneColor after the first extruded color draw
Figure 44: SceneColor after the first extruded color draw. Read it alongside the earlier close-up and 611 changed-pixel locations. This is a partial outline event, not an overall outline toggle.

Consecutive checkpoints separate depth priming from color writes: priming changes geometric state, and later color stages consume those conditions. Diagnosing edge intersections requires separate inspection of depth tests and shading outputs. Comparing only ordinary surfaces with the final character makes the failing stage difficult to locate.

Outline Direction, Projected Width, and Depth Offset

Current geometric outlines use a dedicated VS. It obtains skinned attributes through the Vertex Factory, optionally decodes smooth normals from UV1, projects the direction into clip space, and expands in the screen plane.

The UV1 path reconstructs a tangent-space direction from XY and positive Z, then applies TBN. Parameters select RG or BA for the mask: the first component modulates width, the second an independent depth offset. This cannot be reduced to ‘ST.R is width for every part.’

Abbreviated key mathematics from the current outline VS:

projected = mul(float4(worldOutlineNormal, 0), worldToClip);
direction = normalize(projected.xy);       // Actual code guards against zero length
direction.x *= viewportHeight / viewportWidth;
angle = atan(1 / abs(projection[1][1]));
nearFade = saturate(viewDepth * angle * 4.583663);
scale = width * (PI / 8) / angle * 0.005 * 0.28 * nearFade;
offset = direction * scale * clip.w;
// Minimum screen-displacement clamping and separate coverage-experiment gates follow.
clip.xy += offset * mask.x;
clip.z  += mask.y * depthOffset * -0.1;

Multiplying by clip.w keeps expansion closer to a screen-space width after perspective division. Aspect correction prevents horizontal distortion on widescreen views; near-distance attenuation prevents excessive growth near the camera. 0.28 is a UE transform adaptation retained after paired post-VS measurements, not a universal source-material constant.

Minimum displacement has another easily misread scale. After viewport conversion, current 1/width, 1/height offsets correspond to approximately half a pixel per axis, not one pixel. An earlier extra factor of two visibly thickened diagonal outlines. Compare vertex displacement in pixel coordinates before and after extrusion, establish the input scale, and only then adjust material Width.

Establish Shell Depth Before the Corresponding Color Test

The Mesh Processor assigns different high sort bits to surfaces and outlines so ordinary surfaces execute first. Some outline modes additionally prime extruded-shell depth/stencil before drawing color with Equal testing. Equal without the preceding shell depth rejects extruded regions that should remain visible.

Mode Current state meaning Typical use
1 Reversed-Z Greater, depth writes, stencil Replace=36 Face-type outlines
2 Equal, no depth writes, bit4 NotEqual, reference=16 Hair outlines; requires preceding extruded-shell depth
3 Equal, no depth writes, stencil Replace=36 Some fabric outlines, also with a preceding shell step
4–6 Retained direct SceneColor coverage experiments Distinct from the reconstruction states of modes 1–3

The latest live parameter records use mode 1 for facial and body skin and mode 2 for hair. An unexported mode parameter must not be assumed to mean mode 3; resolve defaults or inspect the actual draw. This table explains code-supported states, not a claim that every mode executes in the latest frame.

Outline color also has two routes. A flat-color PS outputs OutlineColor × PreExposure; a material-outline PS continues using the part material, transforms BaseColor brightness/saturation, and additionally clips hair by an ST.G threshold. Material outlines are not simply black shells, so an incorrect color input can make an outline look too heavy even with correct width.

Velocity must follow the extruded shell too. The current outline VS computes the corresponding previous-frame extruded clip position, and the PS outputs shell velocity. Reusing unextruded surface velocity leaves newly covered outline pixels without reliable history. This explains the mechanism, not a completed full-animation or multi-frame TSR validation.

A Single-Frame Velocity Image Describes Only This Attachment

The following velocity images come from the motion attachment after CharacterForward. Ordinary surfaces preserve existing velocity, while extruded color draws may write it. This sampling point differs from the view’s BasePass MRT checkpoint.

Figure 45: Decoded velocity magnitude after CF
Figure 45: Decoded velocity magnitude after CF. The diagnostic range is 0–0.01px; the actual maximum is approximately 0.00247px. Clear regions are marked separately. Bright colors do not indicate large motion.

The current encoding includes square-root gamma and cannot be decoded by one linear scale factor. The saved records use the actual encoding to recover NDC values and then pixel displacement. Non-clear data in a single frame does not validate animation, translucency ghosting, or history invalidation. These dynamic issues remain for P3 and subsequent validation.

From Encoded Velocity to Pixel Displacement

Raw velocity RG includes an encoding offset and gamma, and the clear sentinel must be separated from valid writes. Raw channels, valid regions, and decoded results are shown separately to distinguish encoded values, unwritten regions, and actual pixel displacement.

Figure 46: Raw velocity R, displayed over 0–1
Figure 46: Raw velocity R, displayed over 0–1. The encoding offset has not yet been removed, and values have not been converted to pixel displacement.
Figure 47: Raw velocity G, using the same range as R
Figure 47: Raw velocity G, using the same raw-value range as R. It is not decoded vertical displacement.
Figure 48: Non-clear regions of the velocity attachment
Figure 48: Non-clear regions of the velocity attachment. Validity marks data presence, not large displacement or a passing motion test.

This permutation decodes as follows. NDC-to-pixel scaling uses the view’s 1920×1080 dimensions and accounts for the vertical sign convention.

float2 q = (encodedRG - 32767.0 / 65535.0) / 0.2495;
float2 ndc = 0.5 * q * abs(q);
float2 pixels = ndc * float2(960.0, -540.0);
Figure 49: Decoded horizontal pixel displacement, fixed diagnostic range ±0.01px
Figure 49: Decoded horizontal pixel displacement, fixed diagnostic range ±0.01px. Read sign and magnitude through the legend, not as raw texture grayscale.
Figure 50: Decoded vertical pixel displacement, using the same diagnostic range
Figure 50: Decoded vertical pixel displacement, using the same diagnostic range. Clear regions are marked separately to distinguish them from zero displacement.

Main Color Composition Follows Translucency Attachment Writes

After CharacterForward completes opaque color, ordinary transparent hair cards and the multiplicative shadow overlay enter AfterDOF.Color and AfterDOF.Modulate respectively. These are initially separate attachments, not already modified main scene color.

Figure 51: Accumulated RGB in AfterDOF.Color
Figure 51: Accumulated RGB in AfterDOF.Color. Its nearly black appearance is the actual current output. It uses the common HDR viewing transform without automatic brightening for presentation.
Figure 52: AfterDOF.Color Alpha, representing remaining transmittance
Figure 52: AfterDOF.Color Alpha, representing remaining transmittance. Most pixels are 1, with a local minimum near 0.0500183. This is not conventional opacity.
Figure 53: AfterDOF.Modulate multiplication factors; white is 1
Figure 53: AfterDOF.Modulate multiplication factors; white is 1. This shows the range of factors output by shadow-overlay geometry, not completed final-pixel attribution reserved for P3.

The captured composition shader combines existing scene color, remaining transmittance, and modulation factors, then adds accumulated translucent color. An explanatory expression is:

newRGB = oldRGB * transmittance * modulateRGB + accumulatedTranslucentRGB;

Composition depends on translucent material color, existing scene color, remaining transmittance, and the separate modulation factor. Attachment submission order, blend semantics, and the main-color composition point determine how each input affects the result.

Figure 54: Same-region close-up before and after main-color composition
Figure 54: Same-region close-up before and after main-color composition. Both use the common viewing curve, but the target changes from RGBA16F to R11G11B10F. Differences include format quantization; not every changed pixel can be attributed to translucency or shadow overlay.

This section uses bindings to establish where composition happens and what it consumes. Detailed attribution of final shadow-overlay pixels belongs in P3. The following historical example shows how incorrect transparent-layer depth conditions can overwrite an already generated surface highlight.

Figure 55: Modulate deviation from 1, displayed as abs(factor−1)
Figure 55: Modulate deviation from 1, displayed as abs(factor−1). This locates modulation values in a separate attachment; it is not PixelHistory of final affected scene pixels.
Figure 56: Nonzero differences between the color targets before and after composition
Figure 56: Nonzero differences between the color targets before and after composition. Changes include RGBA16F-to-R11G11B10F quantization; the entire changed region cannot be counted as transparent-material coverage.

The modulation image checks one input, while the composition difference image also includes output-format conversion. Local modulation changes can therefore coexist with widespread numerical differences. Separating shadow overlay, ordinary translucency, and quantization still requires individual numerical attribution, covered in P3.

A Complete Case of Highlights Overwritten by Translucency

The clearest evidence of a pipeline fault often occurs where color is modified. In a historical hair sample, the main opaque draw produced a highlight, but subsequent equal-depth transparent hair cards passed the depth test and left very little underlying color in the final image.

Figure 57: Strict-depth experiment; old state on the left, transparent-redraw depth-condition change only on the right
Figure 57: Strict-depth experiment. Left: old state. Right: only the transparent redraw’s depth condition changed. The right-side highlight is too bright; this is a diagnostic result, not the final reconstruction.

Use Blend Values to Identify the Layer Changing Color

Source transparent hair failed strict depth testing at the corresponding visible strand location. UE’s equal-depth twin instead passed GreaterEqual and covered the opaque hair.

In the historical valid sample, composition received opaque color near (0.255127,0.242188,0.222168), premultiplied translucent color near (0.157837,0.165771,0.151611), and transmittance 0.0500183. Its premultiplied composition was:

Result = premultiplied translucent color + opaque color × transmittance
     ≈ (0.170598, 0.177885, 0.162724)

Only about 5% of the underlying color survived. Even a correct main-shader highlight therefore appeared beneath a gray-green film. Increasing its energy compensated for incorrect coverage rather than restoring the source mechanism.

Change the Comparison Only for the Target Transparent Material

Key excerpt from the current BasePassRendering.cpp:

if (CVarCharacterHairTranslucentStrictDepth.GetValueOnAnyThread() != 0
    && !bDisableDepthTest && !bIsPostMotionBlur
    && Material.GetFriendlyName() == TEXT("M_HairTranslucent"))
{
    FDepthStencilStateInitializerRHI StrictState;
    if (DrawRenderState.GetDepthStencilState()->GetInitializer(StrictState))
    {
        StrictState.DepthTest = CF_Greater;
        const uint32 StencilRef = DrawRenderState.GetStencilRef();
        DrawRenderState.SetDepthStencilState(GCharacterHairStrictDepthStates.Get(StrictState));
        DrawRenderState.SetStencilRef(StencilRef);
    }
}

The code is scoped by material name, controlled by a default-off CVar, and preserves the stencil reference. Cached RHI state follows render-resource lifetime to prevent draw commands from referencing released objects. The current research configuration explicitly enables this switch.

Friendly Name only limits the static research experiment here; it is not a production material identity contract. Asset renaming, instance identity, and name collisions between assets require separate handling. Production integration needs an explicit, stable identity and state-delivery mechanism. Material Usage, shader permutations, or RenderProxy metadata are possible entry points, but the choice still requires validation against material instances and cooking.

This iteration changed depth comparison only. It does not claim to resolve all differences in source depth writes, culling splits, or transparent NPR shading. Source translucency and UE’s old Unlit proxy remain imperfectly equivalent. That scope restriction must accompany the code.

Correcting the Mechanism Exposed Earlier Energy Compensation

A new capture showed the corresponding transparent primitive failing depth while the main opaque shader output remained identical to baseline, matching the prediction. The image became too bright because the artificial ring and local energy previously added to overcome the overlay were still present.

Subsequent research disabled the artificial ring and reduced hair local-energy control from the historical 7.5 to 1 in separate iterations. Strict depth remained enabled while old energy compensation was removed independently, rather than changing several switches together.

Rim-light issues follow the same investigation: identify the layer producing color, then inspect changes from depth, translucency, and composition. Geometric outlines and silhouette lighting require separate checks; their shared location at an edge does not make them one Rim control.

The responsibilities are distinct: depth testing decides transparent-layer coverage, the main PS produces the underlying highlight, and historical energy compensation changes its magnitude. Validating in that order explains why a correct fix can temporarily make the image brighter.

From Intermediate HDR to Final Display

Remove PreExposure Before Comparing Color

In a historical main-hair sample, UE trace output was approximately (0.255147,0.242260,0.222258) and source output (0.133311,0.123497,0.112614). UE’s raw values are higher, but comparison requires a common exposure domain.

But UE’s output includes PreExposure=2.4505558. Removing it gives a red channel near 0.104118, below the source’s 0.133311. Comparing raw render-target values incorrectly reverses the adjustment direction.

Color passes through material terms, scene-linear composition, pre-exposed HDR render targets, and display-encoded images. Every comparison must identify its domain.

Brightness ratios use scene-linear values after accounting for UE PreExposure; screenshot comparisons retain final display differences. Display transforms affect average PNG brightness, preventing direct validation of HDR BRDF algebra. The energy of one material term is also insufficient to determine the final visible intensity of an entire highlight.

Validate the Display Chain Separately from Material Lighting

Current SceneScale=1.15, historical BaseTint, and local composition ratios in particular remain labeled as compensation. They affect the overall displayed relationship and cannot be silently omitted when validating formulas. Similar final screenshots alone do not establish source-equivalent lighting.

Figure 58: HDR SceneColor after translucency composition
Figure 58: HDR SceneColor after translucency composition. PreExposure is removed and the fixed compression curve applied. Its brightness is not directly comparable with the final display image.
Figure 59: Bloom input actually consumed by UberPost, 960×540
Figure 59: Bloom input actually consumed by UberPost, 960×540. Resource dimensions and the common HDR viewing transform are preserved. This identifies the input source without claiming algorithmic equivalence to the original game.
Figure 60: Final FXAA output of this frame
Figure 60: Final FXAA output of this frame. The evidence provider reports exact 8-bit RGB agreement with the existing final PNG, and RGB equality was also checked during editing. This reuses the existing result; no new rendering was performed.

The final route takes composed HDR through UE Bloom and custom UberPost, then FXAA and the output target. UberPost’s floating-point attachment already carries display-domain color; its format does not justify removing PreExposure or applying sRGB again. These stages connect the pipeline to the image readers see. Temporal choices, Bloom reconstruction fidelity, and display compensation remain dedicated topics for P3.

Reconstruction scope: source TAAU (Temporal Anti-Aliasing Upsampling) has not been restored. The final frame shown here uses FXAA, and multi-frame TSR behavior has not been validated. Bloom currently uses a UE Gaussian-pyramid substitute rather than a complete reconstruction of the source implementation. These static results therefore do not validate temporal stability or source post-processing equivalence; reconstruction and comparison experiments remain topics for Part 3.

Figure 61: Display-domain UberPost output, followed by this frame's FXAA
Figure 61: Display-domain UberPost output, followed by this frame’s FXAA. Despite the floating-point attachment format, the earlier HDR de-pre-exposure and viewing-compression transform is not applied again.

Comparing this image with final FXAA locates the last stage boundary before display output. They are adjacent checkpoints, not an independent anti-aliasing on/off experiment. Small differences do not establish reconstruction of TSR or source TAAU. The actual output is retained to connect scene HDR, display-domain color, and final PNG completely.

Cost and Scope: The Price of Expressiveness

This path evaluates character-specific semantics during material drawing, making part-specific textures, directions, and lighting rules easier to organize. Costs span geometry, pixels, bandwidth, and state maintenance. The table lists their scaling variables; like-for-like GPU timings are not yet available.

Cost source Current work Main scaling factors
Geometry and material evaluation Dedicated surface-color submission after BasePass preparation Visible character count, skinned vertices, material complexity, and screen coverage
Shadow resolve Full-resolution receiver reconstruction and shadow-depth sampling Output resolution, executed region, kernel path, and channel branches
Outline geometry Additional extrusion-priming and color draws by mode Material slots, visible meshes, outline modes, and character count
Buffer reads/writes Retained GBuffer and SceneColor, shadow, and velocity access Resolution, target formats, actual write masks, and read counts
Translucent coverage and composition Hair cards, modulation attachment, and fullscreen Compose Screen coverage, layer count, depth rejection, and attachment formats
Shaders and PSOs Part permutations combined with depth, stencil, and target-format states Platforms, material variants, state count, and caching strategy
CPU collection and submission Visibility filtering, Mesh Processor, and Draw Commands Visible MeshBatches, dynamic data, and actual caching eligibility

The second drawing step does not mean characters execute complete lighting twice. BasePass geometry/material payloads, dedicated surface-PS shading, and extruded shells need separate measurement. Isolation of default color consumers also changes actual work. Real execution and timing determine whether a case is limited by vertices, pixels, bandwidth, or CPU submission.

The shadow section’s 16 gather4 groups describe depth-sample scale for a particular kernel path, not 64 independent texture instructions. Multiplying that count by fullscreen pixels does not yield frame time. Receiver eligibility, hair-specific branches, caching, and other work all affect total cost. This illustrates why kernel size matters, not a substitute for profiling.

Further scaling evaluation should record GPU time separately for BasePass, character surfaces, shadow resolve, shells, translucency, and composition, alongside character count, screen coverage, resolution, lighting conditions, and CPU submission time. Varying these factors individually can identify optimization targets. This is a proposed measurement method, not an existing test result.

Current evidence comes from static research on the legacy material path. Substrate, other platforms, packaging, multiple characters, and continuous frames require separate checks. Fixed captured environment inputs and some local-light adaptations also limit arbitrary-scene generalization. The evidence explains how integration works but does not constitute full production or performance acceptance.

Technical Conclusions: Trace Color Production and Modification

The hybrid pipeline separates geometry preparation from color evaluation. Characters retain occlusion and identity in BasePass, while dedicated CharacterForward owns opaque color production. Explicit input relationships bring material resources, object coordinates, lights, and shadows together so part-specific algorithms can use them in one evaluation.

Responsibilities continue after color takeover. Default lighting must avoid duplicate contributions; outlines use independent shell states to establish new coverage; translucent color and multiplication factors first enter separate attachments before Compose modifies main scene color. Depth priming, resource binding, and draw submission establish execution conditions, while actual color changes require inspecting the corresponding outputs.

Diagnosing a final-image defect requires tracing inputs, draws, attachments, composition, and display. In the translucency case, the surface had already generated a correct highlight and a later layer caused the problem. Fixed GBuffer roughness belongs to the deferred payload and cannot replace dedicated material parameters. These boundaries explain causes more reliably than isolated brightness or highlight adjustments.

P1 establishes the pipeline and color responsibilities; P2 explains individual part shading, and P3 addresses the identified refinement topics. The following capture methodology and Unity comparison provide further reading for checking the implementation without extending static evidence into uncompleted dynamic or cross-platform claims.

Further Reading: Validate Execution Relationships with Captures

Validation layer Required evidence Misinterpretation it can exclude
Material/shader Current Material Interface, part permutation, successful compilation, and shader identifier Default fallback or stale ShaderMap still in use
Geometry stage Retained character Depth/GBuffer coverage and correct identity Removing BasePass breaks geometry consumers
Default-light isolation CharacterNPR pixels avoid duplicate default direct/indirect/reflection processing Global duplicate brightness mistaken for material-formula error
Custom shadows Selected atlas/matrices, resolution, compute events, and returned mask Old HalfRes name or invalid ShadowInfo mistaken for an actual result
Raster CharacterForward event, correct VS/PS, two RTs, and per-draw write masks Function existence mistaken for pass completion
Outlines and translucency PixelHistory around depth prime, outline, and later transparent events Increasing intensity when later layers overwrite correct color
Display Draw HDR, PreExposure, post-process inputs, and final image Exposure mismatch mistaken for failure of every material

The translucency case validates draw state and color ownership. The next article’s pose, Cube, and N1 cases examine geometry, resources, and input transforms. A complete result needs evidence at all these levels.

Lock Down the Event, Target, and Actual Viewport

Existing research used background scripts and native Replay APIs rather than mouse interaction, window switching, or the RenderDoc GUI. Tools first enumerated actions, textures, shader resources, and output states, then located character-part draws.

HighResShot can leave both ordinary 587×330 draws and high-resolution 1920×1080 draws in one RDC. The current viewport may remain low resolution even when the underlying RenderTarget is larger. Pixel debugging must use the selected event’s actual viewport rather than applying high-resolution coordinates to a low-resolution draw.

In the latest valid capture, the main-hair event is 27407, transparent hair is 27821, the actual main-color target is 63351, and the viewport is 1920×1080. These identifiers belong only to that capture. Each new capture requires fresh enumeration rather than treating them as permanent constants.

The exported binding record contains the following information:

output    RT    63351
output    RT    63312
viewport       0,0,1920,1080
...
Texture2D17    30286    firstMip=0    numMips=12
Texture2D18    47352    firstMip=0    numMips=1

This is an excerpt from hair_ps_bindings.tsv. Anonymous Texture2D17 is not an original material parameter name. Its identity requires matching dimensions, format, actual bindings, and instruction consumers. Resource IDs in the original game and UE have no numerical-equivalence meaning.

Identify the Visible Primitive Before Explaining Its Formula

Hair contains many overlapping cards. Multiple primitives can project to one screen location, and projection alone does not establish a passing depth test.

The research first used PixelHistory to identify passing and failing fragments and subsequent overwrites, then debugged the visible primitive’s shader. In a historical source sample at (1000,850), visible front strands belonged to primitive 55; another previously selected primitive, 3039, failed depth. Perfectly reproducing the latter’s formulas would still explain a hidden surface.

Some samples also produced inconsistent histories across replay backends. Fresh independent replay, another backend, and actual render-target contents were cross-checked. A single debugger output is not automatically infallible ground truth.

Make Each Debug Switch Answer a Verifiable Question

Current switches include Pass Enable, part Debug, shadow-chain Debug, and hair Exact/Compensation. Their value is isolating a layer: pass toggles test scheduling, part outputs test permutations, resource outputs test bindings, and component outputs test shading. A closer image after changing several switches does not establish that each corresponds to a source-pipeline parameter.

A debug branch in source does not mean every input number can reach it through a CVar. C++ limits DebugMode ranges, and material permutations remove inapplicable branches. Diagnosis must check entry values, uniform delivery, compilation conditions, and actual output locations together—the same producer–consumer principle used for ordinary material resources.

During implementation, debug colors can first verify connections among material identity, mesh collection, and the dedicated PS. Color isolation, real resources, outlines, and translucency can follow. Retain actual-draw, input-resource, and output checks at each step to eliminate most scheduling faults before integrating complex materials.

Further Reading: Mapping Responsibilities Between Unity and UE

Original-game captures, Unity’s public extension mechanisms, and this UE implementation are three distinct subjects. RDC records draws, resources, states, and compiled shaders, but cannot directly recover the original project’s C# structure or establish standard URP, HDRP, or a particular version from one capture.

This article uses public Unity 6.0 URP and HDRP 17.0 mechanisms to compare corresponding responsibilities. These versions are references for the comparison, not the original game’s version. No separate Unity implementation was built or validated in this work.

Figure 62: Responsibility mapping between Unity extension points and this UE implementation
Figure 62: Responsibility mapping between Unity extension points and this UE implementation. Horizontal links connect functional responsibilities, not interchangeable APIs.
Responsibility Unity interpretation Current UE implementation Essential migration check
Select character drawing entry Custom shader pass selected by the pipeline; URP Renderer Features can schedule it MSM_CharacterNPR identity, visibility classification, and dedicated Mesh Processor Identity is only an entry point; verify actual target-mesh submission
Select part shaders Shaders/variants carry Body, Skin, Eye, and Hair algorithms ECharacterNPRPart and CHARACTER_PART compilation branches Whether parameter changes require recompilation; material names are insufficient
Vertices and skinning Selected pipeline, shader vertex stage, and object data cooperate Reused BasePass VS and skeletal Vertex Factory Matching positions, tangent bases, and current/previous poses
Separate geometry and color stages Provide required depth/normal passes and choose character color independently Retained BasePass/GBuffer/Depth; dedicated PS owns opaque character color Retaining geometry does not require accepting default lighting
Frame-resource dependencies Declare resources and render attachments on the applicable Render Graph path RDG parameters, Uniform Buffers, texture access, and Raster attachments Shader name access does not establish a correct producer or lifetime
Light and shadow interfaces Take over or integrate the selected pipeline’s lights, atlases, and visibility resources Selected atlas → character screen-shadow Compute → BasePass Uniform → PS Light directions, projection matrices, channel semantics, and sampling spaces
Layered surfaces and outlines Each layer needs its own depth, stencil, and blend contract Surface draws, required shell priming, outline draws, and later translucency Do not collapse every layer into a Fresnel material term
Final display Actual project exposure, tone mapping, and post-processing chain Character linear color enters UE PreExposure and subsequent display processing Compare in the same display domain, not an intermediate RT against a final screenshot

Unity’s ShaderLab LightMode tag describes a pass’s role in the rendering pipeline; it is not a one-to-one replacement for a UE Shading Model ID. Pipeline pass-selection logic consumes the former, while the latter also participates in UE material compilation and default shading classification. Renaming a tag to Character does not create a complete character path. Unity 6.0: ShaderLab Pass tags.

Similarly, Unity Render Graph and UE RDG are compared here by their responsibility to declare resource dependencies explicitly, not by identical APIs or scheduling strategies. Unity 6.0 URP examples establish dependencies through RecordRenderGraph, pass data, texture reads, and render-attachment declarations. This UE implementation uses RDG parameters and the Mesh Draw execution chain. Unity 6.0: Write a Render Graph pass.

URP can insert custom passes into the frame through ScriptableRendererFeature. HDRP Custom Pass offers several injection points with different available color, depth, and normal resources. Choose a location according to when inputs are produced and who consumes the outputs. URP pass injection, HDRP Custom Pass injection points.

Object drawing also has a separate selection process: current-camera culling results, character filters, shader passes, and sorting conditions form the draw list. UE distributes corresponding work across relevance, PassMask, Mesh Processor, ShaderMap, GPU Scene, and instance culling. Both sides must select objects and submit draws, but their lifecycles and caching mechanisms differ. Draw objects in a Unity Render Graph pass.

Beyond shader arithmetic, resource and spatial conventions need adaptation. HN’s four channels, tangent bases, lighting and shadow inputs, color domains, and coverage conditions must also agree. Changing a file extension from HLSL to USF does not perform those adaptations.

Complete channels and checkpoints remain in the stage-image index. The article selects stages that explain data handoffs rather than repeating every channel as a full section.

AI Collaboration Retrospective

This article rests on an existing implementation and experiment records. AI work documented in the research included source/shader data-flow analysis, debugging tools, and comparisons. Human reviewers repeatedly examined static appearance, identifying local-highlight, hair-tip, and material differences and redirecting investigation from final color toward inputs, draw states, and actual coverage.

AI handled this blog’s structural split, consolidation of repeated content, figure placement, and wording checks. In the handoff manuscript, path conversion had incorrectly turned a C++ lambda parameter into a Markdown link; it was restored against renderer code at the fixed commit. Other historical runs and numerical results remain those of the research records. UE was not restarted and RDC was not replayed during this editorial work.

Code excerpts explain integration mechanisms, existing captures record behavior under specific static conditions, and diagrams explain responsibilities. The article’s conclusions are limited by the scope of those materials. Source screenshots and algorithm explanations still require human review, and historical experiment images must remain distinct from final results.

The additional evidence grounds pipeline descriptions in actual attachments from one capture. Requested configuration does not replace executed events; GBuffer classification does not replace part identity; raw storage does not replace decoded visibility. Editorial restructuring follows those boundaries. Missing material-toggle experiments remain gaps rather than being counted as completed using stage images.

Complete stage originals (64 images)

1 thought on “Reconstructing Stylized Character Rendering — Part 1: A Hybrid Deferred–Forward Pipeline”

Leave a Comment