From eba91b479fb6476fed06b13906d7805f43f879b6 Mon Sep 17 00:00:00 2001 From: yum Date: Tue, 29 Jul 2025 14:13:09 -0700 Subject: 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. --- tessellation.cginc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tessellation.cginc') 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 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, -- cgit v1.2.3