tomwindcloud
unread,Nov 18, 2009, 12:23:36 PM11/18/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to pbrt
Hello,
In pbrt book p707, the code is:
if (!Intersect(ray, &thit, &dgSphere))
ps = Pcenter - radius * wc;
else
ps = ray(thit);
I think it can be more better like this:
if (!Intersect(ray, &thit, &dgSphere))
{
thit = Dot((Pcenter - p), Normalize(ray.d));
}
ps = ray(thit);
In pbrt book p706, it wrote:
"Note that we must be careful about precision errors here. If the
generated ray just grazes
the edge of the sphere, the Sphere: :Intersect() routine might
unexpectedly return
f al se. In this case, the implementation arbitrarily chooses to
return the point on the line
between the shading point and the sphere center. This very slightly
biases the sampling
routine, although the error introduced by this bias is extremely
small."
Now, the precision error is removed. I'm right?