Book Image

HLSL Development Cookbook

By : Doron Feinstein
Book Image

HLSL Development Cookbook

By: Doron Feinstein

Overview of this book

3D graphics are becoming increasingly more realistic and sophisticated as the power of modern hardware improves. The High Level Shader Language (HLSL) allows you to harness the power of shaders within DirectX 11, so that you can push the boundaries of 3D rendering like never before.HLSL Development Cookbook will provide you with a series of essential recipes to help you make the most out of different rendering techniques used within games and simulations using the DirectX 11 API.This book is specifically designed to help build your understanding via practical example. This essential Cookbook has coverage ranging from industry-standard lighting techniques to more specialist post-processing implementations such as bloom and tone mapping. Explained in a clear yet concise manner, each recipe is also accompanied by superb examples with full documentation so that you can harness the power of HLSL for your own individual requirements.
Table of Contents (13 chapters)

Bloom


Bloom is another postprocessing effect commonly used with HDR which reproduces a video camera artifact. You can think of bloom as light leakage from very bright pixels to dimmer neighbouring pixels. The following images show the same scene without bloom on the left and with bloom on the right:

Bloom is tightly connected to HDR rendering as it requires the average luminance to determine which pixels are bright enough to leak into their neighbors. In addition, blooming in LDR values is very likely to saturate values which will result in an output image which looks burned.

Getting ready

First we need to add three new textures with a size of 1/16 of the HDR texture along with corresponding SRVs and UAVs. Make sure you use the same format as the HDR texture for both of these textures. The new textures will contain the following data:

  • Down scaled HDR texture

  • Temporary storage for the non-filtered bloom values

  • Final bloom values

How to do it...

Our first task is to downscale the HDR texture. Fortunately...