Real-Time Rendering
This was another level 5 module that I did as part of my degree, similar to Fundamentals of Game and Graphical Systems (FoGGS) in first year, the module intention was to introduce us to, and familiarise us with, a graphics API. For FoGGS, this was OpenGL, whereas for this module, we were working with DirectX11. DX11 felt like a slightly more modernised API to work with. Throughout the module, we learnt and implemented many concepts such as rendering shapes, texturing, shaders, terrain, post proccessing etc.
About The Project
Starting Out
The framework given was incredibly simple, in order to add to it, I had to learn a lot about the rendering pipeline. Everything from the verticies of the object, to texturing it, as well as matrix transformations to determine it's position and orientation in the world. In order to effectively use these objects, I would need to also consider lighting and post processing. The camera was an interesting thing to need to develop, there were a few different types of camera: static, moveable and follow. Each is typically used for a different purpose, and for the sake of the assessment, we had to do atleast one of each that the user could freely swap between.
Basic shapes and Texturing
Initially, to understand the process of rendering a shape, I created a simple list of vertices and indices that the GPU would iterate through and draw triangles from to form the complete shape, each side was then given a different colour by passing values into the buffer. Once this was working, the next logical step was to add some lighting, I chose a Phong lighting model since it was easy to understand, each lighting value has its own unique effects on the appearance of an object. Ambient light was a constant level of light from the object, making it clearly visible from anywhere in the scene, regardless of the incoming lights. Diffuse refers to the reflection ratio for any light on the object, directly affecting how bright an object appears in the light. Specular is slightly more complicated, but simply refers to the intensity of the centre of the beam of light hitting an object, it is the small glow that appears from the direction of incoming light, it helps objects shine and appear real.
The next step was improving the way mesh information was stored and given, the basic pyramids and cubes were wasy, but inflexible. The best way to do this was with an OBJ loader, which takes an OBJ file, and interprets its contents to give any needed information about the points on the object. This could be paired with a JSON file that held information regarding the properties of objects, including their texture, default size etc. The objects could then be given a simple class to allow pooling, and individually manipulated to build up the scene.
Lighting & Shaders
Rendering the object's textures made them look significantly more like the object in question, particularly when paired with some post processing to create an illusion of depth on a flat surface, however there was still an uncanny glow coming from the objects due to their textures directly providing their brightness, which is then further modified by the abient and diffuse lighting values. The solution to this was the removal of the Phong lighting model as a material set on each object, and simply using specular to detemrine where on an object should shine. Using a flat value would allow the entirety of the object to appear matte or metallic, however I opted to use a specular map to determine which areas of a texture should be more reflective. The benefit of this was creating a believable material appearance on each object. The image below shows how this looked on the crate.
I could then begin working on some interesting post processing, I introduced the ability for a mesh to be completely transparent in the middle of it, this worked by checking the texture map and culling certain pixels. In the project, I used this for a rotating tree texture, and a chain link fence object. But the applications for this are plentiful, and would allow for more advanced meshes and rendering techniques to be used further down the line of development, something I may work on post submission.
Terrain
Until this point, the terrain of the world has been a flat plane, rendered simply as a flat square. For generated terrain, I began by changing the plane to be a flat series of triangles, each representing an individual "node" on a grid. From this, I followed Frank Luna's Real Time Rendering book to determine how to use a RAW file as a heightmap, it provided values that could be read by the program and interpreted as heights on a grid. The spaces between could then be stretched to fill the gap and create a relatively smooth transition between heights. For future development, a blending map can be used to help seamlessly blend between various textures at various heights, such as sand, grass, stone and snow etc. To give the appearence of beaches and mountains.
Overall Thoughts
Overall, I am relatively happy with the outcome of the game. It is capable of handling several servers of players playing at the same time, and has a robust packet system with plenty of room for future expansion. The game is simple, yet enjoyable, and fully synchronised with eachother including failsafes like UDP packet orders, preventing old positions from overwriting the new ones and causing jittery, inaccurate movement. This is a project I fully intend on expanding on in the future, giving functionality such as being able to leave lobbies, different game modes, and custom nicknames, along with expanding my threading architecture, as it was the artefact's main point of feedback.
Overall Grade: 1st