Jump to content
  • Advertisement

Saad Manzur

Member
  • Content Count

    68
  • Joined

  • Last visited

Everything posted by Saad Manzur

  1. Hi I am trying to use the Visual Studio 2013 Graphics debugger and tried to create an event group. Bute I ran into a problem while including d3d11_1.h header file . I copied the header to my include directory in June 2010 SDK's include file. But the following error pops up. 1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\dxgi1_2.h(1271): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\dxgi1_2.h(1271): error C2143: syntax error : missing ',' before '*' 1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\dxgi1_2.h(1275): error C2061: syntax error : identifier 'DXGI_RGBA' I am have also copied over dxgi1_2.h in the include directory . What is causing this problem ? Is it a conflict problem ? Can any one give me any pointer on how to create this event group ? I am including the directx sdk june 2010 version. And all inherited paths along with it.
  2. Hi,   I am not that good of a shader programming. Still experimenting. Currently i am going with unity engine and practicing cg programming. I am trying to create a shader that will detect both inner and outer edges and outline them. So far i tried to fix the front face of my object and extended the vertices that are not visible. That worked for some basic shapes but not complex ones. I tried detecting the outer edges using some common sense that dot product of normal and view direction of a vertex will be 0. But I do no know how to set the outline there. How to create an extra thick line following the edges. And how can i detect the pixel changes inside the objects to detect the inner edges ?  Thanks in advance
  3. Saad Manzur

    Inner edge detecting

    I heard of it. I will try to get hang of the theory explained in your provided link.
  4. Saad Manzur

    Inner edge detecting

    Yes. That's exactly what I am after. I'll read through the article u provided.
  5. Saad Manzur

    HLSL book suggestion

      Ok, lol.   I've got my hands on that right now. I'll take a look at the book in your signature. Thanks. :)
  6. Hi, Can anyone suggest some good books or tutorial from where I can learn about hlsl language in depth i.e. shadowing, lighting, ambient occulsion etc.   Thanks in advance
  7. Saad Manzur

    HLSL book suggestion

    What's the name of the D3D10 book ?
  8. Saad Manzur

    How often update a scene ?

      I have to optimize those. I followed a tutorial which did this way... Now that I've learned it now Ill try to optimize it.... And thanks for the spoiler but I'll sneak a peek only after I give it a go  when I will get frustrated
  9. How often do I have to call the update function to render an animated scene ? If I call the update() function every millisecond the program get slow (obviously because of the recursive matrix calculation of each bone from the root all over again)... I call the update function right before it is rendered to the scene.. Any ideas ?  
  10. Saad Manzur

    How often update a scene ?

      Sorry, Buck I misunderstood , my bad  .. Solved it somewhat but still I need to optimize the code as haegarr suggested...   I pre calculated the necessary frames and just fed the frame number to the render function .   I think my project is somewhat ready to be submitted. It would have been really tough without you guys especially you Buck    . I got so many discouragements from my teachers and parents and also some friends... But thanks to you and no thanks to my impatience I got over it ... I look forward to learn more about graphics programming after the exam....    Again thanks guys...
  11. Saad Manzur

    How often update a scene ?

      I am trying to do that currently. Trying to figure out how to tell before time if it will be changed or not... void GameTimer::Tick() { if( mStopped ) { mDeltaTime = 0.0; return; } __int64 currTime; QueryPerformanceCounter((LARGE_INTEGER*)&currTime); mCurrTime = currTime; // Time difference between this frame and the previous. mDeltaTime = (mCurrTime - mPrevTime)*mSecondsPerCount; // Prepare for next frame. mPrevTime = mCurrTime; // Force nonnegative. The DXSDK's CDXUTTimer mentions that if the // processor goes into a power save mode or we get shuffled to another // processor, then mDeltaTime can be negative. if(mDeltaTime < 0.0) { mDeltaTime = 0.0; } } Its also taken from frank d luna. And I think it is not the source of the problem . Because if I use dt = 1/60.0f it does not effect at all.... Here is the matrix calculation calls which concern me.... void Bones::UpdateNode(float AnimationTime, const aiNode *pNode, const XMFLOAT4X4 parentMatrix) //Bone Index, Parent Matrix (Transformation) { const char *name = pNode->mName.C_Str(); const aiAnimation *pAnimation = m_pScene->mAnimations[0]; XMFLOAT4X4 temp; AItoXM(pNode->mTransformation, temp); XMMATRIX NodeTransformation = XMLoadFloat4x4(&temp); const aiNodeAnim* pNodeAnim = FindNodeAnim(pAnimation, name); if (pNodeAnim) { aiVector3D Scaling; CalcInterpolatedScaling(Scaling, AnimationTime, pNodeAnim); XMMATRIX ScalingM; ScalingM = XMMatrixScaling(Scaling.x, Scaling.y, Scaling.z); ScalingM = XMMatrixTranspose(ScalingM); aiQuaternion RotationQ; CalcInterpolatedRotation(RotationQ, AnimationTime, pNodeAnim); XMMATRIX RotationM; XMFLOAT4 temp = XMFLOAT4(RotationQ.x, RotationQ.y, RotationQ.z, RotationQ.w); XMVECTOR temp2 = XMLoadFloat4(&temp); RotationM = XMMatrixRotationQuaternion(temp2); RotationM = XMMatrixTranspose(RotationM); aiVector3D Translation; CalcInterpolatedPosition(Translation, AnimationTime, pNodeAnim); XMMATRIX TranslationM; TranslationM = XMMatrixTranslation(Translation.x, Translation.y, Translation.z); TranslationM = XMMatrixTranspose(TranslationM); NodeTransformation = TranslationM * RotationM * ScalingM; } XMMATRIX finalTransform = XMLoadFloat4x4(&parentMatrix) * NodeTransformation; if (mBoneInfoMap.find(name) != mBoneInfoMap.end()) { debug << "entered" << std::endl; int boneID = mBoneInfoMap[name]; XMMATRIX temp2 = finalTransform * XMLoadFloat4x4(&mBoneInfo[boneID].offsetMatrix); temp2 = XMMatrixTranspose(temp2); XMStoreFloat4x4(&mBoneInfo[boneID].Transform, temp2); } XMFLOAT4X4 temp3; XMStoreFloat4x4(&temp3, finalTransform); for (int i = 0; i < pNode->mNumChildren; i++) { UpdateNode(AnimationTime, pNode->mChildren[i], temp3); } } const aiNodeAnim *Bones::FindNodeAnim(const aiAnimation *pAnimation, const std::string NodeName) { for (UINT i = 0; i < pAnimation->mNumChannels; i++) { const aiNodeAnim* pNodeAnim = pAnimation->mChannels[i]; if (std::string(pNodeAnim->mNodeName.data) == NodeName) { return pNodeAnim; } } return NULL; } void Bones::CalcInterpolatedRotation(aiQuaternion &out, float AnimationTime, const aiNodeAnim *pNodeAnim) { if (pNodeAnim->mNumRotationKeys == 1) { out = pNodeAnim->mRotationKeys[0].mValue; return; } UINT RotationIndex = FindRotation(AnimationTime, pNodeAnim); UINT NextRotationIndex = (RotationIndex + 1); assert(NextRotationIndex < pNodeAnim->mNumRotationKeys); float DeltaTime = pNodeAnim->mRotationKeys[NextRotationIndex].mTime - pNodeAnim->mRotationKeys[RotationIndex].mTime; float Factor = (AnimationTime - (float)pNodeAnim->mRotationKeys[RotationIndex].mTime) / DeltaTime; assert(Factor >= 0.0f && Factor <= 1.0f); const aiQuaternion& StartRotationQ = pNodeAnim->mRotationKeys[RotationIndex].mValue; const aiQuaternion& EndRotationQ = pNodeAnim->mRotationKeys[NextRotationIndex].mValue; aiQuaternion::Interpolate(out, StartRotationQ, EndRotationQ, Factor); out = out.Normalize(); } UINT Bones::FindRotation(float AnimationTime, const aiNodeAnim *pNodeAnim) { assert(pNodeAnim->mNumRotationKeys > 0); for (UINT i = 0; i < pNodeAnim->mNumRotationKeys - 1; i++) { if (AnimationTime < (float)pNodeAnim->mRotationKeys[i + 1].mTime) { return i; } } assert(0); } UINT Bones::FindPosition(float AnimationTime, const aiNodeAnim *pNodeAnim) { for (UINT i = 0; i < pNodeAnim->mNumPositionKeys - 1; i++) { if (AnimationTime < (float)pNodeAnim->mPositionKeys[i + 1].mTime) { return i; } } assert(0); return 0; } void Bones::CalcInterpolatedPosition(aiVector3D &out, float AnimationTime, const aiNodeAnim *pNodeAnim) { if (pNodeAnim->mNumPositionKeys == 1) { out = pNodeAnim->mPositionKeys[0].mValue; return; } UINT PositionIndex = FindPosition(AnimationTime, pNodeAnim); UINT NextPositionIndex = (PositionIndex + 1); assert(NextPositionIndex < pNodeAnim->mNumPositionKeys); float DeltaTime = (float)(pNodeAnim->mPositionKeys[NextPositionIndex].mTime - pNodeAnim->mPositionKeys[PositionIndex].mTime); float Factor = (AnimationTime - (float)pNodeAnim->mPositionKeys[PositionIndex].mTime) / DeltaTime; assert(Factor >= 0.0f && Factor <= 1.0f); const aiVector3D& Start = pNodeAnim->mPositionKeys[PositionIndex].mValue; const aiVector3D& End = pNodeAnim->mPositionKeys[NextPositionIndex].mValue; aiVector3D Delta = End - Start; out = Start + Factor * Delta; } UINT Bones::FindScaling(float AnimationTime, const aiNodeAnim *pNodeAnim) { assert(pNodeAnim->mNumScalingKeys > 0); for (UINT i = 0; i < pNodeAnim->mNumScalingKeys - 1; i++) { if (AnimationTime < (float)pNodeAnim->mScalingKeys[i + 1].mTime) { return i; } } assert(0); return 0; } void Bones::CalcInterpolatedScaling(aiVector3D &out, float AnimationTime, const aiNodeAnim *pNodeAnim) { if (pNodeAnim->mNumScalingKeys == 1) { out = pNodeAnim->mScalingKeys[0].mValue; return; } UINT ScalingIndex = FindScaling(AnimationTime, pNodeAnim); UINT NextScalingIndex = (ScalingIndex + 1); assert(NextScalingIndex < pNodeAnim->mNumScalingKeys); float DeltaTime = (float)(pNodeAnim->mScalingKeys[NextScalingIndex].mTime - pNodeAnim->mScalingKeys[ScalingIndex].mTime); float Factor = (AnimationTime - (float)pNodeAnim->mScalingKeys[ScalingIndex].mTime) / DeltaTime; assert(Factor >= 0.0f && Factor <= 1.0f); const aiVector3D& Start = pNodeAnim->mScalingKeys[ScalingIndex].mValue; const aiVector3D& End = pNodeAnim->mScalingKeys[NextScalingIndex].mValue; aiVector3D Delta = End - Start; out = Start + Factor * Delta; } void Bones::XMBones() { mBoneTransforms.clear(); for (int i = 0; i < mBoneInfo.size(); i++) { XMFLOAT4X4 temp; XMStoreFloat4x4(&temp, XMMatrixIdentity()); mBoneTransforms.push_back(mBoneInfo[i].Transform); } }
  12. This is a little off topic. How do you guys get collada file with animated rig ? I have rigged in maya and tried exporting it in collada extension. But something's wrong . What format do you guys use ?
  13. Saad Manzur

    Proper exporting collada

      I am trying to write it using fbx sdk . How do you import the skeleton . Where did you find tutorial or documentation ? I can only see docs about exporting.     Thanks for the info.... I was wondering why it was generating animation only in one file..
  14. Saad Manzur

    How often update a scene ?

      Exactly multiplying every matrix from the scene node each time . Really expensive.... 
  15. Saad Manzur

    How often update a scene ?

    If I even try to update the scene in bind pose where no animation occurs fps counter shows 1 . I have calculated the dt, before because I rendered static animation. I have to pass the animation time adding dt to it every time right ?   Edit: fps is too low . is it a possibility that the animation is just too complex ? I play batman and other games smoothly but this program fps 1 ?? Seriously ?   Edit2 : from what I am guessing now do I have to use dynamic programming to precalculate the values ?
  16. I am trying to render my skeleton's bind pose in DirectX. But when I follow this code I end up having a distorted mesh. void Bones::UpdateNode(const aiNode *pNode, const XMFLOAT4X4 parentMatrix) //Bone Index, Parent Matrix (Transformation) { const char *name = pNode->mName.C_Str(); XMFLOAT4X4 temp; AItoXM(pNode->mTransformation, temp); XMMATRIX NodeTransformation = XMLoadFloat4x4(&temp); XMMATRIX finalTransform = NodeTransformation * XMLoadFloat4x4(&parentMatrix); if (mBoneInfoMap.find(name) != mBoneInfoMap.end()) { int boneID = mBoneInfoMap[name]; XMMATRIX temp2 = XMLoadFloat4x4(&m_GlobalInverseTransform) * finalTransform * XMLoadFloat4x4(&mBoneInfo[boneID].toParent); XMStoreFloat4x4(&mBoneInfo[boneID].Transform, temp2); } XMFLOAT4X4 temp3; XMStoreFloat4x4(&temp3, finalTransform); for (int i = 0; i < pNode->mNumChildren; i++) { UpdateNode(pNode->mChildren[i], temp3); } }  What is the offset matrix provided by Assimp. And is the transformation matrix really the transformation with reference to it's parent. Is it necessary to calculate all the way from the root node of the scene ?
  17. Saad Manzur

    Assimp Skeleton Bind Pose

    Thanks for your feedback. But the mesh is still distorted. I guess a vertex in the hand region does not have weight and bone index attached to it. I have to check it. Do you know how to export complex animations from maya in dae format ? 
  18. Saad Manzur

    Assimp Skeleton Bind Pose

    Ok , thanks guys I have solved it . Buck, Waaayoff and IceBreaker all of you , thanks for feedback. The thing is that I had to transpose the finalTransfromation matrix . It is still slightly distorted. It was even when I fed the identity matrices. Now for the animation part. Does it get easier or harder from here ?
  19. Saad Manzur

    Assimp Skeleton Bind Pose

      It's just a flag if the bone has a mesh around it or not. Because in my model, not every bone is used for the mesh (Like Bind_HeadTopEnd) this bone is not used , I guess this bone is given to bind some helmet or other static meshes with it.      I guess so, because I provide the root node as paremeter's to the funtion. It should visit each node in the SCENE not in the FRAME only, I guess.    Help me understand this multiplications:(Thinking out loud)       This transforms the child bone's position with respect to it's parent locally.         And this transforms the previous local transform into bind pose . (where offset matrix is said to be inverse bind pose matrix) I am wrong right ?   Edit : If you observe the screen shot you will see that the hand is not the only thing that is distorted. The hip too.
  20. Saad Manzur

    Assimp Skeleton Bind Pose

    Thanks to you, I have gotten this far.. But the mesh is still distorted..     Here is my code :   void Bones::UpdateNode(const aiNode *pNode, const XMFLOAT4X4 parentMatrix) //Bone Index, Parent Matrix (Transformation) { const char *name = pNode->mName.C_Str(); XMFLOAT4X4 temp; AItoXM(pNode->mTransformation, temp); XMMATRIX NodeTransformation = XMLoadFloat4x4(&temp); XMMATRIX finalTransform = XMLoadFloat4x4(&parentMatrix) * NodeTransformation; if (mBoneInfoMap.find(name) != mBoneInfoMap.end()) { int boneID = mBoneInfoMap[name]; if (mBoneInfo[boneID].meshdata) { XMMATRIX temp2 = finalTransform * XMLoadFloat4x4(&mBoneInfo[boneID].offsetMatrix); XMStoreFloat4x4(&mBoneInfo[boneID].Transform, temp2); } else { XMStoreFloat4x4(&mBoneInfo[boneID].Transform, XMMatrixIdentity()); } } XMFLOAT4X4 temp3; XMStoreFloat4x4(&temp3, finalTransform); for (int i = 0; i < pNode->mNumChildren; i++) { UpdateNode(pNode->mChildren[i], temp3); } } aiNode->mTransformation is the local transform right ? And transpose does not work for me. This is the closest to what I got. I am passing the scene's root node. Your help is greatly appreciated. 
  21. Saad Manzur

    Assimp Skeleton Bind Pose

      So I have to transpose the offset matrix to get the bind pose ?   Is 'P' the parent's transform matrix ?
  22. Hi,  Can anyone tell me how to debug an fx file ? I have tried using gpu perfstudio, PIX and visual studio ultimate 2013 but all of them gives me an error when I try to debug..
  23. Saad Manzur

    How to debug an fx file

    Yes I tried that still getting massively distorted mesh. I tried Icebreaker's method. It should have worked. Is there any specific ordering to multiply this matrices. I tried multiplying the opposite order still no good. Assimp says : mOffsetMatrix = the matrix transforming from mesh space to bone space, also called inverse bind pose transform                        mTransform = a node's transformation matrix in relation to it's parent node   So, this information and does my code match ? 
  24. Saad Manzur

    How to debug an fx file

    Buck,  I wrote this function to calculate the transformation matrices. It is similar to the tutorial of the blog. And also I did some research in Assimp. It seems mTransformation "is local in relation to its parent node" . So I am guessing it transforms mesh space to bone space. I have to multiply it with each of its children. And the offset matrices are pre calculated. Here is the function:   void Bones::UpdateNode(const aiNode *pNode, const XMFLOAT4X4 parentMatrix) //Bone Index, Parent Matrix (Transformation) { const char *name = pNode->mName.C_Str(); XMFLOAT4X4 temp; AItoXM(pNode->mTransformation, temp); XMMATRIX NodeTransformation = XMLoadFloat4x4(&temp); XMMATRIX finalTransform = NodeTransformation * XMLoadFloat4x4(&parentMatrix); if (mBoneInfoMap.find(name) != mBoneInfoMap.end()) { int boneID = mBoneInfoMap[name]; XMMATRIX temp2 = XMLoadFloat4x4(&m_GlobalInverseTransform) * finalTransform * XMLoadFloat4x4(&mBoneInfo[boneID].offsetMatrix); XMStoreFloat4x4(&mBoneInfo[boneID].Transform, temp2); } XMFLOAT4X4 temp3; XMStoreFloat4x4(&temp3, finalTransform); for (int i = 0; i < pNode->mNumChildren; i++) { UpdateNode(pNode->mChildren[i], temp3); } } The author of the tutorial passed the scene's RootNode and an identity matrix . But if I do that the mesh is distorted. Do I have to pass the RootNode of the scene ?
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!