Closed simin75simin closed 1 year ago
yea.i think so too.light_dir * N <0 means the point behind the sphere.it should in the shadow. we need't calc offset.because it aways in the shadow. am i right?
Nope, light_dir * N < 0 means that the point is behind the sphere, but the sphere can be transparent, so we can't ditch the point directly.
N*0.001 is better to move to ray-sphere intersection routine as it is done in the newest version:
the instruction for step 6 has this line:
Vec3f shadow_orig = light_dir*N < 0 ? point - N*1e-3 : point + N*1e-3;
but i modified it to be something likeif (light_dir*N<0) continue; Vec3f shadow_orig=point+N*1e-3;
and still got the same result given the spheres and lights in the tutorial. i am kinda convinced that this is another correct way to write it, and it potentially speeds things up a little. am i right? thanks in advance.