Lesson 32 +10 XP

Cameras & Viewports

Cameras & Viewports

A Camera component captures the 3D or 2D world and displays it to the player. Every scene must have at least one active Camera.

Projection Modes

Cameras feature two projection modes:

  • Perspective: Objects appear smaller the further away they are from the camera. This matches how human eyes work and is used for 3D games.
  • Orthographic: Objects maintain their size regardless of distance. This has no depth perspective and is used for 2D games or isometric views.

Camera Properties

  • Field of View (FOV): For Perspective cameras, defines the viewing angle (in degrees).
  • Size: For Orthographic cameras, defines the vertical size of the viewing area.
  • Clipping Planes: Sets the distance range the camera renders.
  • Near: The closest distance the camera can see.
  • Far: The furthest distance the camera can see. Objects beyond this plane are culled.
  • Clear Flags / Background: Determines what is drawn in empty screen areas (e.g. Skybox or solid color).

Viewport Rect (Split Screen)

The Viewport Rect settings control where the camera's image is rendered on the screen:

  • Coordinates run from 0 to 1 (X, Y, W, H).
  • By modifying these values, you can create split-screen multiplayer games or picture-in-picture maps.

Render Textures

By changing the Output Texture property, a camera can render directly into a Render Texture asset instead of the screen. You can then apply this texture to a material, creating in-game security cameras, mirrors, or portal effects.

TL;DR

  • Cameras render the scene. Select Perspective for 3D, and Orthographic for 2D.
  • Clipping planes define the boundaries of what is rendered.
  • Viewport Rect coordinates set the camera's rendering bounds on screen.
  • Render Textures let cameras project scenes onto in-game object materials.