summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--globals.cginc4
-rw-r--r--tessellation.cginc12
2 files changed, 8 insertions, 8 deletions
diff --git a/globals.cginc b/globals.cginc
index 44d10d5..78f34cd 100644
--- a/globals.cginc
+++ b/globals.cginc
@@ -640,9 +640,9 @@ float _Tessellation_Heightmap_7_Scale;
float _Tessellation_Heightmap_7_Offset;
#endif // _TESSELLATION_HEIGHTMAP_7
-#if defined(_TESSELLATION_HEIGHTMAP_DIRECTION_CONTROL)
+// #if defined(_TESSELLATION_HEIGHTMAP_DIRECTION_CONTROL)
float3 _Tessellation_Heightmap_Direction_Control_Vector;
-#endif // _TESSELLATION_HEIGHTMAP_DIRECTION_CONTROL
+// #endif // _TESSELLATION_HEIGHTMAP_DIRECTION_CONTROL
#if defined(_TESSELLATION_RANGE_FACTOR)
float _Tessellation_Range_Factor_Distance_Near;
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