1
$\begingroup$

I have a list of vertices, I want to clip these inside the view frustum.

Here's what I am planning to do :

  • First I will loop through my list and check vertex $v$ for $|v.x| \le |v.w|$, $|v.y| \le |v.w|$ and $|v.z| \le |v.w|$.

    • If it fails then I will remove it from the list and add it to a failedVertex list.

    • If it passes the test, then I will set up a inner loop to iterate through failedVertex list. For each vertex in failedVertex, I will find the intersection of the line between my "passed" vertex and current failed vertex with the view frustum. I will then add the intersection point to my out list.

      • Eg: if $v$ is a passed vertex and $w^i$ is failedVertex[i], then I need the intersection between $r = v + \lambda(v - w^i)$ and my view frustum.
    • At the end of the inner loop I will add the passed vertex to my out list.

I have one problem with this approach, how do I find the intersection between my line and the view frustum ? I don't know the equations of the six planes of my view frustum, I don't really want to calculate the equation of the 6 planes.

I am not using OpenGL or Direct3D ...

$\endgroup$
1
  • $\begingroup$ OpenGL (and presumably DX) does clipping in "clip-space", that is vertices after perspective projection so the view frustum becomes a unit cube were clipping edges is simpler. $\endgroup$
    – PaulHK
    May 7, 2018 at 12:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.