Projecting 3D Point onto Viewport, Dealing With Negative Depth
I did a lot of searching but didn't find any solutions to this problem. I have a viewport where the center (where we are looking from) is always at (0,0,0). We are always looking in the direction of (0,0,1). After doing all my math, it simplified to: Projected X = 3D X Coordinate / 3D Z Coordinate Projected Y = 3D Y Coordinate / 3D Z Coordinate And it works perfectly. Every point is correctly projected onto the plane at z=1. But there is an issue with negatives depths. I could just not render polygons with negative depth points, but what if the triangle has other vertices that reach into the