summaryrefslogtreecommitdiffstats
path: root/tessellation.cginc
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2025-04-11 19:17:06 -0700
committeryum <yum.food.vr@gmail.com>2025-04-11 19:17:06 -0700
commita522e7738d75e84cc1ee1491a098421622ef1918 (patch)
treec08951cdd65f3eccadc17d57d97ea24d7b0b750f /tessellation.cginc
parent77ae276b2b6e47d0de8bf0d9c4bbafd4212135b1 (diff)
add rough ability to nudge tessellation heightmap direction
Diffstat (limited to 'tessellation.cginc')
-rw-r--r--tessellation.cginc11
1 files changed, 8 insertions, 3 deletions
diff --git a/tessellation.cginc b/tessellation.cginc
index cc47057..fc79177 100644
--- a/tessellation.cginc
+++ b/tessellation.cginc
@@ -133,11 +133,16 @@ v2f domain(
_Tessellation_Heightmap_Offset +
_Tessellation_Heightmap_Scale * -0.5;
#endif
-#if defined(OUTLINE_PASS)
- o.objPos.xyz += -o.normal * height;
+#if defined(OUTLINE_PASS) && defined(_TESSELLATION_HEIGHTMAP_DIRECTION_CONTROL)
+ float3 heightmap_direction = mul(transpose(-float3x3(o.normal, o.tangent, o.binormal)), _Tessellation_Heightmap_Direction_Control_Vector);
+#elif defined(OUTLINE_PASS) && !defined(_TESSELLATION_HEIGHTMAP_DIRECTION_CONTROL)
+ float3 heightmap_direction = -o.normal;
+#elif !defined(OUTLINE_PASS) && defined(_TESSELLATION_HEIGHTMAP_DIRECTION_CONTROL)
+ float3 heightmap_direction = mul(transpose(float3x3(o.normal, o.tangent, o.binormal)), _Tessellation_Heightmap_Direction_Control_Vector);
#else
- o.objPos.xyz += o.normal * height;
+ float3 heightmap_direction = o.normal;
#endif
+ o.objPos.xyz += heightmap_direction * height;
#endif
o.pos = UnityObjectToClipPos(o.objPos);