My Job
In this project, I have been mainly responsible for the graphic programming of the game.
I took care of most of the shaders that were needed, such as implementing various systems related to the graphics that were required for the game, like lighting, the Glow effect, shadows... I have also dedicated a great deal of time to getting the game moved to 30 FPS optimizing the render pipeline.
I've worked in the following features:
- Shaders & Materials System
- PBR
- Lighting
- Glow effect
- Pre-Baked Reflexions
- Shadows
Shaders & Materials System
Since in a previous subject, both Nico Babot and I had been responsible for the sub-system of render pipeline for the work of that subject, at the beginning of this project we were adapting it for the new engine, so that it was easy to use for the team. The first thing we did was the system of importing and saving the shaders, divided into Fragment Shader and Vertex Shader. These shaders could be modified directly from the engine, using ImGui tools, to facilitate the process of creating shaders and make it easier to iterate.
Finally, we made a material system where all the objects that shared materials would have the same variables, such as textures, colors... For, in the case that a material was changed, all the GameObjects that had the same material would change too. Similar to how Unity works.
Phisically Based Rendering
As we were making a game set in Game of Thrones, graphically it had to try to be more realistic as we could, so we decide to use PBR. To get it, the first thing I did, was to look for several tutorials in internet, since I started without previous knowledge on the subject. Thanks to this I was able to start creating an initial shader that used the diffuse map and normal map. Later, the maps of specular and glossiness were also included, to give even more graphic realism.
Finally, with the help of the art leader, we iterated the PBR shader so that the materials could be seen as they had to be, since initially, both the normal map and the glossiness map presented some graphic errors.
Aside from for the stage, the PBR has also been used to render the enemies and the characters.
Lighting
As the game would spend most of the time in dungeons, where lighting is one of the most important points, we pay special attention to make them look as good as possible. First Nico Babot created the light component, to be able to add it to any Game Object. Once the component was created, I was responsible for passing the values of this component, such as intensity, color... to the shader, so that the light interacted with the other GameObjects, taking into account the normal maps and, later, the specular and glossiness maps.
We gave special importance to how the different lights combined with each other in terms of intensity and colors.
Finally, I made sure that the lights were activated and deactivated correctly depending on whether they were within the player's vision. For this we had to adapt them so that they had a radius from which they would no longer illuminate. Although that meant a downgrade of the lights, it helped to solve many of the graphic problems.
Glow Effect
To give more interest to the game, we were asked to add the glow effect to implement it in the particles. Again, this was new for me since I had no idea how it worked. Luckily I found THIS tutorial where explains in detail how this effect could be implemented. The basis for this effect is to render the scene twice in two different buffers. In the first buffer, the scene would be rendered normally, and in the other buffer the objects that had glow, would be rendered in a normal way, but the others would render in black. As an optimization, the glow buffer generates a smaller texture, in our case 128x128. Once we have this texture, a blur filter is applied on it and combined with the texture of the scene to finally achieve the desired effect.
Initially, it was applied only to game Objects like WildFire or light rays, but later Èric Solà implemented it also for some particles, like fire projectiles or Daenerys abilities.
Pre-Baked Reflections
With the project more advanced, several features were proposed by art to add to the game and give it more graphic quality. One of those things was to add reflections to materials. After exploring several options, such as reflection in real time or reflecting the Skybox, finally with Èric Solà we decided to implement reflection with cube maps. To do this, we created a component for the Game Objects that what it does is rendering the scene in a Cube Map buffer from the position where the game object is located. This buffer is rendered when the scene is started and later it is passed to the shader to render the reflection in the object
Shadows
With Nico Babot and Josep Casanovas we were from the beginning of the project implementing a real time shadow system for the game. We started working in the shadows of the directional lights, which were generated using a shadow mapping. To make the shadows look good, we had to apply several methods to fix some artifacts such as acne or Peter Panning. Finally, Josep and I were working so that shadow mapping would only render what the player sees in order to improve the performance.