Menu

From Model Space to View Space and beyond

Last week I added some new features to the render engine I spoke about a few weeks ago. So far the render engine has been really static. It was just showing the models in OpenGL space [-1,1 -1,1 -1,1] and only did some light calculations.

As part of an presentation for one of my courses I added a camera and made it possible to move around objects and the camera. To get the translations and rotations working I had to write the conversion from Model Space to World Space and from World Space to View Space. See the presentation I gave for some more technical details.

For me this was the first time that I really got an understanding of how moving, rotating and scaling objects work, and mainly what the result is of what you send to the graphics card.

Screenshot_1

While setting up the projection matrix which should result in nice perspective I encountered some weird results. The perspective felt a bit off. The image above shows clearly that something wasn’t right. After reviewing all calculations I saw that I messed up some entries in the matrix. I was just really lucky that I got sort of a realistic image.

After fixing the calculations I ended up with nice perspective in my scene:

perspective

And to get a better idea how a scene would look like I modeled a simple low poly scene.

Screenshot_8