title: View frustum culling questions
body: <p>So, I'm trying to implement frustum culling. The thing here is that before I can do that, I need to understand some things.</p>
  
  <p>First of which, is plane intersection:</p>
  
  <p>My understanding is that a plane can be defined via 3 points; let's call them <code>p0, p1, and p2</code>.</p>
  
  <p>Given that, we know that the plane's normal can be computed as follows:</p>
  
  <p>(psuedo-code)</p>
  
  <pre><code>vec3 edge0 = p1 - p0;
  vec3 edge1 = p2 - p0;
  
  vec3 normal = normalize( cross( edge0, edg1 ) ) // =&gt; edge1 X edge2 / length( edge1 X edge2 );
  </code></pre>
  
  <p>Now, let's say we have a function which basically tells us whether or not a given point "crosses" the plane in some way.</p>
  
  <p>(moar pseudo-code)</p>
  
  <pre><code>bool crossesPlane( vec3 plane[3], vec3 point )
  {
      vec3 normal = getNormal( plane ); // perform same operations as described above
      float D = dot( -normal, plane[ 0 ] ); // plane[ 0 ] is arbitrary - could just as well be the 2nd or 3rd point in the array
  
      float dist = dot(normal, point) + D; 
  
      return dist &gt;= 0; // dist &lt; 0 means we're on the opposite side of the plane's normal. 
  }
  </code></pre>
  
  <hr>
  
  <p>The logical reasoning behind this is that, since the view-frustum contains six separate planes ( near, far, left, up, right, bottom ), we'd want to grab each of these six planes and essentially "pass" them to the <code>crossesPlane()</code> function, for an individual point (one point, six tests for that point). </p>
  
  <p>If one of these six calls to <code>crossesPlane()</code> returns <code>false</code>, then we want to cull the point in question, thus effectively resulting in the point being culled by the frustum, and of course the point won't be rendered.</p>
  
  <p><strong>Questions</strong></p>
  
  <ul>
  <li>Is this a correct approach to a properly culled view-frustum? </li>
  <li>If so, would taking an arbitrary list of vertices for a given polygon, and performing this test on each of the vertices using this method, be an effective way of going about it? </li>
  <li>While AABBs can be used in place of polygon's/meshes for cull tests, are they still commonly used for this scenario, and are they still considered the "general" goto approach?</li>
  </ul>
  
  <p><strong>Note</strong></p>
  
  <p>If there are any implementation differences worth mentioning between D3D and OpenGL for this, it would be certainly appreciated.</p>