Minor rearrangement of ray generation sampling code.

This commit is contained in:
Nathan Vegdahl 2022-07-17 21:16:00 -07:00
parent 89429ed9f0
commit ceed59887a

View File

@ -240,15 +240,16 @@ impl<'a> Renderer<'a> {
for x in bucket.x..(bucket.x + bucket.w) { for x in bucket.x..(bucket.x + bucket.w) {
for si in 0..self.spp { for si in 0..self.spp {
// Raw sample numbers. // Raw sample numbers.
let (d0, d1, d2, d3) = let d0 = golden_ratio_sample(si as u32, self.seed, (x, y), self.spp as u32);
let (d1, d2, d3, d4) =
get_sample_4d(si as u32, 0, (x, y), self.seed, self.spp as u32); get_sample_4d(si as u32, 0, (x, y), self.seed, self.spp as u32);
let (d4, _, _, _) = let (d5, _, _, _) =
get_sample_4d(si as u32, 1, (x, y), self.seed, self.spp as u32); get_sample_4d(si as u32, 1, (x, y), self.seed, self.spp as u32);
// Calculate image plane x and y coordinates // Calculate image plane x and y coordinates
let (img_x, img_y) = { let (img_x, img_y) = {
let filter_x = probit(d3, 2.0 / 6.0) + 0.5; let filter_x = probit(d4, 2.0 / 6.0) + 0.5;
let filter_y = probit(d4, 2.0 / 6.0) + 0.5; let filter_y = probit(d5, 2.0 / 6.0) + 0.5;
let samp_x = (filter_x + x as f32) * cmpx; let samp_x = (filter_x + x as f32) * cmpx;
let samp_y = (filter_y + y as f32) * cmpy; let samp_y = (filter_y + y as f32) * cmpy;
((samp_x - 0.5) * x_extent, (0.5 - samp_y) * y_extent) ((samp_x - 0.5) * x_extent, (0.5 - samp_y) * y_extent)
@ -260,14 +261,9 @@ impl<'a> Renderer<'a> {
self.seed, self.seed,
(x, y), (x, y),
(img_x, img_y), (img_x, img_y),
(d1, d2), (d2, d3),
d0, d1,
map_0_1_to_wavelength(golden_ratio_sample( map_0_1_to_wavelength(d0),
si as u32,
self.seed,
(x, y),
self.spp as u32,
)),
si as u32, si as u32,
self.spp as u32, self.spp as u32,
); );