OpenGL Homeworks of “Computer Graphics II” Course – Spring 2022-2023

Hello again computer graphics masters!

In this post, I will write about the three OpenGL homeworks Oğuz Hoca and I have prepared in this semester for the course Computer Graphics II, and showcase my implementations as videos.

Homework 1 – Surface Rendering

This first homework is about rendering a surface composition using the information given to the program in an input.txt file. The surface is rendered by implementing and querying the Bezier surface equation in OpenGL, but this time in the vertex shader, thus enabling a high-performance (high FPS) OpenGL program than the last semester’s first homework.

The end product of this homework is an OpenGL program which:

  • Renders the surface whose information resides in the input text file that is provided as the only input argument to the program,
  • Shows the diffuse and specular shading effects of the given point light(s) on the surface,
  • Includes user interaction capabilities with keyboard buttons.

My implementation’s visual can be seen in the video below:

Homework 2 – Cubemaps

The second homework is again about Cubemaps in OpenGL. Using cubemaps, environment mapping and reflection capabilities are implemented.

The end product is an OpenGL program which: (i) provides user interaction capabilities with keyboard and mouse buttons, and (ii) renders a scene composition that includes the items listed below:

  • A textured skybox environment,
  • A colored car object whose body and windows reflect its environment,
  • A large-enough scene composition with a textured ground and one or more big-enough diffuse statues/landmarks whose reflections are visible on the car’s reflective parts when the car travels in the scene.

I had a great fun implementing this game-like homework myself. I have also separated the car’s tires as individual meshes, and applied appropriate transformations to rotate them appropriately at each frame. I also cared to have a consistent alignment between the tire’s rotation speed and the ground’s movement so that the car is not seen as slipping.

Here is the video of my implementation of the second homework:

Homework 3 – Procedural Cloud Rendering

The aim of the last homework is to render procedurally-generated clouds in a textured skybox environment and fly under/in/above them via a plane-like camera. Perlin noise and Ray Marching are to be implemented by the students in the fragment shader of their OpenGL programs to render the clouds. Quaternions are to be used during the implementation of the plane-like camera controls.

The scene resides inside the skybox, and the clouds are rendered on the fragments of an invisible quad mesh residing right in front of the camera and filling its view. The transparent parts of the quad helps the clouds blend nicely into the skybox environment.

The expected end product of this assignment is an OpenGL program which renders a scene composition that includes the items listed below:

  • A textured skybox environment,
  • A plane-like camera that moves like a plane when controlled via keyboard buttons,
  • Procedurally generated clouds that are leveled at a height range over the ground, meaning that they have a start height and end height and they are clustered in between those heights. The camera can fly over, in, and under them.

Here is the video of my implementation of the last homework:

Oğuz Hoca’s Enhancement on Homework 3 Code

Oğuz Hoca has enhanced the homework’s codebase. In this enhanced version, the plane feels like really moving in the scene as the skybox, too, slowly moves. Moreover, the skybox is first rendered onto a Framebuffer Object, and then the quad’s fragments first read those values (as texture) as starting fragment colors, then render the clouds onto it.

OpenGL blending is disabled in this version, as the fragment colors returned from the quad’s fragments include both the skybox and the clouds, thus are the final colors shown on the screen. Lastly, a button is mapped to the program to turn off/on cloud rendering.

That’s all folks!

This was the second semester of this course being opened after years of break. As the class, we have learnt many advanced and exciting things about Computer Graphics and had really good fun with our OpenGL implementations throughout the semester.

Hope you also had informative fun reading this blog post & watching the videos!

See you in the next posts!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.