I have recently been toying with the idea of creating a 3D-renderer from scratch and, after looking into it, doesn't seem like such a behemoth of a task as it sounds. Last night, I was tossing and turning in bed because I had tons of ideas and was originally going to base the whole entire renderer off of an index system using vector-lists it occlude points that I don't need, but tossed that out of the window as I realised I needed to prioritise on the main rendering. As most 3D-based developers will know, all of the vertices move around the viewport. This is a nightmare for people who want to make 3rd/1st person games because, if you don't know semi-advanced geometry then you're practically screwed. I realise that people will have to know about their soh's and their toa's eventually but I wanted to release the burden of that by having the viewport (matrix) move around the "world". This is surely better for performance as well, as moving a matrix around must be easier for a gpu/cpu to calculate. I could be totally wrong, but I wanted to give this a go.
In my head, everything sort of works and would produce a "3D" world. The only thing stopping me jumping into C++ and SFML/SDL at this point is a bug (or technically "unimplemented feature") of my program. The way I was going to have my renderer work is like so:
- Find all vertices inside of viewport. (Lets call these V )
- Get depth information of all V
- Draw lines between certain V (In my case, one V will contain information such as, the next V in memory to connect to. Drawing lines is only for debug purposes or for the kewl 80's look.)
- Save as a polygon.
- Fill colour/texture within a poly's bounds to show depth or for design.
This should work, I think. But there is one issue and that issue is the reason I'm posting all of this.
Let's say that we have something that is bigger/not completely in a view frustum bounds and the camera is not looking at a vertex, how would we figure out that there is a "shape" there. I'm going to draw a crappy example in MS Paint to explain. (Ain't nobody got time for Photoshop..)
Any help is appreciated and a fully understand if what I wrote doesn't 'click'. Thanks!