WEEK 3
Lights &
Cameras
in Unity
COIT20271 Mobile Game Development
Making your game world come alive through
proper lighting and camera techniques.
Types of Lights
Directional · Point · Spot · Area
Light Properties
Intensity · Color · Shadows · Range
Camera Types
Perspective vs Orthographic
Camera Properties
FOV · Clipping · Viewport Rect
Tips & Best Practice
Lighting, camera rigs & shortcuts
Types of Lights in Unity
Quick Tip: Start every scene with one Directional Light for global illumination, then layer Point/Spot lights for atmosphere. Too many real-time lights hurt performance.
Key Light Properties (Inspector)
Color
Intensity
Shadow Type
Range & Angle
Render Mode
Baked vs Real-Time
Lighting Tips for Your Game
01
Three-Point Lighting
Borrow from filmmaking: Key light (main), Fill light (soften shadows), Rim/Back light (separate subject from background). Works for indoor and outdoor scenes.
02
Use Ambient Light
Window → Rendering → Lighting → Environment. Ambient light sets the minimum brightness of all surfaces. A dark ambient makes shadows too black; too bright kills contrast.
03
Bake Static Geometry
Mark buildings, terrain, and props as 'Static' then bake the Lightmap. This dramatically improves performance on mobile — no real-time shadow cost at all.
04
Limit Real-Time Lights
Mobile devices struggle with more than 1–2 real-time per-pixel lights. Use Render Mode: Not Important for fill lights to reduce the GPU cost.
05
Light Probes for Moving Objects
Baked lights don't affect dynamic objects automatically. Add Light Probe Groups around areas where characters move to give them correct indirect lighting.
06
Colour Temperature Trick
Slightly warm your key light and cool your shadows (e.g. Key = #FFF5E0, Shadow tint = #D0E8FF). This contrast reads as natural sunlight and increases depth.
Camera: Perspective vs Orthographic
Perspective: Default for 3D games. Mimics the human eye. Near Clip = 0.3, Far Clip = 1000 recommended.
Orthographic: Best for 2D or UI cameras. Size controls zoom (not FOV). No depth distortion.
Field of View (FOV) Explained
30° FOV → Sniper / cinematic zoom. Objects appear close. Depth of field effect is strong.
60° FOV → Natural human vision. Good default for 3rd-person action games.
100°+ FOV → Immersive first-person. Can feel nauseating. Use 80–90° for FPS.
Camera Properties You Must Know
Property
Default Value
Description
Field of View
60° default
Horizontal angle the camera sees. Higher = wider but more distortion.
Near Clip Plane
0.3 default
Anything closer than this is clipped (invisible). Keep ≥ 0.1 to avoid z-fighting.
Far Clip Plane
1000 default
Anything beyond this disappears. Lower values improve performance on mobile.
Viewport Rect
X Y W H (0–1)
Defines where on screen this camera renders. Useful for split-screen or minimaps.
Depth
integer, -1 default
Higher depth cameras render on top. Set your minimap camera to Depth 1 to overlay.
Clear Flags
Skybox / Solid Color
What fills empty space. Skybox for 3D, Solid Color for UI-only cameras.
Culling Mask
Layer bitmask
Which layers this camera renders. Use to exclude UI or minimap objects from main camera.
Target Texture
RenderTexture asset
Renders to a texture instead of screen — used for security cameras, portals, minimap.
Camera Tips & Techniques
01
Third-Person Follow Camera
Create an empty 'CameraRig' parent. Place Camera as child with offset (0, 3, –6). Rotate the rig, not the camera. Use LateUpdate() in scripts so the rig follows after physics update.
02
Use Cinemachine (Recommended)
Package Manager → Cinemachine → Install. Add CinemachineVirtualCamera, set Follow and Look At targets. Handles smoothing, collisions and transitions automatically — no manual coding.
03
Prevent Camera Clipping
Use a SpringArm-style script: cast a Raycast from target toward camera. If it hits geometry, pull camera forward. Set Minimum FOV so it never clips inside tight spaces.
04
Multiple Cameras
You can have multiple cameras — only the highest Depth renders last. Set Clear Flags to 'Depth Only' on secondary cameras (e.g., UI or minimap overlay). Adjust Viewport Rect for split-screen.
05
Camera Shake
Add a script with Random.insideUnitSphere * intensity offset on the camera position. Reset after duration. Cinemachine Impulse Source makes this even easier — just call GenerateImpulse().
06
Smooth Camera Lag
In LateUpdate, use Vector3.Lerp(cam.position, target, smoothSpeed * Time.deltaTime). The lag gives a polished, game-feel response — avoid snapping directly to target position.
Essential Shortcuts to Memorise
Shortcut
Action
Shortcut
Action
F
Frame selected object in Scene view
Ctrl+Shift+F
Move camera to current Scene view position
Ctrl+D
Duplicate selected object
Q W E R T
Pan / Move / Rotate / Scale / Rect tool
Alt + drag
Orbit camera around pivot
Right-click + WASD
Fly through Scene (hold Shift = fast)
Ctrl+Z / Ctrl+Y
Undo / Redo
Ctrl+P
Play / Stop game
Ctrl+Shift+N
Create empty GameObject
F2
Rename selected object
Ctrl+1 … 9
Switch between Editor layout presets
Alt+P
Pause game while playing
Ctrl+R
Refresh / reimport assets
Numpad 0
View from Game Camera (if numpad present)
Ctrl+Shift+C
Open Console window
Ctrl+9
Open Package Manager