Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
HLSL Development Cookbook

You're reading from   HLSL Development Cookbook Implement stunning 3D rendering techniques using the power of HLSL and DirectX 11

Arrow left icon
Product type Paperback
Published in Jun 2013
Publisher Packt
ISBN-13 9781849694209
Length 224 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Doron Feinstein Doron Feinstein
Author Profile Icon Doron Feinstein
Doron Feinstein
Arrow right icon
View More author details
Toc

Spot light PCF shadows


Out of all the different light sources we covered, adding shadow-casting support to spot lights is the easiest to accomplish. We will be using a technique based on the way projected textures are handled (covered in Chapter 1, Forward Lighting). This shadow-casting technique is called percentage-closer filtering (PCF).

The following screenshot features a side-by-side view of the same spot light with no shadows on the left-hand side and with shadows on the right-hand side:

One side benefit of shadows is that they help clarify the relative height between different scene elements. In the left image of the screenshot, it's hard to tell if the bunny is floating in the air or standing on the surface. The shadows on the right image help us determine that the bunny is standing on the surface.

Getting ready

Similar to the way we handled projected textures, we will need to generate a transformation from world space to the light's projected view space for each spotlight-casting shadow...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image