From 50b0b6c8b292e966a43fe56c6e0bf0a20c1d5b62 Mon Sep 17 00:00:00 2001 From: yum Date: Wed, 4 Jun 2025 15:15:35 -0700 Subject: More ssao and c30 cleanups --- 2ner.cginc | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to '2ner.cginc') 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; -- cgit v1.2.3