jdunlap

jdunlap

The Ray Tracer Challenge: Implementing Shading Breaks the First Shading Test on P. 95

I am working on Chapter 8 when we add shadows. When this is done, though (on p. 115), the original ShadeHit test no longer passes. This point is in shadow and will, therefore, break the tests once shading is implemented.

My solution was to add a flag to turn shading on and off. It defaults to on, but I turn it off before running this test so that it runs as originally intended. I then turn it back on for the final test that is added on p. 114.

For anyone who wants to just update the test, here is the value that I get:

Expected: {0.38066, 0.47583, 0.2855, 0 }
Actual: {0.08, 0.1, 0.06, 0 }

The Actual would just be the ambient color of the sphere.

The second test from p. 95 also fails. Those values are:

Expected: {0.90498, 0.90498, 0.90498, 0 }
Actual: {0.1, 0.1, 0.1, 0 }

Edit:

Shading also breaks the Render test on p. 104 and the second colorAt test on p. 96.

These tests need to be changed to test for the Ambient color or shading needs to be turned off to run them.

It would be nice if Jamis would create tests for all of these that are not in shade or would adjust these tests in the text since the design of the program changed.

First Post!

jamis

jamis

Author of Mazes for Programmers and 1 other title

Hello,

The tests as written should be passing; my own renderer passes all tests, through the end of the book. Admittedly, there could very well be an error in my own code that permits this, but other readers have also had these tests pass after the shadow chapter.

Is your code hosted anywhere that I can see it? I’d be happy to take a look.

  • Jamis

Popular Prag Prog topics Top

iPaul
page 37 ANTLRInputStream input = new ANTLRInputStream(is); as of ANTLR 4 .8 should be: CharStream stream = CharStreams.fromStream(i...
New
Razor54672
The answer to 3rd Problem of Chapter 5 (Making Choices) of “Practical Programming, Third Edition” seems incorrect in the given answer ke...
New
jesse050717
Title: Web Development with Clojure, Third Edition, pg 116 Hi - I just started chapter 5 and I am stuck on page 116 while trying to star...
New
yulkin
your book suggests to use Image.toByteData() to convert image to bytes, however I get the following error: "the getter ‘toByteData’ isn’t...
New
AndyDavis3416
@noelrappin Running the webpack dev server, I receive the following warning: ERROR in tsconfig.json TS18003: No inputs were found in c...
New
fynn
This is as much a suggestion as a question, as a note for others. Locally the SGP30 wasn’t available, so I ordered a SGP40. On page 53, ...
New
jskubick
I think I might have found a problem involving SwitchCompat, thumbTint, and trackTint. As entered, the SwitchCompat changes color to hol...
New
jonmac
The allprojects block listed on page 245 produces the following error when syncing gradle: “org.gradle.api.GradleScriptException: A prob...
New
tkhobbes
After some hassle, I was able to finally run bin/setup, now I have started the rails server but I get this error message right when I vis...
New
a.zampa
@mfazio23 I’m following the indications of the book and arriver ad chapter 10, but the app cannot be compiled due to an error in the Bas...
New

Other popular topics Top

Devtalk
Hello Devtalk World! Please let us know a little about who you are and where you’re from :nerd_face:
New
AstonJ
A thread that every forum needs! Simply post a link to a track on YouTube (or SoundCloud or Vimeo amongst others!) on a separate line an...
New
Exadra37
I am a Linux user since 2012, more or less, and I always use Ubuntu on my computers, and my last 2 laptops have been used Thinkpads, wher...
New
PragmaticBookshelf
“Finding the Boundaries” Hero’s Journey with Noel Rappin @noelrappin Even when you’re ultimately right about what the future ho...
New
Exadra37
I am asking for any distro that only has the bare-bones to be able to get a shell in the server and then just install the packages as we ...
New
AstonJ
If you are experiencing Rails console using 100% CPU on your dev machine, then updating your development and test gems might fix the issu...
New
PragmaticBookshelf
Rails 7 completely redefines what it means to produce fantastic user experiences and provides a way to achieve all the benefits of single...
New
AstonJ
Was just curious to see if any were around, found this one: I got 51/100: Not sure if it was meant to buy I am sure at times the b...
New
PragmaticBookshelf
Author Spotlight: Sophie DeBenedetto @SophieDeBenedetto The days of the traditional request-response web application are long gone, b...
New
PragmaticBookshelf
A Ruby-Centric Chat with Noel Rappin @noelrappin Once you start noodling around with Ruby you quickly figure out, as Noel Rappi...
New

Latest in PragProg

View all threads ❯