Weeks 8-9
Using cubemaps:
After deciding I did not have enough time to implement ray tracing I decided to create a system for skyboxes to be put into the game. My implementation was fraught with issues. The most recommended way of tackling skyboxes I could find was using cubemaps.there is also a good tutorial posted by learnopengl.com here LearnOpenGL – Cubemaps. The other good thing about cubemaps is that they allow for easy reflections by inputting the cube sampler type into a glsl shader. I tried really hard to get cubemaps to work, but the “best” output I could get were the following.
The one on the left was me forgetting that .png and .jpg textures have different amounts of channels. Even after I fixed the issue with the failed render the issues of the skybox only being a plane that moved around in the look direction of the camera persisted.
I decided that I was done with cubemaps and decided to start creating a skybox through the frameworks I had already created.
Hacking together a skybox:
The first extremely important thing to note when creating a skybox is that the geometry you draw needs to be drawn with the depth mask disabled.
As you can see in the image above, I created a function that helps me draw the planes needed for the first implementation by drawing 6 separate planes and different rotations and translations.
It looks extremely trippy when you are able to move your camera through where the skybox is being drawn so I decided I needed to scale it up. I was also still using the brick texture, so I did some searching and found a space skybox generator to get some new textures.
It was starting to look better, especially with the texture change, but the skybox is not centered on the camera position and doesn’t move along with the camera position. I thought it would be as easy as adding the Vector into the original translations, but it did not seem to enjoy that solution. I had multiple times that it was moving towards the camera at a faster speed or moving down while the camera was moving up so it just took some time for me to figure out what the correct additions were. I ended up with the following.
The only real problem I have with my implementation is that the creation of reflections is much harder without the use of the cubemap. I ended up spending around 3 hours on trying to get reflections to work after finishing the skybox. I was plagued with compiler errors for the shaders I was trying to create and eventually decided that if reflections were something I wanted to eventually explore I could revisit what I had worked on this week in the future.