Lecture #9: Camera ray casting

Computer graphics in Game development

Ivan Belyavtsev



“Basics of rasterization” assignments

  • Waiting for submission of “Basics of rasterization” assignments
  • Official due date: Saturday, 22 February 2020, 12:00 AM
  • Feel free to ask questions via Telegram or person


Basics of ray tracing


Basics of ray tracing assignments (1 part)

  1. Ray generation
  2. Möller-Trumbore algorithm
  3. Lighting
  4. Shadow rays
  5. Reflection
  6. Refraction


Basics of ray tracing assignments (2 part)

  1. Anti-aliasing
  2. Axis-aligned bounding box
  3. Bounding volume hierarchy
  4. (Optional) Denoising

Basics of rasterization recall


  1. Create a word as 3D polygons (triangles)
  2. Project the geometry to 2D plane
  3. Rasterize each peace of geometry

Basics of rasterization recall


  • Great math underlying
  • Low computational complexity
  • Clear flow

Basics of rasterization recall


  • Hard to compute lighting
  • Hard to compute shadows
  • Hell with blending and transparency

Ray tracing idea

From: [1]

Pinhole camera

From: http://commons.wikimedia.org/wiki/Image:Pinhole-camera.png

Generation camera rays

From: https://www.gamedev.net/forums/topic/587264-ray-generation-with-rotated-camera/ [2]

Ray tracing scheme

From: [3]

“Ray generation” experiment


  • Implement camera rays
  • Implement miss function

“Ray generation” experiment


From: https://github.com/djbelyak/rt-template/blob/master/references/ray_generation.png

“Ray generation” experiment

What is the new knowledge?

  • Primary ray color defines color of pixel
  • Primary rays make a camera frastrum
  • Miss function returns background color


1. McGuire M. The graphics codex. 2.14 ed. Casual Effects, 2018.

2. Shirley P. Ray tracing in one weekend. second. Amazon.com Services LLC, 2019. Vol. 1.

3. Lefrançois M.-K., Gautron P. DX12 raytracing tutorial - part 2 [Electronic resource]. URL: https://developer.nvidia.com/rtx/raytracing/dxr/DX12-Raytracing-tutorial-Part-2.