From fbcd6a84b64018a93a3fd4e3e15260d921e93d8e Mon Sep 17 00:00:00 2001 From: yum Date: Sat, 14 Jun 2025 20:48:03 -0700 Subject: Add meta pass, limit fog to forward base, add fog dir/indir knobs --- 2ner.cginc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to '2ner.cginc') diff --git a/2ner.cginc b/2ner.cginc index e6d2433..dad0c84 100644 --- a/2ner.cginc +++ b/2ner.cginc @@ -34,6 +34,9 @@ v2f vert(appdata v) { // hide outlines when not locked. return (v2f) (0.0/0.0); #endif +#if defined(_RAYMARCHED_FOG) && !defined(FORWARD_BASE_PASS) + return (v2f) (0.0/0.0); +#endif #if defined(DEPTH_PREPASS) && !defined(_DEPTH_PREPASS) return (v2f) (0.0/0.0); #endif @@ -221,7 +224,7 @@ float4 frag(v2f i, uint facing : SV_IsFrontFace i.tangent = UnityObjectToWorldNormal(i.tangent); i.binormal = UnityObjectToWorldNormal(i.binormal); -#if defined(_RAYMARCHED_FOG) && defined(FORWARD_BASE_PASS) +#if defined(_RAYMARCHED_FOG) { // Many fields are overspecified as .rgb or .xyz. This is because thry's // shader locker will inline those fields (incorrectly) as float4. Unity's @@ -229,6 +232,8 @@ float4 frag(v2f i, uint facing : SV_IsFrontFace // Overspecifying gets around the issue. FogParams fog_params = { _Raymarched_Fog_Color.rgb, + _Raymarched_Fog_Direct_Light_Intensity, + _Raymarched_Fog_Indirect_Light_Intensity, _Raymarched_Fog_Steps, _Raymarched_Fog_Y_Cutoff, _Raymarched_Fog_Dithering_Noise, @@ -301,6 +306,7 @@ float4 frag(v2f i, uint facing : SV_IsFrontFace float4(i.tangent.z, i.binormal.z, i.normal.z, 0), float4(0, 0, 0, 1) ); + #if defined(_CUSTOM30) #if defined(FORWARD_BASE_PASS) || (!defined(_DEPTH_PREPASS) && defined(SHADOW_CASTER_PASS)) #if defined(_CUSTOM30_BASICCUBE) @@ -340,6 +346,14 @@ float4 frag(v2f i, uint facing : SV_IsFrontFace YumPbr pbr = GetYumPbr(i, tangentToWorld); pbr.ao *= ssao; +#if defined(META_PASS) +#if defined(_EMISSION) + return pbr.emission; +#else + return 0; +#endif +#endif + #if defined(_HARNACK_TRACING) HarnackTracingOutput harnack_output = HarnackTracing(i); pbr.albedo = float4(1, 1, 1, 0.2); -- cgit v1.2.3