virtual void Render()
{
CObjects::Render();
g_pEffect->SetTechnique(g_pEffect->GetTechniqueByName("basic_with_shader"));
D3DXMATRIXA16 compMat, invMat;
g_pEffect->SetMatrixTranspose("matView", &g_Cam[iCurCam].GetViewMatrix());
D3DXMatrixMultiply(&compMat, &m_matWorld, &g_Cam[iCurCam].GetViewMatrix());
g_pEffect->SetMatrixTranspose("matWorldView", &compMat);
D3DXMatrixInverse(&invMat, NULL, &compMat);
D3DXMatrixTranspose(&invMat, &invMat);
g_pEffect->SetMatrixTranspose("matWorldViewIT", &invMat);
D3DXMatrixInverse(&invMat, NULL, &g_Cam[iCurCam].GetViewMatrix());
D3DXMatrixTranspose(&invMat, &invMat);
g_pEffect->SetMatrixTranspose("matViewIT", &invMat);
D3DXMatrixMultiply(&compMat, &compMat, &g_Cam[iCurCam].GetProjMatrix());
g_pEffect->SetMatrixTranspose("matWorldViewProj", &compMat);
g_pEffect->SetMatrixTranspose("matProj", &g_Cam[iCurCam].GetProjMatrix());
m_Mesh->UpdateFrame(NULL, &m_matWorld);
m_Mesh->RenderTransparent();
}
VS
vNormal = normalize(vNormal); Out.Pos = mul(matWorldViewProj, vPosition); float3 P = mul(matWorldView, vPosition); //position in view space float3 N = mul((float3x3)matWorldViewIT, vNormal); //normal in view space float3 V = -normalize(P); //viewer
*********** I strongly believe there is a problem with matViewProj Transform combining with world transform to get the positions.
What is the correct way of calculating the world transform but taking care of view and projection?
In Summary, I don't know how to define the view transformation.....
Thanks
Jack
Edited by lucky6969b, 07 August 2012 - 01:06 AM.







