summaryrefslogtreecommitdiffstats
path: root/2ner.cginc
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2025-06-04 15:15:35 -0700
committeryum <yum.food.vr@gmail.com>2025-06-04 15:15:35 -0700
commit50b0b6c8b292e966a43fe56c6e0bf0a20c1d5b62 (patch)
tree5ce9ac08e15f016ad5ece59073883cc36f8f1bc4 /2ner.cginc
parent22125db9ed9241cd6613b344a4fa7a99c72b3cfa (diff)
More ssao and c30 cleanups
Diffstat (limited to '2ner.cginc')
-rw-r--r--2ner.cginc18
1 files changed, 11 insertions, 7 deletions
diff --git a/2ner.cginc b/2ner.cginc
index 606262b..820236c 100644
--- a/2ner.cginc
+++ b/2ner.cginc
@@ -250,13 +250,6 @@ float4 frag(v2f i, uint facing : SV_IsFrontFace
i.uv01.xy = eye_effect_00.uv;
#endif
- float3x3 tangentToWorld = float3x3(i.tangent, i.binormal, i.normal);
- float ssao = 1;
-#if defined(_SSAO)
- float2 debug;
- ssao = get_ssao(i, tangentToWorld, debug);
-#endif
-
#if defined(_CUSTOM30) && defined(FORWARD_BASE_PASS) || (!defined(_DEPTH_PREPASS) && defined(SHADOW_CASTER_PASS))
#if defined(_CUSTOM30_BASICCUBE)
Custom30Output c30_out = BasicCube(i);
@@ -266,11 +259,22 @@ float4 frag(v2f i, uint facing : SV_IsFrontFace
Custom30Output c30_out = BasicPlatform(i);
#endif
i.normal = c30_out.normal;
+ i.worldPos = mul(unity_ObjectToWorld, float4(c30_out.objPos, 1));
+ float4 c30_clipPos = UnityObjectToClipPos(i.objPos);
+ float4 c30_screenPos = ComputeScreenPos(c30_clipPos);
+ i.pos = c30_screenPos;
#if !defined(_DEPTH_PREPASS)
depth = c30_out.depth;
#endif
#endif
+ float3x3 tangentToWorld = float3x3(i.tangent, i.binormal, i.normal);
+ float ssao = 1;
+#if defined(_SSAO)
+ float2 debug;
+ ssao = get_ssao(i, tangentToWorld, debug);
+#endif
+
tangentToWorld = float3x3(i.tangent, i.binormal, i.normal);
YumPbr pbr = GetYumPbr(i, tangentToWorld);
pbr.ao *= ssao;