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,34 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: M_EmissiveGloam_Flora
|
||||
m_Shader: {fileID: 4800000, guid: 04c728537846d7a45b3e875647ea4ab0, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs: []
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _FlickerAmount: 0.35
|
||||
- _FlickerSpeed: 5
|
||||
- _Seed: 0
|
||||
m_Colors:
|
||||
- _EmissionColor: {r: 0.28, g: 2.1000001, b: 3.5, a: 3.5}
|
||||
m_BuildTextureStacks: []
|
||||
m_AllowLocking: 1
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 56d7d6058bb828c4f97d4b2d470512ea
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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