raytracing.github.io
raytracing.github.io copied to clipboard
[Book Next Week ]: Earth image texture viewing parameters don't match the code
The listing 47 specifies the viewing parameters for the image texture as:
world = earth();
lookfrom = point3(13,2,3);
lookat = point3(0,0,0);
vfov = 20.0;
These parameters give something like the following:
For awhile I thought there was a problem in the rendering code, but apparently the source code specifies different parameters:
world = earth();
background = color(0.70, 0.80, 1.00);
lookfrom = point3(0,0,12);
lookat = point3(0,0,0);
vfov = 20.0;
The white parts in the image correspond probably the white parts in the .jpg
image.
Once I used the parameters in the source code, I got the correct image.
!!! The parameterization is obviously also messed up. Ugh.
I have only just got image mapping to work in the "earth" world, although it always worked in the "final image". Weird huh?
I finally got it to work by changing the background to the light cyan colour instead of black; if I choose a black background that is all I see. Layers? No, I changed the order in code and got the same result.
Additionally, as a newbie to c++ I was puzzled by this line (288 in main.cc as we speak)
color background(0,0,0);
which makes no sense to me, and works without the parenthesis or their contents anyway!
So, I couldn't get image mapping to work, then I did but I don't know why what I did made any difference!
Regarding color background(0,0,0)
, this declares & defines a variable named background
of type color
. Implicitly, color
values are initialized black (0,0,0
), but we explicitly initialize here to make the color clear when reading the code.
Thank you!
Just double-checked the earth rendering from ±Z, ±X, and ±Y. All looked correct, and I verified that the listing in the book matches the source code. Looks like this has been fixed somewhere along the line. Also, if there was an issue with the sphere parameterization, it also appears to be fixed now.
Ah! This was fixed coincidentally with commit 8b228b03b7f234c77b11317c1ec28364b033176e, rolling out the new scene
class. See PR #811.