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:

  1. Find all vertices inside of viewport. (Lets call these V[] )
  2. Get depth information of all V[]
  3. 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.)
  4. Save as a polygon.
  5. 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!


  • 2
    \$\begingroup\$ It sounds like you're using the word "matrix" (which we usually use to mean "an array of numbers representing a spatial transformation") to mean "camera frustum," which is the truncated-pyramid-shaped slice of the world that the camera can see. Is that a correct interpretation? It also sounds like your problem is better known as "polygon clipping" — this is the stage in the pipeline where, after finding the projected positions of each vertex, we discard polygons which are completely out of view, or clip ones that cross out of view into smaller polygons our rasterizer can handle. \$\endgroup\$ – DMGregory Nov 10 '15 at 14:02
  • \$\begingroup\$ Thank you about letting me know the difference between 'camera frustum' and 'matrix'. I will look into 'polygon clipping' straight away! Thank you! \$\endgroup\$ – Mr_Rockers Nov 10 '15 at 20:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.