Posts

Showing posts from June, 2023

My Snow Simulation

Image
 Welcome to my last blog for our course CENG469 Computer Graphics 2! This blog will be about our final project which we chose the subject ourselves.  I chose to simulate a falling snow and its accumulation on ground as I am in the end a winter child and also wanted to create something I encounter while playing my favourite games. I implemented a particle system to simulate the falling snow and used displacement map to show the accumulation. I will again explain my implementation step by step. Snow Particles First step was generating the snow particles. To do this I implemented a snowflake struct which has the necessary attributes position, size, velocity and direction vector. In every frame, I created a new snowflake with random attributes and erased them when they hit the ground. Also I added and normalized their direction vector with another random vector to create the chaotic movement of snow fall. struct Snowflake { Snowflake ( glm :: vec3 p , glm :: vec3 d , float ...

Quaternions and Procedural Noise

Image
 Welcome to my third blog post which will about our third assignment in Computer Graphics 2 class. In this assignment, we were asked to implement a plane-like movement camera in an environment which has cloud texture made with Perlin Noise. Transformation with quaternions I first started with implementing the plane like movements which are yaw, pitch and roll of the camera using quaternions. To capture the movements, I first created three vectors which represents the axises of the environment. Then, everytime the user presses a button to change the rotation, I calculated the related quaternion and applied it on these axises. Then I did all my other calculations (such as placing the quad for cloud texture which will be mentioned in a bit) according to those axises. glm :: mat4 rotationmatrix = glm :: toMat4 ( rollQuat ) * glm :: toMat4 ( pitchQuat ) * glm :: toMat4 ( yawQuat ); xAxis = glm :: normalize ( rotationmatrix * xAxis ); yAxis = glm :: normalize ( rotationmatrix ...