Jump to content
  • Advertisement
Sign in to follow this  

Frustum Problem (Near and Far)

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

Hello, I am having trouble with my View Frustum clipping. I decided to draw my frustum I am clipping against, turns out my clipping is working properly, its the frustum I am generating is different from what I expected. The near plane seems to be correct, because its where the camera is at. The far plane though, seems to be at 0. So, if my camera is at 150.0f, my near is 150.0f, my far is 0.0f. Now, in my projection, I set my far to be 1000.0f. Shouldn't my far clipping plane be at -850.0f? (I'm using DirectX) Here's how I build my frustum:
    Matrix16f Vp = GlGetViewMtx() * GlGetProjMtx();

    // Left plane 
    m_Frustum[0].N._x = Vp._14 + Vp._11;
    m_Frustum[0].N._y = Vp._24 + Vp._21;
    m_Frustum[0].N._z = Vp._34 + Vp._31;
    m_Frustum[0].D = Vp._44 + Vp._41;

    // Right plane 

    m_Frustum[1].N._x = Vp._14 - Vp._11;
    m_Frustum[1].N._y = Vp._24 - Vp._21;
    m_Frustum[1].N._z = Vp._34 - Vp._31;
    m_Frustum[1].D = Vp._44 - Vp._41;

    // Top plane 

    m_Frustum[2].N._x = Vp._14 - Vp._12;
    m_Frustum[2].N._y = Vp._24 - Vp._22;
    m_Frustum[2].N._z = Vp._34 - Vp._32;
    m_Frustum[2].D = Vp._44 - Vp._42;

    // Bottom plane 

    m_Frustum[3].N._x = Vp._14 + Vp._12;
    m_Frustum[3].N._y = Vp._24 + Vp._22;
    m_Frustum[3].N._z = Vp._34 + Vp._32;
    m_Frustum[3].D = Vp._44 + Vp._42;

    // Near plane 

    m_Frustum[4].N._x = Vp._13;
    m_Frustum[4].N._y = Vp._23;
    m_Frustum[4].N._z = Vp._33;
    m_Frustum[4].D = Vp._43;

    // Far plane 

    m_Frustum[5].N._x = Vp._14 - Vp._13;
    m_Frustum[5].N._y = Vp._24 - Vp._23;
    m_Frustum[5].N._z = Vp._34 - Vp._33;
    m_Frustum[5].D = Vp._44 - Vp._43;

    // Normalize
    for (int i = 0; i < 6; i++)

Any ideas? Thanks Jeff.

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!