raytracing.github.io
raytracing.github.io copied to clipboard
Listing 3.28: changes in `scatter()` argument list
When ONB is introduced in Ch. 8.3, scatter function has different function contract (double& pdf is added at the end).
Which clashes with Listing 22.
Looks like remainings from V.3.
However with the new pdf calculations in Listing 29 it's not clear what scattering_pdf should be at this stage. The previous change is in Listing 23 where scattering_pdf returns a constant 1/(2*pi).
General observation: starting from Chapter 6 and 8 it is hard to follow the changes in the code.
Will soon be listing 28 ("Scatter function, with orthonormal basis"). At this point, the wheels kind of fall off: we update the lambertian::scatter() function signature, but neglect showing the corresponding base-class virtual function signature change. In addition, we don't show the corresponding changes to the remaining materials (metal, dielectric, diffuse_light, isotropic), nor to the material::scatter() call in camera::ray_color().
I'm halfway through the preliminary v4.0.0 book3 progression, and I've fixed some of this, but not all.