Jump to content
  • Advertisement
Sign in to follow this  
bengaltgrs

Planar Shadows

This topic is 4839 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

I am trying to create some shadows in my game and thought that planar shadows would work nicely for what I want to do. The only problem I have is that I cannot seem to change the Y position of the shadow using this code from a book I have. // position shadow D3DXVECTOR4 lightDirection(0.707f, -0.707f, 0.707f, 0.0f); D3DXPLANE groundPlane(0.0f, -1.0f, 0.0f, 0.0f); D3DXMATRIX S; D3DXMatrixShadow( &S, &lightDirection, &groundPlane); D3DXMATRIX T; D3DXMatrixTranslation( &T, TeapotPosition.x, TeapotPosition.y, TeapotPosition.z); D3DXMATRIX W = T * S; Device->SetTransform(D3DTS_WORLD, &W); //Render Shadow here The teapot (the object having a shadow cast of it) can move up and down, and the shadow will move about in the X and Z directions just fine, but I want the teapot to be able to move about on a piece of terrain, which means that the Y position of the shadow is going to have to constantly change. I have altered all values that looked as if they may be the right one, but I cannot seem to figure out how to move the shadow up and down in the Y direction. -Chris

Share this post


Link to post
Share on other sites
Advertisement
If I understood what you want, the answer is: you cannot. This is why they are called Planar shadows. They just work on the plane and cannot change they Y.

Share this post


Link to post
Share on other sites
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!