← back to portfolio
yanghyunw00.github.io / portfolio.txt / academic / shadow.txt

Shadow Mapping

DigiPen CS250 Computer Graphics
course DigiPen CS250 stack C++ · OpenGL

# Overview


This assignment implements shadow mapping in C++ using OpenGL, rendering accurate per-object shadows cast by a perspective light source. The implementation builds a FrameBuffer class for off-screen depth rendering and implements a two-pass pipeline: a depth pre-pass from the light's point of view, followed by a shadow-projection pass in the main render. The demo supports interactive controls for light FOV, near/far distances, depth bit precision, shadow map resolution and live visualization of both the depth texture and the light's frustum.

# Tasks Completed


# Reflection


This assignment clarified how multi-pass rendering works in practice. The same scene is processed twice, each time from a different camera perspective, and the results are composed in the final pass. The most challenging part was understanding shadow.frag. The key difficulty was tracing exactly what textureProj() returns when the texture has GL_COMPARE_REF_TO_TEXTURE enabled: OpenGL performs the depth comparison internally and returns a shadow factor rather than a raw depth value, which is not obvious at first glance. Going through each step manually rather than guessing made every piece eventually click.

# Demo


Live WebAssembly build — interact with it directly in the frame above.

← back to portfolio