From a522e7738d75e84cc1ee1491a098421622ef1918 Mon Sep 17 00:00:00 2001 From: yum Date: Fri, 11 Apr 2025 19:17:06 -0700 Subject: add rough ability to nudge tessellation heightmap direction --- math.cginc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'math.cginc') diff --git a/math.cginc b/math.cginc index 6c48a2c..f2b64fa 100644 --- a/math.cginc +++ b/math.cginc @@ -16,7 +16,7 @@ float pow5(float x) } float wrapNoL(float NoL, float k) { -#if 1 +#if 0 // https://www.iro.umontreal.ca/~derek/files/jgt_wrap_final.pdf return pow(max(1E-4, (NoL + k) / (1 + k)), 1 + k); #else @@ -242,4 +242,8 @@ float4 get_quaternion(float3 axis_normal, float theta) { return float4(axis_normal * sin(theta / 2), cos(theta / 2)); } +void calcNormalInScreenSpace(inout float3 normal, float3 objPos) { + normal = normalize(cross(ddy(objPos), ddx(objPos))); +} + #endif // __MATH_INC -- cgit v1.2.3