Blog

May you find your worth in the waking world.

Perspective Projection

Derivation of Perspective Projection Matrix

Perspective projection projects objects on a plane. It has the effect that distant objects are smaller. If we look at this scene in the negative x axis direction. Perspective matrix is being ...

Orthographic Projection

Derivation of Orthographic Projection Matrix

Orthographic projection projects objects without scaleing objects base on depth. The Orthographic projection matrix transfer object inside a scene bounding box into a canonical view volume. Both...

Distance Between a Point and a Line

Parametric Lines Given 2 points, one line can be defined as: or: which is as same as: v is the vector pointing from one point to the other point on the line. t can be any values...

Volumetric Lighting Part 1

Basic Volumetric Lighting

Volumetric Lighting I will talk about how scattering works briefly. And then I will go through how I implement and optimize basic volumetric lighting. At the end, I will talk about some better t...

Environment Mapping

Cube Mapped Reflection

Skybox Reflection Mapping environment to the object. This demo uses a skybox. In OpenGL, loadCubemap() should be called to generated a texture. When rendering reflection mapping, calculate re...

Shadow Mapping

Shadow Mapping with Directioanl Light

Shadow Mapping with Directional Light Workflow Render the scene from light’s perspective, values in z-buffer is the shadow map. Render the scene from camera’s perspective. Che...

HDR

High dynamic range(HDR) The idea of HDR is do not clamp color values to the range of [0.0, 1.0] until the final result. HDR Off, looks uncomfortable, many details are lost HDR On Implement...

Bloom

Bloom On Bloom Off Workflow Render the scene to 2 color buffers(with HDR). The first color buffer contains the “normal” scene. The second color buffer contains colors that their lighting...

Deferred Shading

32 light sources. G-Buffer layout: Color Buffer 1: vec3 Position Color Buffer 2: vec3 Normal Color Buffer 3: vec3 Albedo float spec Precision: 16 bit float per channel Ligting Cubes are re...

Beizer Curve Project

Implementation of Bezier Curve on a Sphere

Curve with control points: Geometric interpretation of De Casteljau’s algorithm: Another view: