diff options
author | Julian T <julian@jtle.dk> | 2021-02-05 20:17:20 +0100 |
---|---|---|
committer | Julian T <julian@jtle.dk> | 2021-02-05 20:17:20 +0100 |
commit | 1e83ea211055eb234b89c69b5d03602e3fcb98fb (patch) | |
tree | 7b58c7e6d7d174906541e9f2acf546294f8e9ca5 /src/camera | |
parent | 9235e74dfbc41895a5f8807e1ab93508268a39ea (diff) |
Achieve anti aliasing with multi pixel sampling
Diffstat (limited to 'src/camera')
-rw-r--r-- | src/camera/film.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/camera/film.rs b/src/camera/film.rs index 3586374..7193e1d 100644 --- a/src/camera/film.rs +++ b/src/camera/film.rs @@ -45,7 +45,7 @@ impl Pixel { } fn finalize_rgb(&self) -> [u8; 3] { - let (r, g, b) = self.rgb.to_rgb(255.0); + let (r, g, b) = (&self.rgb / (self.samples as Float)).to_rgb(255.0); [ r as u8, g as u8, @@ -128,8 +128,8 @@ impl FilmTile { } /// Add a single sample sampled from the scene - pub fn add_sample(&mut self, point: &Vector2f, c: Spectrum) { - let point = Vector2i::from(point.floor()); + pub fn add_sample(&mut self, inp: &Vector2f, c: Spectrum) { + let point = Vector2i::from(inp.floor()); // Subtract the offset let point = point - self.bounds.min; |