Graphics Encore(2)

"Review for an Interview"

Posted by Koala on May 8, 2020

“Words, don’t come easy to me”

Transformation

  • transformation matrix

    assume that vector is row vector and multiplies matrix from the left

    more specifically, assume vector is $[x, y, 1]$ in 2D

    rotate: $R=$ $=>[xcos\theta-ysin\theta, xsin\theta+ycos\theta, 1]$

    panning: $P=$ $=>[x+L,y,1]$

    scaling: $S=$ $=>[\alpha x, \alpha y, 1]$

    shear: $S=$ $=>[x+ycot\theta, y, 1]$

  • camera transformation

    world->camera->view

    world and camera are right hand coord system, view the left; this is because we are used to set our view direction as $z$ axis, right hand as $x$ axis, and our head up as $y$ axis

Ray Tracing

trace the light from eyes instead of from lighting sources

instead of calculating each pixel from light source to eye, ray tracing does it backward

use recursive method; send out a ray into the scene, calculate the closest intersection between light and polygons; if the material of this intersection is reflective or refractive, can recursively trace it down, until meeting light source or the maximum recursive depths

Reference: ray tracing 入门