Introduction to Camera3D
TheCamera3D node defines the viewpoint from which the 3D scene is rendered. Understanding camera projections, positioning, and movement is essential for creating engaging 3D experiences.
Only one camera can be active per viewport. Cameras register in the nearest
Viewport node when ascending the tree.Basic Camera Setup
Projection Types
Godot supports three camera projection modes:- Perspective
- Orthogonal
- Frustum
The default projection where distant objects appear smaller (realistic 3D).See doc/classes/Camera3D.xml:207-209, 186-192, 204-205, 183-184
Field of View (FOV)
Controls how wide the camera can see in perspective mode:The default 75° vertical FOV equals approximately:
- 91° horizontal in 4:3
- 102° horizontal in 16:10
- 108° horizontal in 16:9
- 122° horizontal in 21:9
Near and Far Planes
Define the camera’s visible distance range:Making a Camera Active
Camera Positioning Methods
Using set_perspective
Using set_orthogonal
Using set_frustum
Camera Offset
Adjust the camera viewport without moving the camera:Frustum and Culling
Get Frustum Planes
Cull Mask
Control which visual layers the camera renders:Position Queries
Check if Position is Behind Camera
Check if Position is in Frustum
Screen-World Conversions
Project 3D to 2D (World to Screen)
Unproject 2D to 3D (Screen to World)
Ray Casting from Screen
Camera Attributes
Customize exposure, DOF, and other effects:Environment
Set custom environment for this camera:Compositor
Apply post-processing effects:Doppler Tracking
Simulate doppler effect for audio:Camera Following
Smooth camera following pattern:Third-Person Camera
Orbiting camera with mouse control:First-Person Camera
Mouse-look FPS camera:Split-Screen with Multiple Cameras
Create split-screen multiplayer:Camera Shake Effect
Debugging Cameras
Best Practices
Adjust Near/Far Carefully
Adjust Near/Far Carefully
Balance between Z-fighting and visible range:
Use Appropriate FOV
Use Appropriate FOV
Different FOV for different game types:
Smooth Camera Movement
Smooth Camera Movement
Always interpolate camera movement:
Check Position Visibility
Check Position Visibility
Before positioning UI over 3D:
Use Cull Masks for Performance
Use Cull Masks for Performance
Don’t render unnecessary layers:
Related Topics
3D Overview
3D coordinate systems and Node3D
Viewport
Understanding viewports
Environment
Environments and post-processing
Input Handling
Mouse and keyboard input
Resources
- Third Person Shooter Demo
- Camera3D Reference: doc/classes/Camera3D.xml