Metal Gear remake

A remake of the original Metal Gear with (2D) GPU Raytracing | 2024

Role ยท Programming

Grade: 90/100

Overview

For BUAS block A we needed to recreate the original metal gear in C++.
We were also not allowed to use any standard library features for this project.
For this remake I wanted some extra challenge so I decided to add a 2D pathtracer to the project.

I'll only talk about the raytracer here.

Metal Gear overview
Very noisy lighting

First attempt | Lighting

First I tried to implement this in the 3D way, by sending a ray from every pixel on the screen,
I chose this since I thought it would give a more realistic effect and more uniform noise.
However after I implemented this I found out this technique would be way slower in this case and give way more noise.
In 2D rays cannot miss the camera so sending rays from the light source did make more sense

Iteration | Lighting

After switching to rays from the light source things worked way nicer.
I then started to iterate over the concept.

First i just had simple rays, Then to reduce the noise I sampled them over time as a form of temperal denoising.

I then made the rays refract and leak into walls when they hit them so walls are also correctly lit.
Then for these wall collisions I added a heightmap to the walls to add a realistic height effect.

Gif of better working lighting
diff in performance diff in performance

Speed | Lighting

While this gave a good looking effect but it was relatively slow.

So I multithreaded the solution since this is a perfect case for multithreading.
While multithreading worked great I wanted more rays.
So I ended up porting it even to the GPU using a compute shader which made it run really fast

Back to Projects