summaryrefslogtreecommitdiffstats
path: root/tessellation.cginc
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2025-07-29 14:13:09 -0700
committeryum <yum.food.vr@gmail.com>2025-07-29 14:13:09 -0700
commiteba91b479fb6476fed06b13906d7805f43f879b6 (patch)
tree0075c78dc884d579c884b67cd36372f8af725e39 /tessellation.cginc
parentf1ccfe1d74846df120be984cb09d45ec7e17810c (diff)
Add "gradient xz normals" feature
Take in the gradient of a 2D heightmap (y is up) in one or more channels, sum them up, then convert to normal.
Diffstat (limited to 'tessellation.cginc')
-rw-r--r--tessellation.cginc4
1 files changed, 2 insertions, 2 deletions
diff --git a/tessellation.cginc b/tessellation.cginc
index 23df0d4..7e8c790 100644
--- a/tessellation.cginc
+++ b/tessellation.cginc
@@ -35,7 +35,7 @@ tess_factors patch_constant(InputPatch<v2f, 3> patch) {
// un-transformed and maximally transformed locations. Technically we could
// miss an intersection in the middle, but I haven't noticed any visible
// popping with this approach.
-#if defined(_TESSELLATION_HEIGHTMAP) && (defined(_TESSELLATION_HEIGHTMAP_0) || defined(_TESSELLATION_HEIGHTMAP_1) || defined(_TESSELLATION_HEIGHTMAP_2) || defined(_TESSELLATION_HEIGHTMAP_3))
+#if defined(_TESSELLATION) && (defined(_TESSELLATION_HEIGHTMAP_0) || defined(_TESSELLATION_HEIGHTMAP_1) || defined(_TESSELLATION_HEIGHTMAP_2) || defined(_TESSELLATION_HEIGHTMAP_3))
float max_displacement = max(
max(_Tessellation_Heightmap_0_Scale * 0.5 + _Tessellation_Heightmap_0_Offset,
_Tessellation_Heightmap_1_Scale * 0.5 + _Tessellation_Heightmap_1_Offset),
@@ -123,7 +123,7 @@ v2f domain(
#endif
#endif
-#if (defined(_TESSELLATION_HEIGHTMAP_0) || defined(_TESSELLATION_HEIGHTMAP_1) || defined(_TESSELLATION_HEIGHTMAP_2) || defined(_TESSELLATION_HEIGHTMAP_3))
+#if defined(_TESSELLATION) && (defined(_TESSELLATION_HEIGHTMAP_0) || defined(_TESSELLATION_HEIGHTMAP_1) || defined(_TESSELLATION_HEIGHTMAP_2) || defined(_TESSELLATION_HEIGHTMAP_3))
float height = 0;
#if defined(_TESSELLATION_HEIGHTMAP_0)
float heightmap_0_sample = _Tessellation_Heightmap_0.SampleLevel(bilinear_repeat_s,