|
Momentum
A library for solving nonlinear optimization problems related to human body kinematics
|
A parameter transform is an abstraction of the joint parameters that maps a model_parameter vector to a joint_parameter vector. More...
#include <parameter_transform.h>
Public Member Functions | |
| VectorX< bool > | computeActiveJointParams (const ParameterSet &ps=allParams()) const |
| Compute activeJointParams based on the transform and the input ParameterSet. | |
| size_t | getParameterIdByName (const std::string &nm) const |
| Return the index of a model parameter from its name. | |
| JointParametersT< T > | apply (const ModelParametersT< T > ¶meters) const |
| Map model parameters to joint parameters using a linear transformation. | |
| JointParametersT< T > | apply (const CharacterParametersT< T > ¶meters) const |
| Map model parameters to joint parameters using a linear transformation. | |
| JointParametersT< T > | zero () const |
| Return rest pose joint parameters. | |
| JointParametersT< T > | bindPose () const |
| Return bind pose joint parameters (same as the rest pose here). | |
| ParameterSet | getScalingParameters () const |
| Get a list of scaling parameters (with prefix "scale_"). | |
| ParameterSet | getRigidParameters () const |
| Get a list of root parameters (with prefix "root_"). | |
| ParameterSet | getPoseParameters () const |
| Return all parameters used for posing the body (excludes scaling parameters, blend shape parameters, or any parameters used for physics). | |
| ParameterSet | getBlendShapeParameters () const |
| Get a list of blend shape parameters. | |
| ParameterSet | getFaceExpressionParameters () const |
| Get a list of face expression parameters. | |
| ParameterSet | getSkinnedLocatorParameters () const |
| Get a list of skinned locator parameters. | |
| ParameterSet | getParameterSet (const std::string ¶meterSetName, bool allowMissing=false) const |
| Get a parameter set, if allowMissing is set then it will return an empty parameter set if no such parameterset is found in the file. | |
| template<typename T2> | |
| ParameterTransformT< T2 > | cast () const |
| ParameterTransformT< T > | simplify (const ParameterSet &enabledParameters) const |
| Create a simplified transform given the enabled parameters. | |
| Eigen::Index | numAllModelParameters () const |
| Dimension of all model parameters, including pose, scaling, marker joints, and blendshape parameters for id and expressions. | |
| Eigen::Index | numJointParameters () const |
| Dimension of the output jointParameters vector. | |
| Eigen::Index | numBlendShapeParameters () const |
| Dimension of identity blendshape parameters. | |
| Eigen::Index | numFaceExpressionParameters () const |
| Dimension of facial expression parameters. | |
| Eigen::Index | numSkinnedLocatorParameters () const |
| Dimension of skinned locator parameters (3 per skinned locator: x, y, z). | |
| Eigen::Index | numSkeletonParameters () const |
| Dimension of skeletal model parameters, including pose parameters, scaling parameters, locator joint parameters etc. | |
| bool | isApprox (const ParameterTransformT< T > ¶meterTransform) const |
Static Public Member Functions | |
| static ParameterTransformT< T > | empty (size_t nJointParameters) |
| Return a ParameterTransform object with no model parameters. | |
| static ParameterTransformT< T > | identity (momentum::span< const std::string > jointNames) |
| Return a ParameterTransform object where the model parameters are identical to the joint parameters. | |
Public Attributes | |
| std::vector< std::string > | name |
| The list of model parameter names. | |
| SparseRowMatrix< T > | transform |
| The sparse mapping matrix that maps model parameters to joint parameters. | |
| Eigen::VectorX< T > | offsets |
| VectorX< bool > | activeJointParams |
| The list of joint parameters that are actually active and influenced from the transform. | |
| ParameterSets | parameterSets |
| Convenience grouping of model parameters. | |
| PoseConstraints | poseConstraints |
| A set of predefined poses. | |
| VectorXi | blendShapeParameters |
| The indices of the parameters that influence blend shapes; blendShapeParameters(0) is the parameter that controls the 0th blend shape, etc. | |
| VectorXi | faceExpressionParameters |
| The indices of the parameters that influence face expressions; faceExpressionParameters(0) is the parameter that controls the 0th face expression parameter, etc. | |
| VectorXi | skinnedLocatorParameters |
| Parameters that control the rest-space positions of the skinned locators. | |
A parameter transform is an abstraction of the joint parameters that maps a model_parameter vector to a joint_parameter vector.
It allows mapping a single model_parameter to multiple joints, and a single joint being influenced by multiple model_parameters. Joint parameters are calculated from model parameters in the following way: <joint_parameters> = <transform> * <model_parameters> + <offsets>
Momentum has three levels of parameter enablement that interact:
When adding a new error function, you typically check activeJointParams_ (level 2) to determine which joint parameter columns to compute Jacobians for. You do NOT need to check model-level enablement — the solver handles that mapping.
Definition at line 62 of file parameter_transform.h.
|
nodiscard |
Map model parameters to joint parameters using a linear transformation.
Definition at line 126 of file parameter_transform.cpp.
References MT_CHECK, MT_PROFILE_FUNCTION, momentum::CharacterParametersT< T >::offsets, momentum::CharacterParametersT< T >::pose, transform, and momentum::EigenStrongType< Derived, EigenType >::v.
|
nodiscard |
Map model parameters to joint parameters using a linear transformation.
Definition at line 110 of file parameter_transform.cpp.
References MT_CHECK, MT_PROFILE_FUNCTION, offsets, momentum::EigenStrongType< Derived, EigenType >::size(), transform, and momentum::EigenStrongType< Derived, EigenType >::v.
Referenced by momentum::Character::bake(), momentum::d_modelParams_d_inputs(), momentum::extractGloveOffsetsFromCharacter(), momentum::extractLocatorsFromCharacter(), momentum::extractSkinnedLocatorsFromCharacter(), momentum::getLocatorError(), momentum::sampleFrames(), momentum::saveMotion(), momentum::saveUsdCharacterWithMotion(), momentum::CharacterStateT< T >::set(), and momentum::Character::splitParameters().
|
nodiscard |
Return bind pose joint parameters (same as the rest pose here).
Definition at line 152 of file parameter_transform.cpp.
References transform, and momentum::EigenStrongType< JointParametersT, ::Eigen::VectorX< T > >::Zero().
Referenced by momentum::loadLocatorsFromBuffer(), momentum::Character::remapLocators(), momentum::Character::remapParameterLimits(), and momentum::Character::simplifySkeleton().
|
nodiscard |
Definition at line 486 of file parameter_transform.cpp.
References activeJointParams, blendShapeParameters, momentum::cast(), faceExpressionParameters, name, offsets, parameterSets, poseConstraints, skinnedLocatorParameters, and transform.
|
nodiscard |
Compute activeJointParams based on the transform and the input ParameterSet.
Definition at line 97 of file parameter_transform.cpp.
References transform.
Referenced by momentum::addRigidTransformNode(), momentum::removeJoints(), and momentum::replaceSkeletonHierarchy().
|
staticnodiscard |
Return a ParameterTransform object with no model parameters.
The model can still perform FK with JointParameters, but it does not have any degrees of freedom for IK.
Definition at line 67 of file parameter_transform.cpp.
References activeJointParams, name, offsets, and transform.
|
nodiscard |
Get a list of blend shape parameters.
Definition at line 501 of file parameter_transform.cpp.
References blendShapeParameters.
Referenced by momentum::addBlendShapeParameters(), momentum::addBlendShapeRegularizer(), momentum::Character::bake(), momentum::buildCalibBodySets(), getPoseParameters(), momentum::HeightErrorFunctionT< T >::HeightErrorFunctionT(), and momentum::trackSequence().
|
nodiscard |
Get a list of face expression parameters.
Definition at line 527 of file parameter_transform.cpp.
References faceExpressionParameters.
Referenced by momentum::addFaceExpressionParameters(), getPoseParameters(), and momentum::HeightErrorFunctionT< T >::HeightErrorFunctionT().
|
nodiscard |
Return the index of a model parameter from its name.
Definition at line 44 of file parameter_transform.cpp.
References momentum::kInvalidIndex, and name.
Referenced by momentum::buildCalibBodySets(), momentum::mapMotionToCharacter(), momentum::parameterSetsFromJson(), momentum::parameterTransformFromJson(), momentum::poseConstraintsFromJson(), and momentum::PoseTransformSolverT< T >::PoseTransformSolverT().
|
nodiscard |
Get a parameter set, if allowMissing is set then it will return an empty parameter set if no such parameterset is found in the file.
Definition at line 55 of file parameter_transform.cpp.
References MT_THROW_IF, and parameterSets.
Referenced by momentum::calibrateModel(), and momentum::trackSequence().
|
nodiscard |
Return all parameters used for posing the body (excludes scaling parameters, blend shape parameters, or any parameters used for physics).
Definition at line 217 of file parameter_transform.cpp.
References getBlendShapeParameters(), getFaceExpressionParameters(), getScalingParameters(), and getSkinnedLocatorParameters().
Referenced by momentum::calibrateLocators(), momentum::calibrateModel(), momentum::trackPosesForFrames(), and momentum::trackSequence().
|
nodiscard |
Get a list of root parameters (with prefix "root_").
Definition at line 173 of file parameter_transform.cpp.
References name.
Referenced by momentum::solveRigidInitialization(), and momentum::trackPosesForFrames().
|
nodiscard |
Get a list of scaling parameters (with prefix "scale_").
Definition at line 157 of file parameter_transform.cpp.
References name.
Referenced by momentum::applyModelParameterScales(), momentum::Character::bake(), momentum::buildCalibBodySets(), momentum::extractIdAndLocatorsFromParams(), getPoseParameters(), momentum::HeightErrorFunctionT< T >::HeightErrorFunctionT(), momentum::refineMotion(), momentum::saveMotion(), and momentum::trackSequence().
|
nodiscard |
Get a list of skinned locator parameters.
Definition at line 513 of file parameter_transform.cpp.
References skinnedLocatorParameters.
Referenced by momentum::addSkinnedLocatorParameters(), and getPoseParameters().
|
staticnodiscard |
Return a ParameterTransform object where the model parameters are identical to the joint parameters.
Definition at line 77 of file parameter_transform.cpp.
References activeJointParams, momentum::kJointParameterNames, momentum::kParametersPerJoint, name, offsets, and transform.
|
nodiscard |
Definition at line 539 of file parameter_transform.cpp.
References activeJointParams, blendShapeParameters, faceExpressionParameters, name, offsets, parameterSets, poseConstraints, skinnedLocatorParameters, and transform.
|
inlinenodiscard |
Dimension of all model parameters, including pose, scaling, marker joints, and blendshape parameters for id and expressions.
Definition at line 157 of file parameter_transform.h.
Referenced by momentum::addBlendShapeRegularizer(), momentum::applyModelParameterScales(), momentum::calibrateLocators(), momentum::calibrateModel(), momentum::computeFloorContactConstraints(), momentum::computeSubsetParameterIndices(), momentum::d_modelParams_d_inputs(), momentum::extractBlendShapeFromParams(), momentum::extractIdAndLocatorsFromParams(), momentum::getLocatorError(), momentum::jointIdentityToModelIdentity(), momentum::loadCharacterWithIdentity(), momentum::loadCharacterWithMotionModelParameterScales(), momentum::mapMotionToCharacter(), momentum::mapMotionToCharacter(), momentum::ModelParametersErrorFunctionT< T >::ModelParametersErrorFunctionT(), momentum::ModelParametersSequenceErrorFunctionT< T >::ModelParametersSequenceErrorFunctionT(), momentum::ParameterTransformT< float >::numSkeletonParameters(), momentum::PoseTransformSolverT< T >::PoseTransformSolverT(), momentum::refineMotion(), momentum::Character::remapLocators(), momentum::Character::remapParameterLimits(), momentum::Character::remapSkinnedLocators(), momentum::Character::remapSkinWeights(), momentum::saveMmo(), momentum::saveMmo(), momentum::CharacterStateT< T >::set(), momentum::subsetParameterTransform(), momentum::trackPosesForFrames(), and momentum::trackSequence().
|
nodiscard |
Dimension of identity blendshape parameters.
Definition at line 201 of file parameter_transform.cpp.
References blendShapeParameters.
Referenced by momentum::ParameterTransformT< float >::numSkeletonParameters().
|
nodiscard |
Dimension of facial expression parameters.
Definition at line 206 of file parameter_transform.cpp.
References faceExpressionParameters.
Referenced by momentum::ParameterTransformT< float >::numSkeletonParameters().
|
inlinenodiscard |
Dimension of the output jointParameters vector.
Definition at line 162 of file parameter_transform.h.
Referenced by momentum::locatorsToSkinnedLocators(), momentum::CharacterStateT< T >::set(), momentum::skinnedLocatorsToLocators(), and momentum::subsetParameterTransform().
|
inlinenodiscard |
Dimension of skeletal model parameters, including pose parameters, scaling parameters, locator joint parameters etc.
basically everything but blendshapes (ids and expressions).
Definition at line 178 of file parameter_transform.h.
|
nodiscard |
Dimension of skinned locator parameters (3 per skinned locator: x, y, z).
Definition at line 211 of file parameter_transform.cpp.
References skinnedLocatorParameters.
Referenced by momentum::ParameterTransformT< float >::numSkeletonParameters().
|
nodiscard |
Create a simplified transform given the enabled parameters.
Definition at line 223 of file parameter_transform.cpp.
References momentum::subsetParameterTransform().
Referenced by momentum::applyModelParameterScales(), and momentum::jointIdentityToModelIdentity().
|
nodiscard |
Return rest pose joint parameters.
Definition at line 146 of file parameter_transform.cpp.
References MT_CHECK, offsets, and transform.
Referenced by momentum::PlaneCollisionQueryT< T >::PlaneCollisionQueryT().
| VectorX<bool> momentum::ParameterTransformT< T >::activeJointParams |
The list of joint parameters that are actually active and influenced from the transform.
Definition at line 73 of file parameter_transform.h.
Referenced by momentum::addRigidTransformNode(), cast(), momentum::fbx_internal::createAnimationCurves(), empty(), identity(), isApprox(), momentum::mapParameterTransformJoints(), momentum::parameterTransformFromJson(), momentum::parseParameterTransform(), momentum::removeJoints(), momentum::replaceSkeletonHierarchy(), momentum::fbx_internal::setupJointAnimCurves(), momentum::subsetParameterTransform(), and momentum::writeParameterTransform().
| VectorXi momentum::ParameterTransformT< T >::blendShapeParameters |
The indices of the parameters that influence blend shapes; blendShapeParameters(0) is the parameter that controls the 0th blend shape, etc.
Definition at line 83 of file parameter_transform.h.
Referenced by momentum::addBlendShapeParameters(), momentum::addBlendShapeRegularizer(), cast(), momentum::fbx_internal::extractBlendShapeWeights(), momentum::extractBlendWeights(), getBlendShapeParameters(), isApprox(), momentum::mapParameterTransformJoints(), numBlendShapeParameters(), momentum::parameterTransformFromJson(), momentum::parameterTransformToJson(), and momentum::subsetParameterTransform().
| VectorXi momentum::ParameterTransformT< T >::faceExpressionParameters |
The indices of the parameters that influence face expressions; faceExpressionParameters(0) is the parameter that controls the 0th face expression parameter, etc.
Definition at line 87 of file parameter_transform.h.
Referenced by momentum::addFaceExpressionParameters(), cast(), momentum::extractFaceExpressionBlendWeights(), momentum::fbx_internal::extractFaceExpressionWeights(), getFaceExpressionParameters(), isApprox(), momentum::mapParameterTransformJoints(), numFaceExpressionParameters(), momentum::parameterTransformFromJson(), momentum::parameterTransformToJson(), and momentum::subsetParameterTransform().
| std::vector<std::string> momentum::ParameterTransformT< T >::name |
The list of model parameter names.
Definition at line 64 of file parameter_transform.h.
Referenced by momentum::addBlendShapeParameters(), momentum::addCameraIntrinsicsParameters(), momentum::addFaceExpressionParameters(), momentum::addRigidTransformNode(), momentum::addSkinnedLocatorParameters(), momentum::applyModelParameterScales(), cast(), empty(), momentum::getAllCameraIntrinsicsParameterSet(), momentum::getCameraIntrinsicsParameterSet(), getParameterIdByName(), getRigidParameters(), getScalingParameters(), identity(), isApprox(), momentum::mapMotionToCharacter(), momentum::mapParameterTransformJoints(), momentum::parameterSetsToJson(), momentum::parameterTransformFromJson(), momentum::parameterTransformToJson(), momentum::parseParameterSets(), momentum::parseParameterTransform(), momentum::parsePoseConstraints(), momentum::poseConstraintsToJson(), momentum::saveCharacter(), momentum::saveMmo(), momentum::saveMotion(), momentum::subsetParameterTransform(), momentum::writeModelDefinition(), momentum::writeParameterLimits(), and momentum::writeParameterTransform().
| Eigen::VectorX<T> momentum::ParameterTransformT< T >::offsets |
Definition at line 70 of file parameter_transform.h.
Referenced by momentum::addRigidTransformNode(), apply(), cast(), empty(), identity(), isApprox(), momentum::mapParameterTransformJoints(), momentum::parameterTransformFromJson(), momentum::parseParameterTransform(), momentum::replaceSkeletonHierarchy(), momentum::subsetParameterTransform(), momentum::writeParameterTransform(), and zero().
| ParameterSets momentum::ParameterTransformT< T >::parameterSets |
Convenience grouping of model parameters.
Definition at line 76 of file parameter_transform.h.
Referenced by momentum::addCameraIntrinsicsParameters(), momentum::addSkinnedLocatorParameters(), momentum::calibrateLocators(), cast(), getParameterSet(), isApprox(), momentum::loadParameters(), momentum::mapParameterTransformJoints(), momentum::parameterSetsToJson(), momentum::refineMotion(), momentum::subsetParameterTransform(), momentum::trackPosesForFrames(), and momentum::writeModelDefinition().
| PoseConstraints momentum::ParameterTransformT< T >::poseConstraints |
A set of predefined poses.
Definition at line 79 of file parameter_transform.h.
Referenced by cast(), momentum::getPoseConstraintParameterLimits(), isApprox(), momentum::loadParameters(), momentum::mapParameterTransformJoints(), momentum::poseConstraintsToJson(), momentum::subsetParameterTransform(), and momentum::writeModelDefinition().
| VectorXi momentum::ParameterTransformT< T >::skinnedLocatorParameters |
Parameters that control the rest-space positions of the skinned locators.
This array will be either empty or have the same size as the number of skinned locators. Each entry maps from a skinned locator index to the first of the three (x,y,z) parameters that control its position. Skinned locators that aren't controlled by the paramete transform will have skinnedLocatorParameters[i] = -1.
Definition at line 95 of file parameter_transform.h.
Referenced by momentum::addSkinnedLocatorParameters(), cast(), getSkinnedLocatorParameters(), isApprox(), momentum::mapParameterTransformJoints(), numSkinnedLocatorParameters(), and momentum::subsetParameterTransform().
| SparseRowMatrix<T> momentum::ParameterTransformT< T >::transform |
The sparse mapping matrix that maps model parameters to joint parameters.
Definition at line 67 of file parameter_transform.h.
Referenced by momentum::addBlendShapeParameters(), momentum::addCameraIntrinsicsParameters(), momentum::addFaceExpressionParameters(), momentum::addRigidTransformNode(), momentum::addSkinnedLocatorParameters(), apply(), apply(), bindPose(), cast(), computeActiveJointParams(), empty(), momentum::gradient_jointParams_to_modelParams(), momentum::gradient_jointParams_to_modelParams(), identity(), isApprox(), momentum::jacobian_jointParams_to_modelParams(), momentum::jacobian_jointParams_to_modelParams(), momentum::jacobian_jointParams_to_modelParams(), momentum::jacobian_jointParams_to_modelParams(), momentum::jacobian_jointParams_to_modelParams(), momentum::mapParameterTransformJoints(), momentum::parameterTransformFromJson(), momentum::parameterTransformToJson(), momentum::parseParameterTransform(), momentum::replaceSkeletonHierarchy(), momentum::subsetParameterTransform(), momentum::times_parameterTransform_times_v(), momentum::writeParameterTransform(), and zero().