Files
Project-M/Assets/_Project/Shaders/EmissiveGloam.shader
T
kronic 0744cdf4f3 Art: EmissiveGloam DOTS instancing + revive EnemyRigTools + drop dead materials (audit M7/M8)
M8 — ProjectM/EmissiveGloam had no DOTS instancing but is bound to
M_Drowner_EyeGlow on EnemyDrowner.prefab, a baked GHOST prefab that
Entities Graphics renders through BatchRendererGroup. Its skinned sibling
has carried the pragmas since 07-16; this one was simply missed, and murk
hides the symptom (CLAUDE.md: "a dark-lit screenshot MASKS material
bugs"). Added #pragma target 4.5 + multi_compile DOTS_INSTANCING_ON +
UNITY_SETUP_INSTANCE_ID, and a DepthOnly pass so the glows stop being
absent from the URP depth texture (soft particles / SSAO / DoF punch
straight through them otherwise). Verified: shader compiles, isSupported,
2 passes, 0 messages.

M7 — EnemyRigTools was dead at EVERY entry point. All eight hard-coded
prefab paths were deleted by DR-051, and the template check ran BEFORE
the idempotent in-place branch, so even re-running a builder on an
existing prefab failed. The three shipping skinned creatures were
unreproducible. Now the template only matters when there is no output to
edit in place, and a new creature templates off the shipping EnemyDrowner
ghost (GhostTemplate) instead of the deleted Enemy.prefab. Retired the
four menu items that drove the deleted Werewolf/Kaiju/Charger bestiary
rather than leave them advertising entry points that cannot work.

Deleted 19 materials with zero references from any scene, prefab,
ScriptableObject, script or settings asset — verified three ways, not
from the audit's list. Kept everything with a live reference, including
several the audit's asset-only scan called dead but which code loads by
path (M_Skinned_Palette, PixelOutline, M_Env_Fallback).

NOT fixed here, deliberately: MakeMat still points each creature at a
per-PACK Synty atlas rather than the shared palette. That is a visual
decision about the shipping Drowner/Grindylow, not a mechanical fix — the
doc-vs-reality gap gets reconciled in Art_Direction_Lantern instead.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 13:30:43 -07:00

107 lines
4.4 KiB
Plaintext

// Emissive-Gloam — the LANTERN "true vs false light" master shader.
// One shader is the whole palette rule: hue = warm(ours)/cold(gloam)/lure; and the
// load-bearing readability channel is CADENCE — _FlickerAmount 0 = STEADY (true light),
// >0 = guttering FALSE light. Flicker lives in-shader (uses _Time), so it needs no script
// and reads in edit + play. HDR emission so URP Bloom catches it. Unlit: these are glows.
Shader "ProjectM/EmissiveGloam"
{
Properties
{
[HDR] _EmissionColor ("Emission (HDR)", Color) = (0.1, 0.8, 0.5, 1)
_FlickerAmount ("Flicker Amount (0=steady/true, 1=false)", Range(0,1)) = 0.0
_FlickerSpeed ("Flicker Speed", Float) = 6.0
_Seed ("Per-material phase seed", Float) = 0.0
}
SubShader
{
Tags { "RenderType"="Opaque" "RenderPipeline"="UniversalPipeline" "Queue"="Geometry" }
Pass
{
Name "EmissiveGloamUnlit"
Tags { "LightMode"="UniversalForward" }
HLSLPROGRAM
// DOTS instancing (2026-08-06 audit, finding M8): this shader is bound to M_Drowner_EyeGlow on
// EnemyDrowner.prefab — a baked GHOST prefab, so Entities Graphics renders it through
// BatchRendererGroup, which feeds per-instance transforms via DOTS instancing. Without these three
// lines the eyes do not get correct instance data. Its skinned sibling
// (EmissiveGloamSkinned.shader) has carried them since 07-16; this one was simply missed, and a murk
// scene hides the symptom (CLAUDE.md: "a dark-lit screenshot MASKS material bugs").
#pragma target 4.5
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile _ DOTS_INSTANCING_ON
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
struct Attributes
{
float4 positionOS : POSITION;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct Varyings { float4 positionHCS : SV_POSITION; };
CBUFFER_START(UnityPerMaterial)
half4 _EmissionColor;
half _FlickerAmount;
half _FlickerSpeed;
half _Seed;
CBUFFER_END
Varyings vert (Attributes IN)
{
UNITY_SETUP_INSTANCE_ID(IN);
Varyings OUT;
OUT.positionHCS = TransformObjectToHClip(IN.positionOS.xyz);
return OUT;
}
half4 frag (Varyings IN) : SV_Target
{
float t = _Time.y * _FlickerSpeed + _Seed;
// layered sines -> an organic guttering wave in [-1,1]
float wave = 0.6 * sin(t) + 0.4 * sin(t * 2.37 + 1.3);
// f = 1 when steady (_FlickerAmount==0); dips toward (1-_FlickerAmount) as it gutters
float f = 1.0 - _FlickerAmount * (0.5 - 0.5 * wave);
return half4(_EmissionColor.rgb * f, 1.0);
}
ENDHLSL
}
// DepthOnly (2026-08-06 audit, finding L-shader): without it these glows are absent from URP's depth
// texture, so soft particles (marine snow), SSAO and depth-of-field punch straight through them. Costs
// nothing today with two materials; would be a visible bug the moment Emissive-Gloam becomes "every glow
// in the game", which is the A2 variant plan.
Pass
{
Name "DepthOnly"
Tags { "LightMode"="DepthOnly" }
ZWrite On
ColorMask R
HLSLPROGRAM
#pragma target 4.5
#pragma vertex depthVert
#pragma fragment depthFrag
#pragma multi_compile _ DOTS_INSTANCING_ON
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
struct DepthAttributes
{
float4 positionOS : POSITION;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct DepthVaryings { float4 positionHCS : SV_POSITION; };
DepthVaryings depthVert (DepthAttributes IN)
{
UNITY_SETUP_INSTANCE_ID(IN);
DepthVaryings OUT;
OUT.positionHCS = TransformObjectToHClip(IN.positionOS.xyz);
return OUT;
}
half depthFrag (DepthVaryings IN) : SV_Target { return 0; }
ENDHLSL
}
}
Fallback Off
}