-
Notifications
You must be signed in to change notification settings - Fork 27
Cameras
thothbot edited this page Mar 4, 2016
·
3 revisions
Class diagram for cameras
A camera of class PerspectiveCamera
emulates the human eye: objects farther away appear smaller in size. Perspective camera projections are natural in situations where you want to imitate how objects appear to a human observer.
PerspectiveCamera camera = new PerspectiveCamera(
45, // vertical field of view
width / height, // aspect ratio
1, // near plane
1000 ); // far plane
In contrast to perspective cameras, cameras of class OrthographicCamera
produce parallel projections, with no distortions for distance. Orthographic cameras are useful for precise design work, where visual distortions would interfere with exact measurement.
// Simple creation in Parallax 1.3
OrthographicCamera camera = new OrthographicCamera(
width, // width plane
height, // height plane
1, // near plane
1000 ); // far plane
// Complex creation
OrthographicCamera camera = new OrthographicCamera(
width / - 2, // left
width / 2, // right
height / 2, // top
height / - 2, // bottom
1, // near
1000 ); // far
Cube camera used for rendering cube maps.
// Simple example how to use the camera
CubeCamera cubeCamera = new CubeCamera(
1, // near
1000, // far
256 ); // cube resolution
cubeCamera.getRenderTarget().setMinFilter( TextureMinFilter.LINEAR_MIPMAP_LINEAR );
getScene().add( cubeCamera );
MeshBasicMaterial material = new MeshBasicMaterial();
material.setEnvMap( cubeCamera.getRenderTarget() );