0
votes

This image is using perspective camera but sphere shape is distorted when it is moving away from the center.

this image is using Orthographic camera but spheres and cuboid are not in 3D...

can any one suggest possible solution for this to get 3D effect without sphere distorting its shape...

1
Use a smaller field of view. The higher your field of view the more things distort at the edges. Go here, click the tiny asterisk next to change view, drag the fieldOfView slider, notice how distorted things become the wider the field of view. - gman
You can prevent the distorted spheres by using a THREE.Sprite instead: threejs.org/examples/webgl_sprites.html. If for some reason that is not acceptable, then you need to dynamically scale/rotate each sphere so it is a properly-oriented ellipsoid; the proper ellipsoid will project to a circle. That is a doable math problem. - WestLangley
Thank you for your comments but can you please tell me how to scale sphere depends on position so that distortion does not happen using perspective camera... And I don't want to make scaling(Z) to 0 as I need to rotate the sphere. - user3363468

1 Answers

1
votes

This is exactly correct. Spheres distortion and cuboid perspective effect are both caused by the same perspective projection properties.

One possible solution would be to split your scene in two parts:

  • render background (cuboid) with perspective projection
  • render spheres using orthographic projection

Another solution would be to draw everything with orthographic and modify your cuboid to be a trapezoid, so that it only looks like to be in perspective.

Having perspective and no distortions sounds mutually exclusive if you think about it. Imagine a sphere consists of 2 parts - front and rear. Now you say you need objects farther from camera to be smaller, but at the same time you say you want front and rear of sphere to be the same size - not possible. You can achieve desired effect with orthographic projection if you manually specify spheres size to be smaller when they are farther. Or alternatively you can use perspective projection and scale your spheres to be flat by depth axis (but keep the normals to preserve proper lighting)