OpenGL Homeworks of “Computer Graphics II” Course – Spring 2023-2024
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 and student outputs as videos.
Homework 1 – Catmull-Clark Subdivision Surface
This first homework is about implementing the Catmull-Clark Subdivision Surface algorithm applying it to simple coarse meshes to render refined surface visuals in OpenGL.
The end product of this homework is an OpenGL program which:
Runs Catmull–Clark subdivision surface algorithm iteratively on the meshes of an animated scene composition that includes at least three different moving meshes with different colors,
Visualizes the resulting scene composition using OpenGL in three different drawing modes where the diffuse and specular shading effects are always shown on the drawings of the meshes,
Includes user interaction capabilities with keyboard buttons to interact with the scene setup.
My implementation’s visual can be seen in the video below:
Homework 2 – Environment Mapping & HDR Lighting
The second homework’s aim is to implement environment mapping and HDR tone mapping operations in OpenGL.
The expected end product of this assignment is an OpenGL program which provides user interaction capabilities with keyboard and mouse buttons, and renders a scene composition that includes the items listed below:
Tone mapping capability to render and display the HDR scene composition in LDR monitors.
An object at the center of the world which can be illuminated by an environment map, or can reflect or refract its environment.
A textured HDR skybox environment that surrounds the scene and can also illuminate the sphere object in the scene.
The OpenGL program runs the Median Cut algorithm defined in the paper “A Median Cut Algorithm for Light Probe Sampling” to gather/approximate the environment’s light positions and radiance. Those directional lights are then used to illuminate the object at the center of the scene. The algorithm is run on an equilateral HDR image, from which 6 HDR cubemap face images for the skybox are produced. Different visualization modes including reflection and refraction capabilities (mirror and glass, respectively) are also included.
Here is the video of my implementation of the second homework:
The aim of the last homework is to implement a field of grass in a windy weather using OpenGL’s geometry shader. Additionally, wind calculations will be sampled from Perlin noise and be used to move each grass blade so that the field of grass will sway in harmony.
The expected end product of this assignment is an OpenGL program which renders a scene that includes the items listed below:
A flat-ground field composed of grass blades of some color and various heights, where each blade is calculated in the geometry shader as a Bezier curve that start at the bottom of the blade and end at the tip and whose control points animate smoothly and also vibrates and sways according to the speed of the wind at that location at each frame.
The Perlin noise implementation, which will be sampled by each grass blade via its 3D position on the ground to calculate the wind speed at the location of that blade so that when some neighboring blades sample the Perlin noise to bend using that wind amount, a smoothly changing wind value will get returned by the noise algorithm to each of them, creating harmonious bends. The Perlin noise look-up calculation can be offset in a direction by some increasing amount at each frame so that each grass in-place would have that smoothly changing wind effect during runtime.
Keyboard buttons, to change the color of the grass field (E & R), to increase/decrease the wind’s speed (A & D), and to increase/decrease the height of the grass (W & S) where longer grass would be expected to have more bending due to their height and the wind’s existence.
I have not implemented the last homework, but here is a merged video footage of implementations of three randomly selected students (Ahmet Eren Kardaş, Akın Aydemir and Enes Sezgin, respectively):
That’s all folks!
This was the third 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. I would like to thank all the students for their hard work and wonderful outputs!
Hope you also had informative fun reading this blog post & watching the videos!