This sample demonstrates High Dynamic Rendering with Auto-Exposure and Tonemapping


APIs Used

  • glDispatchCompute
  • glMemoryBarrier
  • glGenFramebuffers
  • glBindFramebuffer

Shared User Interface

The Graphics samples all share a common app framework and certain user interface elements, centered around the "Tweakbar" panel on the left side of the screen which lets you interactively control certain variables in each sample.

To show and hide the Tweakbar, simply click or touch the triangular button positioned in the top-left of the view.

Technical Details


High Dynamic Range (HDR) imaging has become an essential feature for both photography and game graphics.

Dynamic range is simply defined as the ratio in brightness between the brightest and darkest parts of an image. HDR images allow the full range of brightness in a scene to be captured accurately.

For a full description see:

Rendering Procedure

  1. Render Scene to an RGBA16F FBO at full dynamic range.

  2. Downsize (filter) scene buffer by 4x in both dimensions for post processing.

  3. Downsize (filter) the result by a further 16x in each dimension. Run a compute shader on the result to generate a single luminance value for auto-exposure calculations.

  4. Extract the highlighted areas for further processing by thresholding luminance values above and below an adjustable cutoff. Scale the result as desired.

  5. Generate a pyramid of processed images, computing another Gaussian blur on each.

  6. Generate highlight streaks in four directions.

  7. Generate ghosted highlight images in 2 passes.

  8. Composite the passes into a final image.

  9. Compress the result to low dynamic range via tonemapping and gamma correction to the onscreen RGB888 framebuffer.


  • Enable/Disable draw background

  • Enable/Disable auto exposure

  • Exposure key adjustment

  • Select scene

  • Select material

  • Select model

  • Select glare type