mirror of
https://github.com/MorizzG/ray-tracer.git
synced 2025-12-06 04:22:42 +00:00
chapter 8 done
This commit is contained in:
parent
29832e8f1b
commit
dabddf8e12
1 changed files with 4 additions and 2 deletions
|
|
@ -43,8 +43,10 @@ class Renderer {
|
||||||
constexpr Ray SampleRay(u32 i, u32 j) {
|
constexpr Ray SampleRay(u32 i, u32 j) {
|
||||||
auto pixel_centre = camera_.PixelToWorld(i, j);
|
auto pixel_centre = camera_.PixelToWorld(i, j);
|
||||||
|
|
||||||
pixel_centre += rand_.GenF64(-0.5, 0.5) * camera_.d_u_pixel();
|
Vec3 random_shift = rand_.GenF64(-0.5, 0.5) * camera_.d_u_pixel() +
|
||||||
pixel_centre += rand_.GenF64(-0.5, 0.5) * camera_.d_v_pixel();
|
rand_.GenF64(-0.5, 0.5) * camera_.d_v_pixel();
|
||||||
|
|
||||||
|
pixel_centre += random_shift;
|
||||||
|
|
||||||
auto ray_direction = pixel_centre - camera_.centre();
|
auto ray_direction = pixel_centre - camera_.centre();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue