Fix camo forward pass on Deferred+ (ComplexLit forward-only path, HalfLambert/X-ray restored)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Fable 5 committed 2026-07-10 19:28:22 +02:00
1 parent b30db72e0c
commit cf794643a6
1 file changed
+17 -6
+17 -6
View File
@@ -7,8 +7,10 @@
// _BaseColor / PBR keywords on the material instance) is unaffected. TWO passes deviate from stock:
// - ForwardLit: fragment is CamoForwardFragment, which reimplements URP's forward shading while
// delegating GI / shadows / clustered lights to URP and applying the camo knobs.
// - GBuffer: fragment is CamoGBufferFragment. The project renders forward, so this pass only feeds
// HTrace WSGI's thin GBuffer - it mirrors the camo body grade (brightness/saturation) onto the
// - GBuffer: fragment is CamoGBufferFragment. The avatar itself is ALWAYS shaded forward (the
// subshader is tagged "ComplexLit" + "UniversalForwardOnly", so on Deferred/Deferred+ the deferred
// lighting is stenciled out for it) - this pass only fills GBuffer data for consumers such as
// HTrace WSGI's thin GBuffer: it mirrors the camo body grade (brightness/saturation) onto the
// albedo and the painted-height AO remap onto the occlusion, so HTrace's injected indirect light
// matches the graded forward look (see PlayerCamoGBuffer.hlsl).
// All other passes (ShadowCaster, DepthOnly, DepthNormals, Meta, ...) are stock URP/Lit.
@@ -123,7 +125,12 @@ Shader "Custom/PlayerCamoLit"
{
"RenderType" = "Opaque"
"RenderPipeline" = "UniversalPipeline"
"UniversalMaterialType" = "Lit"
// "ComplexLit" (not "Lit"): on the Deferred/Deferred+ path URP stencils these pixels out of
// the deferred lighting and shades the object in the forward-only pass instead - required
// because the whole camo look (HalfLambert, specular dampen, visible X-ray half) lives in
// CamoForwardFragment, which deferred lighting would otherwise bypass. The GBuffer pass
// below still runs and fills correct (graded) data for HTrace WSGI.
"UniversalMaterialType" = "ComplexLit"
"IgnoreProjector" = "True"
}
LOD 300
@@ -135,7 +142,9 @@ Shader "Custom/PlayerCamoLit"
Name "ForwardLit"
Tags
{
"LightMode" = "UniversalForward"
// "UniversalForwardOnly" (not "UniversalForward"): drawn by the forward path AND by the
// deferred path's forward-only fallback, so the camo fragment runs on every rendering mode.
"LightMode" = "UniversalForwardOnly"
}
// -------------------------------------
@@ -492,10 +501,12 @@ Shader "Custom/PlayerCamoLit"
// This pass is used when drawing to a _CameraNormalsTexture texture
Pass
{
Name "DepthNormals"
// "DepthNormalsOnly" (not "DepthNormals"): the deferred path's normal prepass draws ONLY this
// tag (deferred objects get their normals from the GBuffer); the forward path draws both.
Name "DepthNormalsOnly"
Tags
{
"LightMode" = "DepthNormals"
"LightMode" = "DepthNormalsOnly"
}
// -------------------------------------