Depth of Field Shader for TGEA

DoF example

Depth of Field Shader Kit

Our Depth of Field Shader Kit will add beautiful real-time depth of field effects to your Torque Game Engine Advanced (TGEA) game. Based on real-world camera lens algorithms, our shader provides realistic and accurate depth of field simulations.

What is Depth of Field?

Video games often look synthetic or "too perfect". Depth of field is an important visual cue that helps make images look "real" to your eye. You may not know why, but if it's missing you'll perceive the image as fake. Depth of field can also guide a viewer's attention, add an artistic touch, and is an important cinematography tool.

Possible Uses

Create cut scenes with a truly cinematic feel. Draw the player's eye toward important objects in the scene. For example, racking the focus back and forth between talking characters.

Create realistic scope and "iron sight" effects for your weapons and binoculars. Blur out the weapon, but leave the scene in focus. Or, automatically adjust the focus as the player aims between near objects and far objects.

Blur out the background to save time creating assets and get a boost in performance.


Works on all objects in your scene including alpha-mapped geometry such as tree branches or window panes. All parameters are fully adjustable in real-time, including:

  • Focal Distance – distance from camera at which objects are perfectly in focus (can change instantly, or smoothly over a given number of seconds)
  • Focal Length – distance from the center of the lens to the focal point of the lens.
  • Aperture – specifies the diameter of the opening of the lens through which light enters the camera. This in combination with focal length can control the length of your depth of field.

Each camera object will remember its own unique parameters. Switch between them as you wish.

Our example code demonstrates "manual focus" and "auto focus" modes with smooth transitions while adjusting focus.

Designed to work together with our SSAO Shader for TGEA.

Download Includes

  • 6 new shader files
  • 4 new C++ files
  • Easy to follow Installation Guide

Minimum System Requirements

  • Torque Game Engine Advanced 1.7.1 or 1.8.0
  • 2.0 GHz processor (or equivalent)
  • 1 GB RAM
  • Windows XP/Vista, MacOSX
  • 3D Accelerator with Shader Model 3.0 support (GeForce 6000 / Radeon X1000 series, or newer)
    (Depth of Field quietly disables itself if Shader Model 3.0 is not supported)