From 22125db9ed9241cd6613b344a4fa7a99c72b3cfa Mon Sep 17 00:00:00 2001 From: yum Date: Wed, 4 Jun 2025 14:07:01 -0700 Subject: Fix c30 normals --- 2ner.cginc | 32 +++++++++----------------------- fog.cginc | 4 ++-- 2 files changed, 11 insertions(+), 25 deletions(-) diff --git a/2ner.cginc b/2ner.cginc index fe01972..606262b 100644 --- a/2ner.cginc +++ b/2ner.cginc @@ -189,7 +189,6 @@ float4 frag(v2f i, uint facing : SV_IsFrontFace i.normal = UnityObjectToWorldNormal(i.normal); i.tangent = UnityObjectToWorldNormal(i.tangent); i.binormal = UnityObjectToWorldNormal(i.binormal); - const float3x3 tangentToWorld = float3x3(i.tangent, i.binormal, i.normal); #if defined(_RAYMARCHED_FOG) && defined(FORWARD_BASE_PASS) { @@ -251,6 +250,7 @@ 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; @@ -259,33 +259,19 @@ float4 frag(v2f i, uint facing : SV_IsFrontFace #if defined(_CUSTOM30) && defined(FORWARD_BASE_PASS) || (!defined(_DEPTH_PREPASS) && defined(SHADOW_CASTER_PASS)) #if defined(_CUSTOM30_BASICCUBE) - Custom30Output basic_cube_output = BasicCube(i); - i.pos = UnityObjectToClipPos(basic_cube_output.objPos); - i.normal = basic_cube_output.normal; -#if !defined(_DEPTH_PREPASS) - depth = basic_cube_output.depth; -#endif + Custom30Output c30_out = BasicCube(i); +#elif defined(_CUSTOM30_BASICWEDGE) + Custom30Output c30_out = BasicWedge(i); +#elif defined(_CUSTOM30_BASICPLATFORM) + Custom30Output c30_out = BasicPlatform(i); #endif - -#if defined(_CUSTOM30_BASICWEDGE) - Custom30Output basic_wedge_output = BasicWedge(i); - i.pos = UnityObjectToClipPos(basic_wedge_output.objPos); - i.normal = basic_wedge_output.normal; -#if !defined(_DEPTH_PREPASS) - depth = basic_wedge_output.depth; -#endif -#endif -#endif // FORWARD_BASE_PASS - -#if defined(_CUSTOM30_BASICPLATFORM) - Custom30Output basic_platform_output = BasicPlatform(i); - i.pos = UnityObjectToClipPos(basic_platform_output.objPos); - i.normal = basic_platform_output.normal; + i.normal = c30_out.normal; #if !defined(_DEPTH_PREPASS) - depth = basic_platform_output.depth; + depth = c30_out.depth; #endif #endif + tangentToWorld = float3x3(i.tangent, i.binormal, i.normal); YumPbr pbr = GetYumPbr(i, tangentToWorld); pbr.ao *= ssao; diff --git a/fog.cginc b/fog.cginc index ed99927..8dfd289 100644 --- a/fog.cginc +++ b/fog.cginc @@ -96,9 +96,9 @@ FogResult raymarched_fog(v2f i, FogParams p) } FogResult r; - //r.color.rgb = _Raymarched_Fog_Color; + r.color.rgb = _Raymarched_Fog_Color; //r.color.rgb = saturate(log(linearZ) / 5.0); - r.color.rgb = float3(screen_uv, 0); + //r.color.rgb = float3(screen_uv, 0); r.color.a = d; r.depth = 0.0001; // Very small depth value to render in front return r; -- cgit v1.2.3