diff options
| author | yum <yum.food.vr@gmail.com> | 2025-12-17 18:55:15 -0800 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2025-12-17 18:55:15 -0800 |
| commit | 55a9113a1b7bc23a810606c2ed03d56c55aca060 (patch) | |
| tree | abece3108da673b3de3f7e55aebfcfc3c78d1dc7 | |
| parent | f8102fd756d89476336f9a3a69e9bf8fbc6aa4b7 (diff) | |
implement t blending in axis/point alignment operators
| -rw-r--r-- | vertex_deformation.slang | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/vertex_deformation.slang b/vertex_deformation.slang index 542281b..d3f46bc 100644 --- a/vertex_deformation.slang +++ b/vertex_deformation.slang @@ -158,6 +158,8 @@ public void plane_to_tube_undeform_normal(float3 xyz, inout float3 normal, [Differentiable] public float3 axis_align(float3 xyz, no_diff float3 po, no_diff float3 pp, no_diff float3 r, no_diff float t) { + const float3 xyz0 = xyz; + // We assume that `s` is orthogonal to `r`, and that `r` is normalized. float3 s = normalize(pp - po); float3 sxr = cross(s, r); @@ -191,7 +193,7 @@ public float3 axis_align(float3 xyz, no_diff float3 po, no_diff float3 pp, no_di // Move back into cartesian space. xyz = mul(to_cart, xyz_rsrxs) + po; - return xyz; + return dlerp(xyz0, xyz, t); } public void axis_align_normal(inout float3 xyz, inout float3 normal, @@ -277,6 +279,8 @@ public void tube_to_plane_undeform_normal( [Differentiable] public float3 point_align(float3 xyz, no_diff float3 po, no_diff float3 pp, no_diff float3 r, no_diff float t) { + const float3 xyz0 = xyz; + // We assume that `s` is orthogonal to `r`, and that `r` is normalized. float3 s = normalize(pp - po); float3 sxr = cross(s, r); @@ -304,7 +308,7 @@ public float3 point_align(float3 xyz, no_diff float3 po, no_diff float3 pp, no_d // Move back into cartesian space. xyz = mul(to_cart, xyz_rsrxs) + po; - return xyz; + return dlerp(xyz0, xyz, t); } public void point_align_normal(inout float3 xyz, inout float3 normal, inout float3 tangent, float3 po, float3 pp, float3 r, float t) { |
