Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
Lass solche persönlichen Angriffe lieber bleiben, meine sind härter.
... und diese Signatur kürzer!
- übersichtlicher
- logischer
- verständlicher
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »CeDoMain« (04.10.2014, 16:15)
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 |
void FbxLoader::ProcessAnimationMatrices(BoneType* Bone, int AnimationNumber, int FrameNumber, FbxAMatrix ParentTransform){ Bone->AnimationArray[AnimationNumber].KeyFrameArray[FrameNumber].GlobalTransform = Bone->AnimationArray[AnimationNumber].KeyFrameArray[FrameNumber].GlobalTransform * ParentTransform; int i; for (i = 0; i < Bone->ChildCount; i++){ ProcessAnimationMatrices(Bone->Children[i], AnimationNumber, FrameNumber, Bone->AnimationArray[AnimationNumber].KeyFrameArray[FrameNumber].GlobalTransform); } } |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
scaleMatrix = XMMatrixScaling(Animations[0].KeyFrameArray[i][FrameCount].Scale.x, Animations[0].KeyFrameArray[i][FrameCount].Scale.y, Animations[0].KeyFrameArray[i][FrameCount].Scale.z); rotateMatrixX = XMMatrixRotationX(Animations[0].KeyFrameArray[i][FrameCount].Rotate.x / 180.0f * M_PI); rotateMatrixY = XMMatrixRotationY(Animations[0].KeyFrameArray[i][FrameCount].Rotate.y / 180.0f * M_PI); rotateMatrixZ = XMMatrixRotationZ(Animations[0].KeyFrameArray[i][FrameCount].Rotate.z / 180.0f * M_PI); translationMatrix = XMMatrixTranslation(Animations[0].KeyFrameArray[i][FrameCount].Translate.x, Animations[0].KeyFrameArray[i][FrameCount].Translate.y, Animations[0].KeyFrameArray[i][FrameCount].Translate.z); finalMatrix = XMMatrixMultiply(rotateMatrixX, rotateMatrixY); finalMatrix = XMMatrixMultiply(finalMatrix, rotateMatrixZ); finalMatrix = XMMatrixMultiply(finalMatrix, translationMatrix); finalMatrix = XMMatrixMultiply(finalMatrix, scaleMatrix); finalMatrix = XMMatrixMultiply(XMLoadFloat4x4(&BoneArray[i].GlobalBindposeInverse), finalMatrix); finalMatrix = XMMatrixMultiply(finalMatrix, XMLoadFloat4x4(&BoneArray[i].ToRoot)); finalMatrix = XMMatrixTranspose(finalMatrix); XMStoreFloat4x4(&(BoneMatrixArray[0].Bonematrix[i]), finalMatrix); |
C-/C++-Quelltext |
|
1 2 3 |
FbxAMatrix currentTransformOffset = Node->EvaluateGlobalTransform(currTime) * GetGeometryTransformation(Node); FbxAMatrix GlobalTransform = currCluster->GetLink()->EvaluateGlobalTransform(currTime); GlobalTransform = currentTransformOffset.Inverse()*GlobalTransform; |
C-/C++-Quelltext |
|
1 2 3 |
currCluster->GetTransformMatrix(transformMatrix); // The transformation of the mesh at binding time currCluster->GetTransformLinkMatrix(transformLinkMatrix); // The transformation of the cluster(joint) at binding time from joint space to world space globalBindposeInverseMatrix = transformLinkMatrix.Inverse() * transformMatrix * geometryTransform; |
Dieser Beitrag wurde bereits 4 mal editiert, zuletzt von »Magogan« (29.09.2014, 23:33)
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Magogan« (14.10.2014, 21:31)
HLSL-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
cbuffer MatrixBuffer { matrix globalTransformMatrix; matrix worldMatrix; matrix viewMatrix; matrix projectionMatrix; matrix transformMatrix; matrix rotateMatrix; float alpha; float3 padding; }; cbuffer BoneMatrixBuffer{ matrix BoneMatrix[128]; }; struct VertexInputType { float4 position : POSITION; float4 normal : NORMAL; float2 tex : TEXCOORD; float4 boneWeights : BONEWEIGHT; uint4 boneIDs : BONEID; }; struct PixelInputType { float4 position : SV_POSITION; float3 normal : NORMAL; float4 worldPosition: WORLDPOSITION; float2 tex : TEXCOORD0; float alpha : ALPHA; }; //////////////////////////////////////////////////////////////////////////////// // Vertex Shader //////////////////////////////////////////////////////////////////////////////// PixelInputType AnimatedModelVertexShader(VertexInputType input) { PixelInputType output; // Change the position vector to be 4 units for proper matrix calculations. input.position.w = 1.0f; input.normal.w=0.0f; float4 positions[4]; positions[0]=mul(input.position,BoneMatrix[input.boneIDs.x]); positions[1]=mul(input.position,BoneMatrix[input.boneIDs.y]); positions[2]=mul(input.position,BoneMatrix[input.boneIDs.z]); positions[3]=mul(input.position,BoneMatrix[input.boneIDs.w]); if(input.boneWeights.x!=0.0f || input.boneWeights.y!=0.0f || input.boneWeights.z!=0.0f || input.boneWeights.w!=0.0f){ output.position=input.boneWeights.x*positions[0] + input.boneWeights.y*positions[1] + input.boneWeights.z*positions[2] + input.boneWeights.w*positions[3]; } else{ output.position=input.position; } // Calculate the position of the vertex against the world, view, and projection matrices. output.position = mul(output.position, globalTransformMatrix); output.position = mul(output.position, transformMatrix); output.worldPosition=output.position; output.position = mul(output.position, viewMatrix); output.position = mul(output.position, projectionMatrix); output.alpha=alpha; output.normal=normalize(mul(input.normal,rotateMatrix).xyz); output.tex=input.tex; return output; } |
Dieser Beitrag wurde bereits 3 mal editiert, zuletzt von »Magogan« (26.10.2014, 18:23)
Administrator
Hmm, ja, aber wo kommt das her? Ich nutze inzwischen doch wieder das FBX SDK, aber ich finde das Problem nicht... Egal, ich bin jetzt schon so nahe an einer Lösung wie nie zuvor Ich mache jetzt mal was anderes und dann schau ich morgen, ob ich vielleicht den Fehler finde.Sieht nach falschen bzw. falsch interpretierten Gewichten (Weights) aus.
Administrator
Werbeanzeige