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)

Screen space Sun rays


Sun rays are bright light streaks that normally show up when the Sun is partially or completely occluded and rays of light stretch from the edges of the occlusion outwards. It is very common to see this phenomenon when thick clouds obscure the Sun and the rays are visible through the gaps between those clouds. This effect's scientific name is Crepuscular rays, but it goes by many other names such as God rays, Sun rays, and light shafts. In games, photography, and movies, it is not uncommon to see Sun rays either generate from a bright light source other than the Sun or due to occlusion from objects other than clouds. The following screenshot demonstrates how Sun rays can be seen when the Sun is occluded by an opaque object:

There are multiple ways to calculate light rays, each with different limitations and performance requirements. In this recipe, we will approximate the Sun light rays using a screen space calculation. As with all the other screen space techniques,...