Jump to content
  • Advertisement


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


Frustrums and dot products.

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

Ok. Anybody will know that I genuinely suck at math when they read this. But that is why I am asking for help! I''ve roughly implemented a quick ''n dirty frustrum culling algorithm. I know my lookat vector and my vectors created from the camera to vertices of a node (lets say they''re v1,v2,v3,v4). My question is: 1) Do I DotProduct the lookat vector and v1,v2,v3 and v4? 2) Or do I DotProduct (lookat vector - camera position) and v1,v2,v3, and v4? This is what I have so far, and it doesnt work exactly the way it should. ----------------------------------------------------------- D3DVECTOR c = camera.getPosition(); D3DVECTOR lookat = camera.getLookAt(); // Check if less < 90 degrees or > 270 degrees (viewable). if ((dotProduct(lookat-c,v1) > 0) || (dotProduct(lookat-c,v2) > 0) || (dotProduct(lookat-c,v3) > 0) || (dotProduct(lookat-c,v4) > 0)) { // one or more vertex is inside the frustrum! return TRUE; } else return FALSE; ------------------------------------------------------------ ~ I''''m a wannabe programmer ~

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!