Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Direct3D problem

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

Hi, all. I have a terrain in the center of my scene (it''s y=0). Then I place some model in the center of my scene (x=y=z=0), so that a part of the model is under terrain. Now it can be seen because the camera is in (0,0,-30) and looks to (0,0,0). But when I place the camera to (0, 30, -30) and it looks to (0,0,0) my whole model is above the terrain. WHY??? Part of it MUST be under the terrain. I use perspective.

Share this post

Link to post
Share on other sites
Continuing along the same lines of questioning:

1) What values do you have for the near and far clip planes set in your projection matrix ? (near in particular shouldn''t be 0 and preferably as high as possible).

2) Are you using ZBIAS for anything?

3) How are you setting your world, view and projection matrices? - your own function?, D3DX?, the same kinds of values as the samples?

4) Likewise, anything weird in your viewport (if you set it explicitly).

I''d also suggest making a simple keyboard control for your camera so you can see if this only happens from certain angles etc.

Simon O''Connor
ex -Creative Asylum
Programmer &
Microsoft MVP

Share this post

Link to post
Share on other sites
1) near=1.0f, far=500.0f
2) no
3) a) world matrix is identity one
b) view is: D3DXMatrixLookAtLH(&matView, &D3DXVECTOR3(0.0f, 30.0f, -30.0f), &D3DXVECTOR3(0.0f, 0.0f, 0.0f), &D3DXVECTOR3(0.0f, 1.0f, 0.0f));
c) projection is: D3DXMatrixPerspectiveFovLH(&matProj, D3DX_PI / 6, 1.0f, 1.0f, 500.0f);
4) nothing else

PS. This also happens from other camera angles

Share this post

Link to post
Share on other sites
I understood the problem: when I place the camera somewhere between (0,0,-30) and (0,30,-30) my terrain goes down. Why it goes down? I''m sure that the problem is in the terrain.

Share this post

Link to post
Share on other sites

  • 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!