Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

Matrix shader problem ?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Pin ups   Members   -  Reputation: 148

Like
0Likes
Like

Posted 25 June 2012 - 05:05 PM

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 :

HR(mFX->SetMatrix(mhWVP, &(mWorld*mView*mProj)));

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 .

Sponsor:

#2 Pin ups   Members   -  Reputation: 148

Like
0Likes
Like

Posted 29 June 2012 - 04:23 PM

If fixed this a few hours after posting. I was not updating the tiny.x instances correctly.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS