80 template <
size_t FuncDim>
83 std::span<
const Eigen::Vector3<T>> worldVecs,
84 std::span<
const Eigen::Matrix<T, FuncDim, 3>> dfdvs,
85 std::span<const uint8_t> isPoints,
86 const Eigen::Matrix<T, FuncDim, 1>& weightedResidual,
88 Eigen::Ref<Eigen::VectorX<T>> gradient)
const;
105 template <
size_t FuncDim>
108 std::span<
const Eigen::Vector3<T>> worldVecs,
109 std::span<
const Eigen::Matrix<T, FuncDim, 3>> dfdvs,
110 std::span<const uint8_t> isPoints,
113 Eigen::Ref<Eigen::MatrixX<T>> jacobian,
114 size_t rowIndex)
const;
142 const Eigen::Vector3<T>& sourceNormal,
143 const Eigen::Vector3<T>& targetPosition,
148 Eigen::Ref<Eigen::VectorX<T>> gradient)
const;
154 const Eigen::Vector3<T>& sourceNormal,
155 const Eigen::Vector3<T>& targetPosition,
160 Eigen::Ref<Eigen::MatrixX<T>> jacobian,
161 size_t rowIndex)
const;
184 const Eigen::Vector3<T>& leverArm,
189 Eigen::Ref<Eigen::VectorX<T>> gradient)
const;
196 const Eigen::Vector3<T>& leverArm,
198 std::span<const size_t> adjacentFaces,
202 Eigen::Ref<Eigen::VectorX<T>> gradient)
const;
208 const Eigen::Vector3<T>& leverArm,
213 Eigen::Ref<Eigen::MatrixX<T>> jacobian,
214 size_t rowIndex)
const;
221 const Eigen::Vector3<T>& leverArm,
223 std::span<const size_t> adjacentFaces,
227 Eigen::Ref<Eigen::MatrixX<T>> jacobian,
228 size_t rowIndex)
const;
249 template <
size_t FuncDim>
252 const Eigen::Vector3<T>& worldPos,
253 const Eigen::Matrix<T, FuncDim, 3>& dfdv,
254 const Eigen::Matrix<T, FuncDim, 1>& weightedResidual,
255 const Eigen::Vector3<T>& sourceNormal,
256 const Eigen::Vector3<T>& targetPosition,
257 T normalCorrectionScale,
261 Eigen::Ref<Eigen::VectorX<T>> gradient)
const;
269 template <
size_t FuncDim>
272 const Eigen::Vector3<T>& worldPos,
273 const Eigen::Matrix<T, FuncDim, 3>& dfdv,
275 const Eigen::Vector3<T>& sourceNormal,
276 const Eigen::Vector3<T>& targetPosition,
277 T normalCorrectionScale,
281 Eigen::Ref<Eigen::MatrixX<T>> jacobian,
282 size_t rowIndex)
const;
302 const Eigen::Vector3<T>& worldPos,
303 const Eigen::Vector3<T>&
normal,
305 const Eigen::Vector3<T>& sourceNormal,
306 const Eigen::Vector3<T>& targetPosition,
307 T normalCorrectionScale,
311 Eigen::Ref<Eigen::VectorX<T>> gradient)
const;
332 const Eigen::Vector3<T>& worldPos,
333 const Eigen::Vector3<T>&
normal,
335 const Eigen::Vector3<T>& sourceNormal,
336 const Eigen::Vector3<T>& targetPosition,
337 T normalCorrectionScale,
341 Eigen::Ref<Eigen::MatrixX<T>> jacobian,
342 size_t rowIndex)
const;
362 template <
size_t FuncDim>
365 const Eigen::Vector3<T>& worldPos,
366 const Eigen::Matrix<T, FuncDim, 3>& dfdv,
367 const Eigen::Matrix<T, FuncDim, 1>& weightedResidual,
371 Eigen::Ref<Eigen::VectorX<T>> gradient)
const;
387 const Eigen::Vector3<T>& weightedResidual,
391 Eigen::Ref<Eigen::VectorX<T>> gradient)
const;
407 template <
size_t FuncDim>
410 const Eigen::Vector3<T>& worldPos,
411 const Eigen::Matrix<T, FuncDim, 3>& dfdv,
416 Eigen::Ref<Eigen::MatrixX<T>> jacobian,
417 size_t rowIndex)
const;
437 Eigen::Ref<Eigen::MatrixX<T>> jacobian,
438 size_t rowIndex)
const;
void accumulateVertexGradient(size_t vertexIndex, const Eigen::Vector3< T > &worldPos, const Eigen::Matrix< T, FuncDim, 3 > &dfdv, const Eigen::Matrix< T, FuncDim, 1 > &weightedResidual, const SkeletonStateT< T > &skeletonState, const MeshStateT< T > &meshState, const Character &character, Eigen::Ref< Eigen::VectorX< T > > gradient) const
Accumulates gradient for a skinned mesh vertex.
void accumulateJointGradient(size_t jointIndex, std::span< const Eigen::Vector3< T > > worldVecs, std::span< const Eigen::Matrix< T, FuncDim, 3 > > dfdvs, std::span< const uint8_t > isPoints, const Eigen::Matrix< T, FuncDim, 1 > &weightedResidual, const JointStateListT< T > &jointStates, Eigen::Ref< Eigen::VectorX< T > > gradient) const
Accumulates gradient for vectors attached to a single joint.
void accumulateVertexNormalBlendShapeGradient(size_t vertexIndex, const Eigen::Vector3< T > &leverArm, T scale, std::span< const size_t > adjacentFaces, const SkeletonStateT< T > &skeletonState, const MeshStateT< T > &meshState, const Character &character, Eigen::Ref< Eigen::VectorX< T > > gradient) const
Overload with pre-built adjacency list to avoid O(numFaces) linear scan.
void accumulateVertexNormalBlendShapeJacobian(size_t vertexIndex, const Eigen::Vector3< T > &leverArm, T scale, const SkeletonStateT< T > &skeletonState, const MeshStateT< T > &meshState, const Character &character, Eigen::Ref< Eigen::MatrixX< T > > jacobian, size_t rowIndex) const
Jacobian version of accumulateVertexNormalBlendShapeGradient.
void accumulateVertexGradientWithNormalCorrectionDirect(size_t vertexIndex, const Eigen::Vector3< T > &worldPos, const Eigen::Vector3< T > &normal, T weightedResidual, const Eigen::Vector3< T > &sourceNormal, const Eigen::Vector3< T > &targetPosition, T normalCorrectionScale, const SkeletonStateT< T > &skeletonState, const MeshStateT< T > &meshState, const Character &character, Eigen::Ref< Eigen::VectorX< T > > gradient) const
Scalar-specialized combined vertex gradient + normal rotation correction.
void accumulateVertexNormalCorrectionGradient(size_t vertexIndex, const Eigen::Vector3< T > &sourceNormal, const Eigen::Vector3< T > &targetPosition, T scale, const SkeletonStateT< T > &skeletonState, const MeshStateT< T > &meshState, const Character &character, Eigen::Ref< Eigen::VectorX< T > > gradient) const
Accumulates the gradient CORRECTION for how a mesh normal rotates with joints.
void accumulateVertexJacobianIdentityDfdv(size_t vertexIndex, T scale, const SkeletonStateT< T > &skeletonState, const MeshStateT< T > &meshState, const Character &character, Eigen::Ref< Eigen::MatrixX< T > > jacobian, size_t rowIndex) const
Specialized vertex Jacobian for identity dfdv (FuncDim=3, dfdv=I).
void accumulateVertexJacobianWithNormalCorrectionDirect(size_t vertexIndex, const Eigen::Vector3< T > &worldPos, const Eigen::Vector3< T > &normal, T scale, const Eigen::Vector3< T > &sourceNormal, const Eigen::Vector3< T > &targetPosition, T normalCorrectionScale, const SkeletonStateT< T > &skeletonState, const MeshStateT< T > &meshState, const Character &character, Eigen::Ref< Eigen::MatrixX< T > > jacobian, size_t rowIndex) const
Scalar-specialized combined vertex Jacobian + normal rotation correction.
void accumulateVertexNormalCorrectionJacobian(size_t vertexIndex, const Eigen::Vector3< T > &sourceNormal, const Eigen::Vector3< T > &targetPosition, T scale, const SkeletonStateT< T > &skeletonState, const MeshStateT< T > &meshState, const Character &character, Eigen::Ref< Eigen::MatrixX< T > > jacobian, size_t rowIndex) const
Jacobian version of accumulateVertexNormalCorrectionGradient.
void accumulateVertexGradientWithNormalCorrection(size_t vertexIndex, const Eigen::Vector3< T > &worldPos, const Eigen::Matrix< T, FuncDim, 3 > &dfdv, const Eigen::Matrix< T, FuncDim, 1 > &weightedResidual, const Eigen::Vector3< T > &sourceNormal, const Eigen::Vector3< T > &targetPosition, T normalCorrectionScale, const SkeletonStateT< T > &skeletonState, const MeshStateT< T > &meshState, const Character &character, Eigen::Ref< Eigen::VectorX< T > > gradient) const
Combined vertex gradient + normal rotation correction in a single skinning walk.
void accumulateJointJacobian(size_t jointIndex, std::span< const Eigen::Vector3< T > > worldVecs, std::span< const Eigen::Matrix< T, FuncDim, 3 > > dfdvs, std::span< const uint8_t > isPoints, T scale, const JointStateListT< T > &jointStates, Eigen::Ref< Eigen::MatrixX< T > > jacobian, size_t rowIndex) const
Accumulates Jacobian for vectors attached to a single joint.
void accumulateVertexJacobianWithNormalCorrection(size_t vertexIndex, const Eigen::Vector3< T > &worldPos, const Eigen::Matrix< T, FuncDim, 3 > &dfdv, T scale, const Eigen::Vector3< T > &sourceNormal, const Eigen::Vector3< T > &targetPosition, T normalCorrectionScale, const SkeletonStateT< T > &skeletonState, const MeshStateT< T > &meshState, const Character &character, Eigen::Ref< Eigen::MatrixX< T > > jacobian, size_t rowIndex) const
Jacobian version of the combined vertex gradient + normal correction method.
void accumulateVertexNormalBlendShapeGradient(size_t vertexIndex, const Eigen::Vector3< T > &leverArm, T scale, const SkeletonStateT< T > &skeletonState, const MeshStateT< T > &meshState, const Character &character, Eigen::Ref< Eigen::VectorX< T > > gradient) const
Accumulates the gradient contribution from how mesh normals change with blend shape weights.
void accumulateVertexJacobian(size_t vertexIndex, const Eigen::Vector3< T > &worldPos, const Eigen::Matrix< T, FuncDim, 3 > &dfdv, T scale, const SkeletonStateT< T > &skeletonState, const MeshStateT< T > &meshState, const Character &character, Eigen::Ref< Eigen::MatrixX< T > > jacobian, size_t rowIndex) const
Accumulates Jacobian for a skinned mesh vertex.
void accumulateVertexNormalBlendShapeJacobian(size_t vertexIndex, const Eigen::Vector3< T > &leverArm, T scale, std::span< const size_t > adjacentFaces, const SkeletonStateT< T > &skeletonState, const MeshStateT< T > &meshState, const Character &character, Eigen::Ref< Eigen::MatrixX< T > > jacobian, size_t rowIndex) const
Overload with pre-built adjacency list to avoid O(numFaces) linear scan.
SkeletonDerivativeT(const Skeleton &skeleton, const ParameterTransform ¶meterTransform, const VectorX< bool > &activeJointParams, const ParameterSet &enabledParameters)
Constructs the derivative utility.
void accumulateVertexGradientIdentityDfdv(size_t vertexIndex, const Eigen::Vector3< T > &weightedResidual, const SkeletonStateT< T > &skeletonState, const MeshStateT< T > &meshState, const Character &character, Eigen::Ref< Eigen::VectorX< T > > gradient) const
Specialized vertex gradient for identity dfdv (FuncDim=3, dfdv=I).
T normal(const T &mean, const T &sigma)
Normally distributed value via the global Random singleton.
SkeletonT< float > Skeleton
ParameterTransformT< float > ParameterTransform
Vector< T, Dynamic > VectorX
Dynamic-size column vector. Common return type for solver residuals and parameter vectors.
std::vector< JointStateT< T > > JointStateListT
Structure describing the state of all joints in a skeleton.
std::bitset< kMaxModelParams > ParameterSet
Bitset for model parameter enablement.
A character model with skeletal structure, mesh, and optional components.
Represents the complete state of a model's mesh.
Represents the complete state of a skeleton.