How to control perspective distortion of THREE.PerspectiveCamera

I’m experiencing distortion when using a PerspectiveCamera in Three.js. Objects closer to the edges of the view appear stretched or skewed. Is this expected behavior due to the camera’s FOV, or could it be related to my camera settings or scene configuration? Any suggestions on how to minimize this distortion would be appreciated.

1 Like

Pretty sure that’s expected behavior HOWEVER…

You do want to make sure your renderer is properly sized to its container or window, which means having a proper resize handler that calls renderer.resize(…
and resets the:

 camera.aspect = width/height;
camera.updateProjectionMatrix();

Thank you for your reply.
However, I don’t think the issue is related to the renderer size, as I am using a fixed canvas size (960x720) and have set the camera aspect ratio accordingly.

Yeah your screenshot looks like everything is correct.
It looks like you camera is positioned perhaps a little below the cube, looking towards it.

This is a normal and expected behaviour of how perspective projection is calculated in computer graphics. It uses a flat projection plane, instead of a curved surface. See the diagram below, an object at the left edge should appear horizontally stretched, even if it is at the same distance from the projection plane.

There are several ways to deal with this:

  1. use orthographic projection (at the cost of losing perspectiveness)
  2. use very narrow FOV (at the cost of reduced vision span and a need to zoom/rescale things, also note that small FOV does not eliminate stretching, it only reduces it to a reasonable distortion)
  3. use spherical projection surface (at the cost of mangling with the internals of Three.js or even WebGL, as you cannot use the projection matrix as it is now)
6 Likes

awesome answer.

2 Likes

In addition to @PavelBoytchev’s great illustration and second suggestion, you can debug your camera view using this jsFiddle. The main idea is to increase the camera distance, lower the FOV value, also don’t forget about setting appropriate near and far values for a better performance.