Graphics Reference
In-Depth Information
5. Whenever you update one of these four properties of the camera, you have
to inform Three.js about such a change. You do this by adding the following
line:
camera.updateProjectionMatrix();
6. Now, all that is left to do is position the camera and add it to the scene:
camera.position.x = 15;
camera.position.y = 16;
camera.position.z = 13;
scene.add(camera);
At this point, we can use this camera with any of the available renderers to render a
scene like this:
renderer.render(scene, camera)
.
How it works...
The best way to understand how these properties affect what is rendered on screen
is by looking at the following figure, which shows you these properties:
The position of
Near plane
in this figure is based on the
near
property of the cam-
era.
Far plane
is based on the
far
property and the
fov
shown in the figure cor-
responds to the
fov
property. With the
fov
property, you define the vertical field of
view. The horizontal field of view is based on the aspect ratio, which you define with
the
aspect
property on the camera.