Warum gibt meine Animation nach der Durchführung von Berechnungen auf meinen gemeinsamen Matrizen die richtige Matrixpalette nicht aus? In den Hauttutorials GLTF 2.0 heißt es, wie man die Gelenkmatrix für das Hautberechnen berechnet: < /p>
jointMatrix(j) =
globalTransformOfNodeThatTheMeshIsAttachedTo^-1 *
globalTransformOfJointNode(j) *
inverseBindMatrixForJoint(j);
< /code>
Ich mache das für meine Animation Engine: < /p>
void Animation::DoSampleJob(AnimJobSubmitInfo& job, r32 gt)
{
if (!job._output->_currState._bEnabled) { return; }
// This part is just calculating the local time progression, no issue here.
r32 tau = job._output->_currState._tau;
r32 rate = job._output->_currState._fPlaybackRate;
r32 lt = job._output->_currState._fCurrLocalTime + gt * rate;
if (lt > job._pBaseClip->_fDuration) {
lt -= job._pBaseClip->_fDuration;
job._output->_currState._tau = gt;
}
if (lt < 0.0f) {
lt = job._pBaseClip->_fDuration + lt;
if (lt < 0.0f) {
lt += job._pBaseClip->_fDuration;
job._output->_currState._tau = gt;
}
}
job._output->_currState._fCurrLocalTime = lt;
Skeleton* pSkeleton = Skeleton::GetSkeleton(job._pBaseClip->_skeletonId);
u32 currPoseIdx = 0;
u32 nextPoseIdx = 0;
GetCurrentAndNextPoseIdx(&currPoseIdx, &nextPoseIdx, job._pBaseClip, lt);
ApplyMorphTargets(job._output, job._pBaseClip, currPoseIdx, nextPoseIdx, lt);
if (EmptyPoseSamples(job._pBaseClip, currPoseIdx, nextPoseIdx)) { return; }
AnimPose* currAnimPose = &job._pBaseClip->_aAnimPoseSamples[currPoseIdx];
AnimPose* nextAnimPose = &job._pBaseClip->_aAnimPoseSamples[nextPoseIdx];
for (size_t i = 0; i < job._pBaseClip->_aAnimPoseSamples[currPoseIdx]._aLocalPoses.size(); ++i) {
JointPose* currJoint = &currAnimPose->_aLocalPoses[i];
JointPose* nextJoint = &nextAnimPose->_aLocalPoses[i];
Matrix4 localTransform = LinearInterpolate(currJoint, nextJoint, currAnimPose->_time, nextAnimPose->_time, lt);
job._output->_currentPoses[i] = localTransform;
}
ApplySkeletonPose(job._output->_finalPalette, job._output->_currentPoses, pSkeleton);
}
void Animation::ApplySkeletonPose(Matrix4* pOutput, Matrix4* pLocalPoses, Skeleton* pSkeleton)
{
if (!pSkeleton) return;
// This is where the issue is at, somewhere...
for (size_t i = 0; i < pSkeleton->_joints.size(); ++i) {
Matrix4 parentTransform;
Matrix4 currentPose;
u8 parentId = pSkeleton->_joints[i]._iParent;
if (parentId != Joint::kNoParentId) {
parentTransform = pLocalPoses[parentId];
}
// Now become world space joint matrices
currentPose = pLocalPoses[i] * parentTransform;
pLocalPoses[i] = currentPose;
}
for (size_t i = 0; i < pSkeleton->_joints.size(); ++i) {
pOutput[i] = pSkeleton->_joints[i]._InvBindPose * pLocalPoses[i] * pSkeleton->_joints[i]._invGlobalTransform;
}
}
The outcome was not expected:
I removed the calculations of the animation and just calculate the joint matrix as the inverse bind pose along with the global joint Transformation: < /p>
void Animation::ApplySkeletonPose(Matrix4* pOutput, Matrix4* pLocalPoses, Skeleton* pSkeleton)
{
if (!pSkeleton) return;
for (size_t i = 0; i < pSkeleton->_joints.size(); ++i) {
Matrix4 parentTransform;
Matrix4 currentPose;
u8 parentId = pSkeleton->_joints[i]._iParent;
if (parentId != Joint::kNoParentId) {
parentTransform = pLocalPoses[parentId];
}
// Now become work space joint matrices
currentPose = pLocalPoses[i] * parentTransform;
pLocalPoses[i] = currentPose;
}
for (size_t i = 0; i < pSkeleton->_joints.size(); ++i) {
// Just calculating only the inverse bind pose, and global joint transform, removing the current pose.
pOutput[i] = pSkeleton->_joints[i]._InvBindPose * pSkeleton->_joints[i]._invGlobalTransform.Inverse();
}
}
Und das Ergebnis ist wie erwartet, wenn nicht animieren:
Wie behebe ich dieses Problem mit Berechnungsgelenk? Berechne ich die aktuellen Weltmatrizen nicht korrekt, bevor ich die inverse Bindung und die globale gemeinsame Transformation anwenden? Oder etwas vorher?
Warum gibt meine Animation nach der Durchführung von Berechnungen auf meinen gemeinsamen Matrizen die richtige Matrixpalette nicht aus? In den Hauttutorials GLTF 2.0 heißt es, wie man die Gelenkmatrix für das Hautberechnen berechnet: < /p> [code]jointMatrix(j) = globalTransformOfNodeThatTheMeshIsAttachedTo^-1 * globalTransformOfJointNode(j) * inverseBindMatrixForJoint(j); < /code> Ich mache das für meine Animation Engine: < /p> void Animation::DoSampleJob(AnimJobSubmitInfo& job, r32 gt) { if (!job._output->_currState._bEnabled) { return; } // This part is just calculating the local time progression, no issue here. r32 tau = job._output->_currState._tau; r32 rate = job._output->_currState._fPlaybackRate; r32 lt = job._output->_currState._fCurrLocalTime + gt * rate; if (lt > job._pBaseClip->_fDuration) { lt -= job._pBaseClip->_fDuration; job._output->_currState._tau = gt; } if (lt < 0.0f) { lt = job._pBaseClip->_fDuration + lt; if (lt < 0.0f) { lt += job._pBaseClip->_fDuration; job._output->_currState._tau = gt; } } job._output->_currState._fCurrLocalTime = lt; Skeleton* pSkeleton = Skeleton::GetSkeleton(job._pBaseClip->_skeletonId);
void Animation::ApplySkeletonPose(Matrix4* pOutput, Matrix4* pLocalPoses, Skeleton* pSkeleton) { if (!pSkeleton) return; // This is where the issue is at, somewhere... for (size_t i = 0; i < pSkeleton->_joints.size(); ++i) { Matrix4 parentTransform; Matrix4 currentPose; u8 parentId = pSkeleton->_joints[i]._iParent; if (parentId != Joint::kNoParentId) { parentTransform = pLocalPoses[parentId]; } // Now become world space joint matrices currentPose = pLocalPoses[i] * parentTransform; pLocalPoses[i] = currentPose; }
for (size_t i = 0; i < pSkeleton->_joints.size(); ++i) { pOutput[i] = pSkeleton->_joints[i]._InvBindPose * pLocalPoses[i] * pSkeleton->_joints[i]._invGlobalTransform;
} } [/code] The outcome was not expected: [img]https://i.sstatic.net/kOFxs.png[/img]
I removed the calculations of the animation and just calculate the joint matrix as the inverse bind pose along with the global joint Transformation: < /p> [code]void Animation::ApplySkeletonPose(Matrix4* pOutput, Matrix4* pLocalPoses, Skeleton* pSkeleton) { if (!pSkeleton) return;
for (size_t i = 0; i < pSkeleton->_joints.size(); ++i) { Matrix4 parentTransform; Matrix4 currentPose; u8 parentId = pSkeleton->_joints[i]._iParent; if (parentId != Joint::kNoParentId) { parentTransform = pLocalPoses[parentId]; } // Now become work space joint matrices currentPose = pLocalPoses[i] * parentTransform; pLocalPoses[i] = currentPose; }
for (size_t i = 0; i < pSkeleton->_joints.size(); ++i) { // Just calculating only the inverse bind pose, and global joint transform, removing the current pose. pOutput[i] = pSkeleton->_joints[i]._InvBindPose * pSkeleton->_joints[i]._invGlobalTransform.Inverse();
} } [/code] Und das Ergebnis ist wie erwartet, wenn nicht animieren:
Wie behebe ich dieses [url=viewtopic.php?t=26065]Problem[/url] mit Berechnungsgelenk? Berechne ich die aktuellen Weltmatrizen nicht korrekt, bevor ich die inverse Bindung und die globale gemeinsame Transformation anwenden? Oder etwas vorher?[code]static skeleton_uuid_t LoadSkin(const tinygltf::Node& node, const tinygltf::Model& model, Model* engineModel, const Matrix4& parentMatrix) { if (node.skin == -1) return Skeleton::kNoSkeletonId;
Skeleton skeleton; tinygltf::Skin skin = model.skins[node.skin]; b32 rootInJoints = false; for (size_t i = 0; i < skin.joints.size(); ++i) { if (skin.joints[i] == skin.skeleton) { rootInJoints = true; break; } } skeleton._joints.resize(skin.joints.size()); skeleton._name = skin.name; skeleton._rootInJoints = rootInJoints;
Die Fade in Animation für die Navi -Schaltflächen funktionieren gut, aber die Animation der Folie funktioniert nicht? Wie mache ich sie beide Animationen? Vielleicht ist es Konflikt, aber ich sehe...
Die Fade in Animation für die Navi -Schaltflächen funktionieren gut, aber die Animation der Folie funktioniert nicht? Wie mache ich sie beide Animationen? Vielleicht ist es Konflikt, aber ich sehe...
Ich versuche, eine einfache ASCII 3D Spinning Cube -Animation in der Windows -Konsole mit C ++ zu erstellen.#include
#include
#include
#include
#include
using namespace std;
Ich habe Jackrabbit 2.20.15 in einem Tomcat -Anwendungsserver. Die RMI -Unterstützung wird in neueren Releases veraltet/entfernt, sodass ich versuche, eine Verbindung zu einem Remote -Repository...