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)

Cascaded shadow maps


In the previous two chapters when we covered lighting calculations, the directional light was always the first recipe. The directional light has no attenuation to worry about and it spans infinitely in every direction. These two qualities which make directional lighting easy to calculate, turn into an obstacle when calculating shadows.

In order to add shadow's support to the directional light, we need a way to map the entire scene area into a fixed size shadow map. For a very small scene, it may be possible to allocate a large shadow map and have it cover the entire scene. For a decent-sized scene, however, this will result in very bad scene to shadow map pixel ratio. If you recall from the introduction, this pixel ratio is a key factor in the amount of shadow-related artefacts we are going to see in the lighting/shadowing result image. Getting good quality shadows while lighting a decent-sized scene requires a more sophisticated solution.

Since we can't cover the whole...