diff options
| author | yum <yum.food.vr@gmail.com> | 2025-04-11 19:17:06 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2025-04-11 19:17:06 -0700 |
| commit | a522e7738d75e84cc1ee1491a098421622ef1918 (patch) | |
| tree | c08951cdd65f3eccadc17d57d97ea24d7b0b750f /tessellation.cginc | |
| parent | 77ae276b2b6e47d0de8bf0d9c4bbafd4212135b1 (diff) | |
add rough ability to nudge tessellation heightmap direction
Diffstat (limited to 'tessellation.cginc')
| -rw-r--r-- | tessellation.cginc | 11 |
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); |
