Computer Graphics Demos

Interactive WebGL2 examples showing the principles and calculations behind rendering.

Example 1: GL Shaders

Vertex Shader

Model → World → View → Clip transforms, rotation and projection matrices. Flat colors, no lighting.

geometry

Fragment Shader

Per-pixel Blinn-Phong lighting: ambient, diffuse and specular terms.

lighting

Combined Demo

Both shaders together with live source code and matrix values.

full pipeline

Example 2: Donut 3D Textures

A: UV Image Textures

Dough, icing and chocolate layers sampled through UVs. Filtering, mipmaps, tiling, alpha layering and normal mapping.

texture2D

B: Procedural Textures

The same donut textured by noise, fbm and masks computed in the shader, with displacement and bump mapping.

noise

Example 3: Loading a Model

Ice Cream Van (GLB)

A hand-written GLB parser: chunks, accessors and buffer views, an embedded PNG texture and 32-bit indices.

glTF

2D Picture → 3D Asset

Estimate depth from a photo, displace a grid into a textured relief, tear it at object edges and export it as GLB.

depth

Car with a 2D UV Atlas

Build a car from boxes and cylinders in code, unwrap every face into one painted texture atlas and see the UV layout.

UV atlas

飛行模擬器 Flight Simulator

Fly a jet over a Hong Kong-style harbour city. Lift/drag/stall physics, jet exhaust and afterburner particles, sunny, cloudy and rain weather.

physics

香港電車 #80 Tram Street

A UV-textured double-decker tram in the "City of Charm" livery on a sakura-lined street with The Pawn, neon signs and the Bank of China Tower.

UV atlas

MS-06S 夏亞專用渣古 II

A Meshy AI image-to-3D model: a million-vertex GLB with base colour, metallic-roughness and normal maps, lit in a studio with shadows.

PBR