summaryrefslogtreecommitdiffstats
path: root/tessellation.cginc
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2025-03-26 00:40:45 -0700
committeryum <yum.food.vr@gmail.com>2025-03-26 00:40:45 -0700
commit36dbdde9a08c66c5be2e8b8b6c822968a73041b6 (patch)
treedf26dbd531b8a665c0af4f38dfd3f78e7e5b1ddb /tessellation.cginc
parent70f30643e6c392535cfbf0b82054bd4b53868833 (diff)
Fix how outlines work with shatterwave & tessellation heightmap
Diffstat (limited to 'tessellation.cginc')
-rw-r--r--tessellation.cginc12
1 files changed, 11 insertions, 1 deletions
diff --git a/tessellation.cginc b/tessellation.cginc
index 8ba2595..faadd72 100644
--- a/tessellation.cginc
+++ b/tessellation.cginc
@@ -62,15 +62,25 @@ v2f domain(
o.uv01 = DOMAIN_INTERP(uv01);
#if defined(_TESSELLATION) && defined(_SHATTER_WAVE)
+#if defined(OUTLINE_PASS)
+ shatterWaveVert(o.objPos.xyz, -o.normal, o.tangent);
+#else
shatterWaveVert(o.objPos.xyz, o.normal, o.tangent);
#endif
+#endif
#if defined(_TESSELLATION_HEIGHTMAP)
float height = _Tessellation_Heightmap.SampleLevel(linear_repeat_s,
o.uv01.xy * _Tessellation_Heightmap_ST.xy + _Tessellation_Heightmap_ST.zw, 0).r *
- _Tessellation_Heightmap_Scale + _Tessellation_Heightmap_Offset;
+ _Tessellation_Heightmap_Scale +
+ _Tessellation_Heightmap_Offset -
+ _Tessellation_Heightmap_Scale * 0.5;
+#if defined(OUTLINE_PASS)
+ o.objPos.xyz += -o.normal * height;
+#else
o.objPos.xyz += o.normal * height;
#endif
+#endif
o.pos = UnityObjectToClipPos(o.objPos);
o.worldPos = mul(unity_ObjectToWorld, float4(o.objPos, 1.0)).xyz;