I just finished chapter 8, and I now have shadows! Yay!
However, when I ran the whole test suite, I discovered a failing test entitled: “Shading an intersection from the inside”.
The reason seems to be that my isShadowed function is returning true causing the ambient color to be returned (0.1, 0.1, 0.1).
If it were false, my test would pass, since it would add the ambient, diffuse, and specular together.
Ian actually found the bug and posted in the other forums, which I’ll copy to here as well. Woo Hoo Ian!
Hi Craig,
The is_shadowed should be false for this test. The issue is because you are calculating the over_point in the wrong place. You need to negate the normalv before calculating the over_point. If you move your if isInside… above the the over_point calculation you should be good.