The Ray Tracer Challenge: Chapter 8 Completed, test failing (page 138)

Also posted to the old forums.

Hello there!

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.

So, I’m looking for a little guidance.

Should isShadowed be true for this test?

I posted an answer to this on the other forum, here:

Hopefully that helps some!

1 Like

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.

Ian.