summaryrefslogtreecommitdiffstats
path: root/2ner.cginc
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2025-06-04 13:26:27 -0700
committeryum <yum.food.vr@gmail.com>2025-06-04 13:35:28 -0700
commita13a00f2a28a2ea024dcc93eadd87ecf707f3ab4 (patch)
tree4a997310fbf07d54ceeb900beba97445d9648cd5 /2ner.cginc
parentb76cd52014e7f5a1b6c19a8be66d39cd28199bdc (diff)
fix ssao
Diffstat (limited to '2ner.cginc')
-rw-r--r--2ner.cginc11
1 files changed, 10 insertions, 1 deletions
diff --git a/2ner.cginc b/2ner.cginc
index 284b2b2..fe01972 100644
--- a/2ner.cginc
+++ b/2ner.cginc
@@ -19,6 +19,7 @@
#include "math.cginc"
#include "poi.cginc"
#include "shatter_wave.cginc"
+#include "ssao.cginc"
#include "ssfd.cginc"
#include "tessellation.cginc"
#include "unigram_letter_grid.cginc"
@@ -188,6 +189,7 @@ 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)
{
@@ -249,6 +251,12 @@ float4 frag(v2f i, uint facing : SV_IsFrontFace
i.uv01.xy = eye_effect_00.uv;
#endif
+ 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 basic_cube_output = BasicCube(i);
@@ -278,7 +286,8 @@ float4 frag(v2f i, uint facing : SV_IsFrontFace
#endif
#endif
- YumPbr pbr = GetYumPbr(i);
+ YumPbr pbr = GetYumPbr(i, tangentToWorld);
+ pbr.ao *= ssao;
#if defined(_HARNACK_TRACING)
HarnackTracingOutput harnack_output = HarnackTracing(i);