I am creating a simple little software 3D engine. Right now a polygon doesn't render if all of the vertexes are outside of the frustum, that's all fine and good until you are close to the polygon and all the vertexes are off the screen but the middle is still inside the frustum but it omits it anyways. I would just try render it anyways but I need to do some optimizations to it so that is the first one I thought of.
Here is a gif & some code of the problem if you didn't understand what I was trying to get across.
boolean v1Inside = v1.isInsideViewFrustum();
boolean v2Inside = v2.isInsideViewFrustum();
boolean v3Inside = v3.isInsideViewFrustum();
if (v1Inside && v2Inside && v3Inside) {
rasterizeTriangle(v1, v2, v3);
return;
}
if (!(v1Inside || v2Inside || v3Inside)) {
return;
}