|
![](/i/fill.gif) |
...
t1 = (-b + d) / a;
t2 = (-b - d) / a;
z = P[Z] + t1 * D[Z];
if ((t1 > Cone_Tolerance) && (t1 < Max_Distance) && (z >= 0.0) && (z <=
1.0))
{
Intersection[i].d = t1 / len;
Intersection[i++].t = SIDE_HIT;
}
z = P[Z] + t2 * D[Z];
if ((t2 > Cone_Tolerance) && (t1 < Max_Distance) && (z >= 0.0) && (z <=
1.0))
{
Intersection[i].d = t2 / len;
...
This is a snippet from cones.cpp (lines ~ 220-235). In the second 'if'
I think the second test should be .. && (t2 < Max_Distance). And the
same typo is at line 291 in the same file.
The question concerns the divisions t1 / len and t2 /len. I think
that you should test for the validity of the intersection after the
division because otherwise you could discard some objects based on
a 'transformed' distance rather the real one.
The following example show the problem, you have 2 objects of the same
size and at the same distance from the camera. With a value of 100000
for the variable Scale you see only one, while if you use a value of
10000 you'll see both. The simple way to solve it, is to do the division
before the test. An other one could be to avoid the normalization of the
direction of the ray, it appears to me useless.
HTH Massimo
#declare Scale=100000;
camera { location <30*Scale, 0, 0> look_at <0, 0, 0> }
light_source { <15*Scale, 0, 0>, rgb <1, 1, 1> }
cylinder {
<0, 0, 0>, <-1, 0, 0> Scale
pigment { color rgb <1, 1, 0> }
scale <1, 5, 10>
translate <0,0,10*Scale>
}
cylinder {
<0, 0, 0>, <-1, 0, 0> 10*Scale
pigment { color rgb <1, 0, 0> }
scale <.1, .5, 1>
translate <0,0,-10*Scale>
}
Post a reply to this message
|
![](/i/fill.gif) |