From a522e7738d75e84cc1ee1491a098421622ef1918 Mon Sep 17 00:00:00 2001 From: yum Date: Fri, 11 Apr 2025 19:17:06 -0700 Subject: add rough ability to nudge tessellation heightmap direction --- tessellation.cginc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'tessellation.cginc') 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); -- cgit v1.2.3