Art(shader): Emissive-Gloam master shader (in-shader flicker cadence)
ProjectM/EmissiveGloam — URP HLSL, HDR emission (Bloom-catching), with the readability 'steady=true / flicker=false' channel as a material param (_FlickerAmount), no script. Applied to the staging flora bulbs (cold, flicker). The other two master shaders already exist (Lit URP graph, AnimatedLitShader). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
// 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
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
|
||||
struct Attributes { float4 positionOS : POSITION; };
|
||||
struct Varyings { float4 positionHCS : SV_POSITION; };
|
||||
|
||||
CBUFFER_START(UnityPerMaterial)
|
||||
half4 _EmissionColor;
|
||||
half _FlickerAmount;
|
||||
half _FlickerSpeed;
|
||||
half _Seed;
|
||||
CBUFFER_END
|
||||
|
||||
Varyings vert (Attributes 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
|
||||
}
|
||||
}
|
||||
Fallback Off
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 04c728537846d7a45b3e875647ea4ab0
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user