0
\$\begingroup\$

I am attempting to write a frustum culling algorithm simply by testing axis aligned boxes against a plane, while researching this i came across an article here: enter link description here The trouble i am having is determining which points are furthest along the normal of the plane as illustrated here:enter image description here

For each box i need to determine which corner or of the box is furthest along the direction normal of the plane. The pseudo-code on the website has no meaning to me as my box class is structured differently, any help would be appreciated.

\$\endgroup\$
1
  • \$\begingroup\$ Can't you just compute dot products between normal and every corner and select a corner with highest (or lowest) result? \$\endgroup\$ Dec 6, 2016 at 13:39

2 Answers 2

0
\$\begingroup\$

My answer would not answer your direct question, but will lead you to your goal.

In 3d games you do not test bounding boxes against camera's line of sight. Instead, you take your ViewPerspective matrix and do manipulations with it.

The most common way is to extract 6 planes from ViewPerspective matrix and test bounding box against all 6 planes. Test will show whether object is inside frustum or not.

For reference:

http://www.iquilezles.org/www/articles/frustumcorrect/frustumcorrect.htm http://www.iquilezles.org/www/articles/frustum/frustum.htm

\$\endgroup\$
1
  • \$\begingroup\$ Thank you for your response, i must have not explained enough, i am testing box intersections with the planes of the frustum, so after reading the links you provided i am achieving the same result through a slightly different method. However those links may still prove useful because i am having trouble calculating the planes through a different method here: gamedev.stackexchange.com/questions/134067/… \$\endgroup\$
    – Will D
    Dec 7, 2016 at 13:58
1
\$\begingroup\$

Considering you know a point of the plane (Camera position) and the normal, I would just do the dot product for each corner.

For example if O is the camera position, n the normal vector and P1 a corner of the box, that would lead to do the operation : (P1 - O) . n.

Do that for each corner, the one with the higher result will be the further along the normal.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .