summaryrefslogtreecommitdiffstats
path: root/tessellation.cginc
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2025-12-03 15:38:16 -0800
committeryum <yum.food.vr@gmail.com>2025-12-03 15:38:16 -0800
commite8f64516cfd27bb0b6ec1bb866909300185a7507 (patch)
tree814a3720c5c659cdba1143f45c048dbc0ed777f8 /tessellation.cginc
parent5ffb79e9f39c1e027155200e72b7678ea111273d (diff)
simplify tessellation heightmap direction control logic
Diffstat (limited to 'tessellation.cginc')
-rw-r--r--tessellation.cginc12
1 files changed, 6 insertions, 6 deletions
diff --git a/tessellation.cginc b/tessellation.cginc
index 168bae5..fdfc3b2 100644
--- a/tessellation.cginc
+++ b/tessellation.cginc
@@ -75,12 +75,12 @@ float4 applyHeightmap(float4 objPos, float2 uv, float3 normal, float3 tangent, f
#if defined(_TESSELLATION_HEIGHTMAP_WORLD_SPACE)
objPos.xyz += mul(unity_WorldToObject, height).xyz;
#else
-#if defined(OUTLINE_PASS) && defined(_TESSELLATION_HEIGHTMAP_DIRECTION_CONTROL)
- float3 heightmap_direction = mul(transpose(-float3x3(normal, tangent, binormal)), _Tessellation_Heightmap_Direction_Control_Vector);
-#elif defined(OUTLINE_PASS) && !defined(_TESSELLATION_HEIGHTMAP_DIRECTION_CONTROL)
- float3 heightmap_direction = -normal;
-#elif !defined(OUTLINE_PASS) && defined(_TESSELLATION_HEIGHTMAP_DIRECTION_CONTROL)
- float3 heightmap_direction = mul(transpose(float3x3(normal, tangent, binormal)), _Tessellation_Heightmap_Direction_Control_Vector);
+#if defined(_TESSELLATION_HEIGHTMAP_DIRECTION_CONTROL)
+ float3 heightmap_direction = normalize(
+ normalize(normal) * _Tessellation_Heightmap_Direction_Control_Vector.x +
+ normalize(tangent) * _Tessellation_Heightmap_Direction_Control_Vector.y +
+ normalize(binormal) * _Tessellation_Heightmap_Direction_Control_Vector.z
+ );
#else
float3 heightmap_direction = normal;
#endif