Skip to content

VertexC/ray-chaser

Repository files navigation

Ray-chaser

This is a homework assignment of CMPT361/SFU

buil guide

make
./raycast [-u|-d] step_max <options>

specification:

  • u: user scene, d: default scenee
  • step_max: max depth of ray tracing recursion
  • options:
    • +s: inclusion of shadows
    • +l: inclusion of reflection
    • +r: inclusion of refraction
    • +c: inclusion of chess board pattern
    • +f: enabling diffuse rendering using stochastic ray generations
    • +p: enabling super-sampling

Technique used

  • phong illumination
  • shadow
  • reflection
  • refraction
  • diffuse rendering using stochastic ray generation
  • super-samling

screen shot

  • ./raycast -d 1 +s +l

  • ./raycast -d 1 +c +s +r

  • ./raycast -d 4 +c +s +r +l

  • ./raycast -d 4 +c +s +r +l +f

  • ./raycast -d 4 +c +s +r +l +f +p

reference

refraction ray equation

Tricks

creepy green shadow

In figure below, we can see there is green shadow on the board, which doesn't make sence as it should be the shadow of the red ball. The reason is, in phong illumination, when apply $${diffuse = light * diffuse_factor nl}$$ if the sign of n*l not checked, then the rgb color can be negative. In this case, the R&B light is subtracted, which leads G greater than the other two, then the color goes green.

About

simulate behavior of ray-chaser

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published