Exploring Computer Graphics: Weekly Chronicle #2
Tags: computergraphics, learning, computerscience
Published: 2023-11-03 02:50:44

# Overview

Hello everyone, welcome to this week's Computer Graphics Chronicle! It's actually been a couple of weeks since I last posted. But, as I stated in the first post of this series, sometimes life happens and I won't be able to post every week. Anyway, I was able to make some progress in all 3 projects, so without any more delays let's go right to them!

# My Journey into Computer Graphics

This is where I made the most progress overall. I focused on completing the [**cubes project**](https://graphicscodex.com/projects/cubes/index.html), which is the first of several projects that I will be doing while following the resources for my journey into computer graphics. It consisted of doing 4 different scenes.

The first scene is just a single white cube rotated 45° in the x-axis.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1698976343052/a3ba274f-3560-4684-96e4-f54a7b43dfc0.jpeg?auto=compress,format&format=webp align="center")

The second scene consisted of recreating the Cornell Box model.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1698976447369/b1f912f5-92f1-46a2-9a19-074033787f2a.jpeg?auto=compress,format&format=webp align="center")

For the third scene, I had to create a helper function in C++ that would generate a 50-step staircase scene file. In my first attempt, I had a small problem with the code that I was using to correctly place the steps but I thought that it looked interesting so I'll show it to you:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1698976563528/f4dbac40-490a-4e49-9557-eccce0c2215d.jpeg?auto=compress,format&format=webp align="center")

After a few modifications, and loading a wood texture, I was able to arrive to the expected result:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1698976600288/1b4372de-2b1f-413a-9038-a9f1cd7cd716.jpeg?auto=compress,format&format=webp align="center")

The specification for the final scene was to create anything that I wanted as long as it used at least 20 cubes. Since I started working on this project at the end of October, my first idea was to create a Halloween-themed scene. I started playing with this idea by generating a cube map that resembles a dark scene with a big moon and a cube with a pumpkin texture.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1698976869990/8f0bf343-0e3b-4ee8-8f54-0273f971d1ad.jpeg?auto=compress,format&format=webp align="center")

However, when deciding on what to put in the scene, I decided to change the theme and make it instead of "Día de Muertos", which is actually today! This is what the final scene looks like:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1698977006388/3e37ea27-0d4d-4e32-b53f-7be2083fa2ca.jpeg?auto=compress,format&format=webp align="center")

Completing the cubes project allowed me to get some hands-on practice and start familiarizing myself with the [G3D engine](https://casual-effects.com/g3d/www/index.html). Besides, I also started familiarizing myself with the requirements for the projects and how to handle the journal and the report. Filling the journal and the report isn't really necessary (even more so considering I'm doing this by myself and not for a course). However, doing so allows me to document my progress as I make it besides just showing you the results in this weekly blog. Meanwhile, the report allows me to give a formal closure to each project and reflect on what I learned.

This is what the journal looks like:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1698979260639/23079404-e59e-433d-b7a7-2902e61fb50c.png?auto=compress,format&format=webp align="center")

This is a zoomed-out look at the report:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1698977331852/66c246e4-d963-410d-b4cf-464a6a2ea7ce.png?auto=compress,format&format=webp align="center")

# Journey into OpenGL

I went over adding the [GLM library](https://github.com/g-truc/glm) to the project which will be used for common math operations. Then I learned how to apply transformations to a triangle.

Translation

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1698977957752/eb7f4a98-fcc2-4c2f-a829-41abfa00dd5a.gif?auto=compress,format&format=webp align="center")

Rotation

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1698977966505/ccc15a4c-50ec-4a7e-94c0-bdf06940768a.gif?auto=compress,format&format=webp align="center")

Scaling

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1698977977079/536369b0-8a67-4799-864b-cbf787eab075.gif?auto=compress,format&format=webp align="center")

All 3 transformations together

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1698978006305/1c513c56-597e-4cd2-addb-cb9a518c1cf8.gif?auto=compress,format&format=webp align="center")

You might have noticed that the triangle gets deformed when it rotates. This happens because the transformation matrix hasn't been transformed into a projection matrix which is something that will be covered later in the Udemy course.

# Journey into Shaders

I started learning the fundamentals of using shaders in Unity and Godot. This included using properties, commands and functions for shaders within Unity.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1698978315981/aa3eb58a-9793-4531-a033-3026ea2d2fa7.png?auto=compress,format&format=webp align="center")

In Godot, I created my first 2D shader and experimented with different properties in fragment and vertex shaders.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1698978401130/9a3bd076-40b9-458b-9977-452d991a2957.png?auto=compress,format&format=webp align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1698978404925/14d0b4da-5fc6-4b28-9f1b-cfeb0600d080.png?auto=compress,format&format=webp align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1698978410930/23570f9a-e2ff-4430-80a3-192b85180cfb.png?auto=compress,format&format=webp align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1698978417559/19829462-68a7-4e1c-aa3a-bc5371be1d2d.gif?auto=compress,format&format=webp align="center")

# See you next week!

Even though I focused mostly on my journey into computer graphics, I was able to make some progress in my other projects. I'll try to keep this up and make some weekly progress in all of them. Here are my goals for next week for each project:

* **My Journey into Computer Graphics:** Read the chapters for the Geometry & Light topics and if possible start with the meshes project.
    
* **My Journey into OpenGL:** Learn how to apply interpolation and projections in the Udemy Course. Complete the Textures, Transformations and Coordinate Systems tutorials in [LearnOpenGL](https://learnopengl.com/).
    
* **My Journey into Shaders:** Complete the first shaders tutorials from Godot, start using shader graphs in Unreal and Unity and complete the [Introduction to Shader Art Coding tutorial](https://www.youtube.com/watch?v=f4s1h2YETNY).
    

See you next week!