Camera Fundamentals
All cameras share certain core properties:
// Core camera properties
camera.position = new BABYLON.Vector3(0, 5, -10); // Position in 3D space
camera.target = new BABYLON.Vector3(0, 0, 0); // Look-at target
camera.fov = 0.8; // Field of view in radians
camera.minZ = 0.1; // Near clipping plane
camera.maxZ = 1000; // Far clipping plane
Field of View (FOV) controls the camera's viewing angle, measured in radians. A wider FOV (higher value) creates a fisheye-like effect showing more of the scene but with more distortion. A narrower FOV (lower value) creates a telescopic effect with less distortion but shows less of the scene. Typical values range from 0.5 to 1.2 radians (approximately 30° to 70°).
Near and Far Clipping Planes define the viewing frustum's boundaries:
- The Near Clipping Plane (
minZ
) is the minimum distance from the camera at which objects become visible. Objects closer than this distance won't be rendered. It should be set as large as possible (typically 0.1-1.0) while still including all necessary objects to avoid precision issues. - The Far Clipping Plane (
maxZ
) is the maximum distance from the camera at which objects are still visible. Objects beyond this distance won't be rendered. Setting this value appropriately (typically 100-2000) can improve performance and depth buffer precision.