I have been suck on this problem for a while now so thought I should post to see if anyone might know where I am going wrong here. I have a terrain and a number of instanced skinned mesh, tiny.x.
The camera can climb the terrain and I can rotate the terrain with the mouse and I have fifteen instances of tiny, running round the place.
The problem is that when I scroll through my terrain the tiny.x instances remain, unmoved and I have been trying almost every combination of matrix concatenation I can think of but to no avail.
In the Frank Luna terrain shader example. it mentions that the World matrix is 'assumed' and passes the coordinates back into homogeneous view times projection space.gViewProj. As does the blend.fx :
But the blend.fx uses a world matrix which is passed by : HR(mFX->SetMatrix(mhWorld, &mWorld));
and D3DXMatrixInverse(&worldInvTrans, 0, &mWorld);
So, if I have this right, when the view matrix is changed then the world matrix moves its contents around that view, so when I move the camera the terrain moves as it should.
So, I am wondering whether, I need to add a world matrix to the terrain shader for I could pass the mWorld matrix from the skinned mesh shader.
So, if that is the right way to go about it, what would be the best way to add a world matrix to the shader , i.e. I see how to define it but how then to set up the process within the shader ?
Shader new bee .
Matrix shader problem ?
1 reply to this topic