Jump to content
  • Advertisement
Sign in to follow this  
CodeReaver

Clipping plane problem:

This topic is 3989 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'm using this code to set up my camera and my objects start to get clipped when the camera moves for than one unit away. My clipping planes are 0.1f and 100.0f, and my object's radius is about 0.5f, so none of that should be causing any problems. However if I give greater than 1.0f or less than -1.0 as the camera position, parts of my object stop being rendered. The only think I can think of is that it has something to do with normalised coordinates. I've no idea what though.
            m_xDevice.Transform.Projection = Matrix.PerspectiveFovLH(
                (float)Math.PI / 2,
                (float)Width / (float)Height,
                0.1f, 100.0f
            );

            m_xDevice.Transform.View = Matrix.LookAtLH(
                new Vector3(0, 0, 1.0f), // m_xCamPosition,
                new Vector3(0, 0, 0), // m_xObjCentre,
                new Vector3(0, 1, 0)
            );
            m_xDevice.Transform.World = Matrix.Identity;

Share this post


Link to post
Share on other sites
Advertisement
What's the size of the object? try setting the far plane to a greater value (1000-2000) and see if that changes anything.

Share this post


Link to post
Share on other sites
Like I said, the radius of my object is only 0.5f. I can move the camera right up to my object (as near as 0.1f since that's my clip plane), it's when I back the camera away from the object that it starts to dissapear.

Share this post


Link to post
Share on other sites
I'm not sure why you bother to set the world matrix to an identity.... just leave it as is if anything. You can also try using an FOV of Math.PI / 4...

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!