Another part of my Computer Games Programming course revolves around the world of 3D Graphics.
In this particular assignment, I not only had to texture Sponza correctly, but I had to implement the correct lighting. At first I thought this would have been extremely hard. But as a mathematician at heart, I found the calculation as a challenge I easily overcame once I knew which variables I should incorporate.
So the math was easy for me, the code however is a different story. It was a couple of days before the deadline and I had refactored my code (or most of it), and there was still one task to do. Create a toggle feature that shows the surface normals in Sponza. I couldn’t find a way to do it, until the final day. So close to completing the brief and I didn’t have enough time to finish it. I took initiative at this point and decided I will have a toggle feature, but I will toggle between the textures for Sponza instead.
This is how my toggle function works, the bool that the function toggles controls what texture should be displayed. The use of an if-else statement is useful here as it will only ever read the code that is encased in the statement that is true and ignore the code that is encased in the statement that is false.
Here are some picture of how it all turned out in the end.
I would show you a video, but I don’t have a “Premium Plan” unfortunately. So if you really do want to see a video of it, here is a link to a YouTube video of it in action.