FPChris

FPChris

The Ray Tracer Challenge: Page 130 Wall

@jamis

Page 130 I render the wall ok by rotating the plane in x PI/2 as he says to do on page 125.
However I get a massive shadow across the entire wall. Why is that happening?

Seen here : https://www.scfdev.com/test/render1.png

First Post!

jamis

jamis

Author of Mazes for Programmers and 1 other title

Hmm! Maybe a self-intersection? Although it doesn’t look dark enough for a shadow. Compare that with how dark the spheres’ shadows are. I wonder if it’s actually something in the shading calculation?

The best way to track this is to do something like the following:

  1. Find the <x,y> pixel coordinates of a point in your image that’s misbehaving. (This could be any of the pixels in the image that are showing the shadow in question.)

  2. Run your render for just that pixel.

  3. Add a breakpoint (or a bunch of print statements, if you’re like me) when you cast your shadow rays, and see what object they’re intersecting. (I suspect they’re not intersecting anything, but this will tell you for sure.) If there are no intersections, do this again but with a breakpoint/print in the shading routing, and step through it, looking at the computed values there.

Given that the darker shade seems to appear right about eye-level, I suspect there might be something in how your reflection vector is being computed?

If none of that helps, let me know where you’ve got your code hosted and I’d be happy to take a look and see if anything jumps out at me.

Popular Prag Prog topics Top

New
belgoros
Following the steps described in Chapter 6 of the book, I’m stuck with running the migration as described on page 84: bundle exec sequel...
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
Alexandr
Hi everyone! There is an error on the page 71 in the book “Programming machine learning from coding to depp learning” P. Perrotta. You c...
New
mikecargal
Title: Hands-On Rust (Chapter 11: prefab) Just played a couple of amulet-less games. With a bit of debugging, I believe that your can_p...
New
raul
Page 28: It implements io.ReaderAt on the store type. Sorry if it’s a dumb question but was the io.ReaderAt supposed to be io.ReadAt? ...
New
swlaschin
The book has the same “Problem space/Solution space” diagram on page 18 as is on page 17. The correct Problem/Solution space diagrams ar...
New
taguniversalmachine
Hi, I am getting an error I cannot figure out on my test. I have what I think is the exact code from the book, other than I changed “us...
New
redconfetti
Docker-Machine became part of the Docker Toolbox, which was deprecated in 2020, long after Docker Desktop supported Docker Engine nativel...
New
mcpierce
@mfazio23 I’ve applied the changes from Chapter 5 of the book and everything builds correctly and runs. But, when I try to start a game,...
New

Other popular topics Top

ohm
Which, if any, games do you play? On what platform? I just bought (and completed) Minecraft Dungeons for my Nintendo Switch. Other than ...
New
brentjanderson
Bought the Moonlander mechanical keyboard. Cherry Brown MX switches. Arms and wrists have been hurting enough that it’s time I did someth...
New
AstonJ
There’s a whole world of custom keycaps out there that I didn’t know existed! Check out all of our Keycaps threads here: https://forum....
New
AstonJ
Thanks to @foxtrottwist’s and @Tomas’s posts in this thread: Poll: Which code editor do you use? I bought Onivim! :nerd_face: https://on...
New
AstonJ
Just done a fresh install of macOS Big Sur and on installing Erlang I am getting: asdf install erlang 23.1.2 Configure failed. checking ...
New
PragmaticBookshelf
Learn different ways of writing concurrent code in Elixir and increase your application's performance, without sacrificing scalability or...
New
Margaret
Hello everyone! This thread is to tell you about what authors from The Pragmatic Bookshelf are writing on Medium.
1127 25281 747
New
PragmaticBookshelf
Author Spotlight Mike Riley @mriley This month, we turn the spotlight on Mike Riley, author of Portable Python Projects. Mike’s book ...
New
PragmaticBookshelf
Author Spotlight: Sophie DeBenedetto @SophieDeBenedetto The days of the traditional request-response web application are long gone, b...
New
PragmaticBookshelf
Author Spotlight: Bruce Tate @redrapids Programming languages always emerge out of need, and if that’s not always true, they’re defin...
New

Latest in PragProg

View all threads ❯