8
$\begingroup$

enter image description here enter image description here

Some context. Above are the code and the resulting image for it in Peter Shirley's Raytracing in one weekend's book. As you can see from the code, he adds in some spheres. And yet in the final image there are 2 ellipsoids side by side. I just can't fathom why it is so, no matter how many time I looked at the code. Can anyone explain to me? Here's the link to the source code. https://github.com/petershirley/raytracinginoneweekend

$\endgroup$
  • 2
    $\begingroup$ This looks normal and is caused by the perspective camera being close to the spheres and having a large FOV value. $\endgroup$ – PaulHK Nov 2 '18 at 5:29
  • $\begingroup$ Btw, this is not exclusive to ray tracing. $\endgroup$ – Sebastian Mach Nov 2 '18 at 11:00
16
$\begingroup$

Shapes appearing stretched in the periphery is a consequence of perspective projection. The wider the field of view (FOV) is, the stronger the stretching effect gets.

To demonstrate the effect I wrote a quick example on ShaderToy: https://www.shadertoy.com/view/MltBW2

As you can see on the images below (corresponding to FOV of 40, 80 and 120; if I didn't make any mistake), this becomes especially noticeable with wide FOV, like 90° and above.

FOV 40° FOV 80° FOV 120°

$\endgroup$
  • $\begingroup$ Nice example. It might help to have some kind of a texture (e.g. a grid) on the ground plane, though; otherwise it's hard to tell the difference between changing the view angle and just moving the camera. (See also: dolly zoom.) $\endgroup$ – Ilmari Karonen Nov 2 '18 at 11:47
  • 1
    $\begingroup$ It should also be noted that this effect typically happens with a high-FOV relative to the distance of the objects from the camera. It looks unnatural because you usually don't see objects from that close to your eyes. At least, not without quickly turning your eyes. $\endgroup$ – Nicol Bolas Nov 2 '18 at 13:56

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.