diff options
| author | yum <yum.food.vr@gmail.com> | 2025-11-01 16:25:42 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2025-11-01 16:25:42 -0700 |
| commit | ea09e3e5425d935ed9dd277c0f1a7488033d2ede (patch) | |
| tree | 8b2009c59409cde4f8e00c96e4ff1536359b9d9f /vertex.cginc | |
| parent | 195df414b5310dec05d509dcc7d91b786419e360 (diff) | |
add l2 -> l infinity norm deformation
Diffstat (limited to 'vertex.cginc')
| -rw-r--r-- | vertex.cginc | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/vertex.cginc b/vertex.cginc index cd3382c..1cbeb6d 100644 --- a/vertex.cginc +++ b/vertex.cginc @@ -59,6 +59,19 @@ #define VERTEX_DEFORM_XY_TUBE_NORM #endif // VERTEX_DEFORMATION_XY_TUBE +#if defined(_VERTEX_DEFORMATION_L2_LINF) +#define VERTEX_DEFORM_L2_LINF_PREAMBLE \ + float t = _Vertex_Deformation_L2_Linf_t +#define VERTEX_DEFORM_L2_LINF_POS \ + objPos = l2_to_linf(objPos.xyz, t) +#define VERTEX_DEFORM_L2_LINF_NORM \ + l2_to_linf_normal(objPos, objNorm, objTan, t) +#else +#define VERTEX_DEFORM_L2_LINF_PREAMBLE +#define VERTEX_DEFORM_L2_LINF_POS +#define VERTEX_DEFORM_L2_LINF_NORM +#endif // _VERTEX_DEFORMATION_L2_LINF + #if defined(_VERTEX_DEFORMATION_SEAL) #define VERTEX_DEFORM_SEAL_PREAMBLE \ float A = _Vertex_Deformation_Seal_A; \ @@ -125,6 +138,10 @@ void deform(inout float3 objPos) { VERTEX_DEFORM_XY_TUBE_POS; } { + VERTEX_DEFORM_L2_LINF_PREAMBLE; + VERTEX_DEFORM_L2_LINF_POS; + } + { VERTEX_DEFORM_SEAL_PREAMBLE; VERTEX_DEFORM_SEAL_POS; } @@ -153,6 +170,10 @@ void deform_normal(inout float3 objPos, inout float3 objNorm, inout float3 objTa VERTEX_DEFORM_XY_TUBE_NORM; } { + VERTEX_DEFORM_L2_LINF_PREAMBLE; + VERTEX_DEFORM_L2_LINF_NORM; + } + { VERTEX_DEFORM_SEAL_PREAMBLE; VERTEX_DEFORM_SEAL_NORM; } @@ -180,7 +201,7 @@ void deform_normal(inout float3 objPos, inout float3 objNorm, inout float3 objTa // that we evaluate the normal deformation at the correct point in space. void undeform_normal(inout float3 objPos, inout float3 objNorm, inout float3 objTan) { const float t = getTime(); - const int kMaxDeformations = 8; + const int kMaxDeformations = 32; // Cache each intermediate position so we can undo stages in reverse order. float3 posHistory[kMaxDeformations + 1]; int posCount = 0; @@ -207,6 +228,13 @@ void undeform_normal(inout float3 objPos, inout float3 objNorm, inout float3 obj posHistory[posCount++] = objPos; } #endif +#if defined(_VERTEX_DEFORMATION_L2_LINF) + { + VERTEX_DEFORM_L2_LINF_PREAMBLE; + VERTEX_DEFORM_L2_LINF_POS; + posHistory[posCount++] = objPos; + } +#endif #if defined(_VERTEX_DEFORMATION_SEAL) { VERTEX_DEFORM_SEAL_PREAMBLE; |
