CS 425 Computer Graphics · Assignment 3
Lighting and shading
Illumination and shading on terrain meshes: normals, a normal-visualization mode and per-pixel Phong shading.
Geometry is drawn with index buffers. I computed and transformed the vertex normals, added a mode that visualizes them as colors, and implemented Phong shading per pixel in the fragment shader, with both directional and point lights.
What I implemented
- Terrain loading from image and BSQ files
- Indexed mesh rendering with averaged per-vertex normals
- A normal-coloring mode for debugging
- Phong shading with ambient, diffuse and specular terms
- Controls for the light direction and type, directional or point
- Extra: terrain texturing
Result
Live demo
Open in a new tabChoose a dataset from the dropdown inside the demo, then switch between the shading modes and lights.