@@ -2110,6 +2110,56 @@ M = ((s_x, t_x, r_x),
21102110This operation implies that both input vectors are normalized. A `math/normalize` node could be added to handle non-normalized inputs.
21112111====
21122112
2113+ ===== Quaternion Spherical Linear Interpolation
2114+
2115+ [cols="1h,1,2"]
2116+ |===
2117+ | Operation | `math/quatSlerp` | Spherical linear interpolation operation
2118+ .3+| Input value sockets
2119+ d| `float4 a` | First quaternion
2120+ d| `float4 b` | Second quaternion
2121+ d| `float c` | Unclamped interpolation coefficient
2122+ | Output value sockets
2123+ | `float4 value` | Interpolated value
2124+ |===
2125+
2126+ [CAUTION]
2127+ ====
2128+ This node assumes that both input quaternions are unit.
2129+ ====
2130+
2131+ The `value` output socket value is computed as follows:
2132+
2133+ 1. Let
2134+ .. stem:[a_x], stem:[a_y], stem:[a_z], and stem:[a_w] be the components of stem:[a];
2135+ .. stem:[b_x], stem:[b_y], stem:[b_z], and stem:[b_w] be the components of stem:[b].
2136+ 2. Let latexmath:[d = a_x \cdot b_x + a_y \cdot b_y + a_z \cdot b_z + a_w \cdot b_w].
2137+ 3. If latexmath:[d] is negative,
2138+ .. set latexmath:[d] to latexmath:[-d];
2139+ .. negate all components of the quaternion latexmath:[b].
2140+ 4. If latexmath:[d] is close to positive one within an implementation-defined threshold,
2141+ .. let latexmath:[k_a = 1 - c], latexmath:[k_b = c].
2142+ 5. Else let:
2143+ .. latexmath:[\omega = \arccos(d)];
2144+ .. latexmath:[k_a = \frac{\sin(\omega \cdot (1 - c))}{\sin(\omega)}], latexmath:[k_b = \frac{\sin(\omega \cdot c)}{\sin(\omega)}].
2145+ 6. Set the components of the `value` output socket value using the following expressions:
2146+ +
2147+ [latexmath]
2148+ +++++
2149+ x = a_x \cdot k_a + b_x \cdot k_b \\
2150+ y = a_y \cdot k_a + b_y \cdot k_b \\
2151+ z = a_z \cdot k_a + b_z \cdot k_b \\
2152+ w = a_w \cdot k_a + b_w \cdot k_b
2153+ +++++
2154+
2155+ Since this operation is a shortcut for the combination of arithmetic and trigonometry operations, NaN and infinity values are propagated accordingly.
2156+
2157+ [TIP]
2158+ .Authoring Tip
2159+ ====
2160+ This operation does not implicitly normalize the input quaternions. If needed, that step could be done explicitly by adding `math/normalize` nodes.
2161+ ====
2162+
21132163==== Swizzle Nodes
21142164
21152165===== Combine
0 commit comments