Dithered Particles: a Deferred pass, so particles reach the depth texture the nebula fogs by
The shader dithered and wrote depth, but its one pass had no LightMode, so under the deferred
camera it drew in the forward pass, after the depth texture is taken from the G-buffer. The
nebula march read no depth there and fogged straight over every dithered particle (missile
trails, explosions, lasers, guns). Same cause and cure as Stardust (2e9d97661): black,
unreflective and emissive in the G-buffer. The colour pass is now ForwardBase only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
36d9d94e81
commit
3f3c59e27d
1 changed files with 38 additions and 0 deletions
|
|
@ -54,6 +54,33 @@ Shader "Aetheria/Dithered Particles"
|
|||
ditherClip(screenUV + i.ditherOffset, c.a);
|
||||
return c;
|
||||
}
|
||||
|
||||
// The particle in the G-buffer: black, unreflective, emissive, so deferred lighting adds nothing and its depth is in the
|
||||
// depth texture the nebula march fogs by. A forward pass draws after that texture is taken, so the fog paints over it.
|
||||
struct GBufferOut
|
||||
{
|
||||
half4 albedo : SV_Target0;
|
||||
half4 specular : SV_Target1;
|
||||
half4 normal : SV_Target2;
|
||||
half4 emission : SV_Target3;
|
||||
};
|
||||
|
||||
GBufferOut frag_deferred(v2f i)
|
||||
{
|
||||
float4 c = tex2D(_MainTex, i.texcoord) * _Color * i.color;
|
||||
float2 screenUV = i.screenPos.xy / i.screenPos.w;
|
||||
ditherClip(screenUV + i.ditherOffset, c.a);
|
||||
GBufferOut o;
|
||||
o.albedo = 0;
|
||||
o.specular = 0;
|
||||
o.normal = half4(.5, 1, .5, 1);
|
||||
float3 light = c.rgb;
|
||||
#ifndef UNITY_HDR_ON
|
||||
light = exp2(-light);
|
||||
#endif
|
||||
o.emission = half4(light, 1);
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 frag_shadow(v2f i) : COLOR
|
||||
{
|
||||
|
|
@ -71,12 +98,23 @@ Shader "Aetheria/Dithered Particles"
|
|||
Tags { "Queue"="AlphaTest" "RenderType"="TransparentCutout" "IgnoreProjector"="True" }
|
||||
Pass
|
||||
{
|
||||
Tags { "LightMode" = "ForwardBase" }
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
ENDCG
|
||||
}
|
||||
Pass
|
||||
{
|
||||
Name "DEFERRED"
|
||||
Tags { "LightMode" = "Deferred" }
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag_deferred
|
||||
#pragma multi_compile ___ UNITY_HDR_ON
|
||||
ENDCG
|
||||
}
|
||||
Pass
|
||||
{
|
||||
Name "ShadowCaster"
|
||||
Tags { "LightMode" = "ShadowCaster" }
|
||||
|
|
|
|||
Loading…
Reference in a new issue