FOV (Field of view)
Manipulating the FOV property value can make 3D display objects appear larger up close and smaller at a distance. The FOV property represents an angle, between 0 and 180 degrees, indicating the strength of the perspective projection. The larger the value, the stronger the distortion applied to the display object along the z-axis. A smaller value results in a very small scaling factor and very little variation in the objects’ distance from one another in space. A larger value causes greater distortion and makes objects appear to move more. The maximum is 179.99999… degrees, which gives an extreme fisheye lens effect. The minimum is 0.0000…1; 0 and 180 are both invalid values.
Projection Center
The projection center represents the vanishing point of the perspective projection. It is an offset value added to the default registration point, which is the top-left corner of the stage (0,0). Objects farther from the viewer skew toward the vanishing point until they eventually disappear. Think of an infinitely long hall: as you look down it, you see the edges of the walls converge at the vanishing point at the far end of your line of sight. If the vanishing point is at the center of the stage, the far end of the hall disappears at the center point. The default is usually the center of the stage. If you need the farthest view to disappear at the right side of the screen, set the projection center to the coordinates of the rightmost point of the stage.
Focal length
Focal length represents the distance between the original view point (0,0,0) and the display object’s own z-axis position. A long focal length is like a telephoto lens: it has a narrow view, and the distances between objects are compressed. A short focal length is like a wide-angle lens, giving you a very wide view but with significant distortion. A medium focal length is roughly close to how the human eye sees the world. Focal length is often recalculated dynamically during perspective transformations (such as object movement), but you can also set it manually.
Default perspective projection parameters
- FOV: 55
- perspectiveCenter: stagewidth/2, stageHeight/2
- focalLength: stageWidth/ 2 * ( cos(fieldOfView/2) / sin(fieldOfView/2) )
For example: when the stage size is 500*500, set the following values:
- fieldOfView: 55
- perspectiveCenter: 250,250
- focalLength: 480.24554443359375