Jump to content
  • Advertisement
Sign in to follow this  
programmer_tom

cloning animated meshes for normal mapping

This topic is 4500 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hey all. i've recently fallen in love with normal maps on my static meshes and am trying to extend that to my animated meshes. works fine sometimes, but animations are messed up other times. I susect blendindices but cannot figure why. the base of the shader code is from the tiny sample. c++ looks like this: D3DVERTEXELEMENT9 decl[]= { { 0, 0, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 }, { 0, 16, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BLENDWEIGHT, 0 }, { 0, 32, D3DDECLTYPE_UBYTE4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BLENDINDICES, 0 }, { 0, 36, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0 }, { 0, 48, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 }, { 0, 56, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TANGENT, 0 }, { 0, 68, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BINORMAL, 0 }, D3DDECL_END() }; /*----------------------------------------------------------------*/ /* Clone each mesh using the new declaration with the tangent and */ /* binormal. */ /*----------------------------------------------------------------*/ LPD3DXMESH pMesh; if ( FAILED ( hr = m_pWorkingMesh->CloneMesh ( m_pWorkingMesh->GetOptions(), decl, CGameObject::GetD3DDevice(), &pMesh ) ) ) return hr; ...have d3d compute normals etc. hlsl shader structure looks like this: struct VS_INPUT_NORMAL_MAP { float4 vPos : POSITION; float3 vBlendWeights : BLENDWEIGHT; float4 vBlendIndices : BLENDINDICES; float3 vNormal : NORMAL; float2 vTex0 : TEXCOORD0; float3 vTangent : TANGENT; float3 vBinormal : BINORMAL; }; thanks -programmer_tom

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!