Recall the pseudocode for the mirror reflection case in
traceray
looked like this:
function traceray(ray, scene):
= find_intersection(ray, scene)
t, rec if rec.obj is a mirror:
compute r, the reflection direction= Ray(rec.x, r)
mirror_ray return traceray(mirror_ray, scene)
# other cases, ...
Notice that (for brevity) I omitted tmin
and
tmax
arguments from thetraceray
header and
recursive call. Let’s put that back in - the function header will now be
function traceray(ray, scene, tmin, tmax)
. What values of
tmin
and tmax
should we now pass into the
recursive call?
Recall that the final diffuse+specular lighting model is as follows: \[ L = k_d I \max(0, \mathbf{n}\cdot\mathbf{\ell}) + k_s I \max(0, \mathbf{n} \cdot \mathbf{h})^p \] Suppose light source intensities and diffuse coefficient values are constrained to values between 0 and 1. What’s the maximum possible value of \(L\)?
Suppose a camera view ray intersects a surface at the 3D point
\(\mathbf{x}\). For each light source,
we will generate a shadow ray and use ray_intersect
to find
whether there’s an object blocking the light source. The
ray_intersect
function is called as follows:
ray_intersect(objs, Ray(orig, dir), tmin, tmax)
The objs
argument is just a list of objects in the scene
- we’ll assume that’s taken care of.
For a directional light source in direction
\(\vec{\ell}\), give the ray
orig
, ray dir
, tmin
and
tmax
for the call to ray_intersect
.
Reminder: in this class we follow the convention that \(\vec{\ell}\) points towards the directional
light source and thus points opposite the direction that light is
actually “traveling”.
For a point light source at 3D position \(\mathbf{s}\), give the ray
orig
, ray dir
, tmin
and
tmax
for the call to ray_intersect
.