Saad Manzur

  • Content count

  • Joined

  • Last visited

Community Reputation

224 Neutral

About Saad Manzur

  • Rank
  1. Inner edge detecting

    I heard of it. I will try to get hang of the theory explained in your provided link.
  2. Inner edge detecting

    Yes. That's exactly what I am after. I'll read through the article u provided.
  3. 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
  4. 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. :)
  5. HLSL book suggestion

    What's the name of the D3D10 book ?
  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. 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
  8. 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...
  9. 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-> == 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); } }
  10. 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..
  11. How often update a scene ?

      Exactly multiplying every matrix from the scene node each time . Really expensive.... 
  12. 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 ?
  13. 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 ?  
  14. 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 ?