For a shadow ray
toward
a light with position
and diameter D, and
a sphere with center
and radius R, we need to
decide whether we are in the penumbra region, and
if so, what is the value of
,
the fractional distance
between umbra and penumbra boundaries. We first compute the
distance t0 to the point on the shadow ray closest to
:
.
If t0 is negative,
then s=1. We then compute b by assuming
,
,
so we use
For triangles, the outer object is a triangle
with rounded corners. The offset is different for
each side of the triangle and is proportional to
the cosine of projected triangle normal and the
vector
.