Exploring Computer Graphics: Weekly Chronicle #3
Tags: computergraphics, learning, computerscience
Published: 2023-11-20 00:51:07

## Overview

Hello everyone, welcome to this week's Computer Graphics Chronicle! It's been a busy couple of weeks but I was able to make some progress in all of my projects. Let's see what this progress was!

## My Journey into Computer Graphics

All of my time spent on this project was dedicated to completing the readings covering geometry & light. I read the surface geometry, numerical calculus, model of light and rendering equation chapters from [**The Graphics Codex**](https://graphicscodex.com/). Meanwhile, I read the miscellaneous math, implicit modeling, physics-based rendering and color chapters from [**Fundamentals of Computer Graphics (5th edition)**](https://www.goodreads.com/book/show/57281611-fundamentals-of-computer-graphics). These chapters allowed me to understand the fundamentals of the physics of light and how color is represented.

The most interesting discovery was the concept of trichromatic generalization. It states that since "humans have 3 different cone types, any color stimulus can be matched completely with an additive mixture of 3 appropriately modulated color sources". This is why electronic displays use a range of red, green and blue for displaying every color.

## My Journey into OpenGL

For this project, I completed the textures and the transformation tutorials of [**Learn OpenGL**](https://learnopengl.com/)**.** In the textures tutorial, I learned about texture wrapping, texture filtering and mipmaps. Later, I used this knowledge to draw a square with a container texture.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1700434396561/63dd450d-4d1f-432b-87b1-ee0fe5bb8efe.png?auto=compress,format&format=webp align="center")

I also applied a mixture of the vertex's color

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1700434424370/67687898-131d-4fec-8fee-64bf6a51c114.png?auto=compress,format&format=webp align="center")

Then, I learned to use multiple textures in the same fragment shader.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1700434453253/3bba669d-71e2-41c0-84c2-b98f8ba6b4fa.png?auto=compress,format&format=webp align="center")

You might have noticed that the smiling face is upside down. This has to do with the way the coordinates are set up by the texture and by OpenGL. This can be easily fixed in OpenGL.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1700434536378/9bfb9786-1a32-4baf-9b38-78d4e164278f.png?auto=compress,format&format=webp align="center")

One of the exercises consisted of specifying the textures in the range of 0.0-2.0 (instead of 0.0-1.0) and displaying 4 smiley faces on a single container that has the texture clamped at its edge. This is the result:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1700434603059/c43d2b20-3006-4e44-bbd6-af068153967d.png?auto=compress,format&format=webp align="center")

The last exercise of this tutorial consisted of allowing the user to change the visibility of each texture with the arrow keys.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1700435703417/6f368765-7d8d-447a-81fe-6e264c4f5175.gif?auto=compress,format&format=webp align="center")

The transformations tutorial was all about using GLM to manipulate the container with different transformations.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1700435749655/26169ec8-9d00-4a85-8972-18d36dd76675.gif?auto=compress,format&format=webp align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1700435752820/5d774100-b93e-485b-ab45-15d31bec8bca.gif?auto=compress,format&format=webp align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1700435758114/6799dba7-223d-4445-bc72-418e4777a711.gif?auto=compress,format&format=webp align="center")

## My Journey into Shaders

This time, my journey into shaders was all in Godot. I made my first 3D shaders in Godot, where the first one consisted of making a plane appear as hills.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1700435844293/666ad8de-b609-429e-a8d8-78cdc74956ba.png?auto=compress,format&format=webp align="center")

Which were then made random using a noise texture.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1700435861436/52e7e20c-7093-4e4d-a49a-66adf19d50c3.png?auto=compress,format&format=webp align="center")

A height scale was used to make them less spiky.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1700435888117/23e4cfb7-8b23-4f91-b289-9be6cf4e7fe9.png?auto=compress,format&format=webp align="center")

Then I added lighting based on a normal map

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1700435925511/e3093eea-1d1b-46c5-9102-144d9da62a55.png?auto=compress,format&format=webp align="center")

By changing some properties of this shader, you can make it look like water.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1700435960834/197a016d-296f-4215-8c43-8bc547d28956.png?auto=compress,format&format=webp align="center")

After some more tweaking and adding animation based on time, you can get a very simple water shader.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1700436010207/95e1c98b-7c7d-452c-84d9-146b40ab3a96.gif?auto=compress,format&format=webp align="center")

Finally, I got an introduction to visual shaders in Godot.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1700436104695/35796073-f6b8-4c9e-8a58-12eb7d121e70.png?auto=compress,format&format=webp align="center")

## See you next week!

Here are my goals for next week for each project:

* **My Journey into Computer Graphics:** Start with the report and first specification of the [meshes project](https://graphicscodex.com/projects/meshes/index.html).
    
* **My Journey into OpenGL:** Continue with the Udemy course with the interpolation, indexed draws & projections videos. I'll also complete the coordinate systems tutorials in [**LearnOpenGL**](https://learnopengl.com/).
    
* **My Journey into Shaders:** Start using shader graphs in all 3 game engines and complete the [**Introduction to Shader Art Coding tutorial**](https://www.youtube.com/watch?v=f4s1h2YETNY).
    

See you next week!