Currently I have basic shadow mapping setup in my engine. I am currently trying to implement something more realistic like PCSS (percentage closer soft shadows), to get a more physically accurate result just like the image below. (See how the shadow becomes softer & softer towards the end?)

enter image description here

My 2 questions are:

1) Is it worth implementing a shadow mapping technique like this? Will people actually notice the difference?

2) If it is worth it, what are some resources where I can learn more about it? What are the major techniques like PCSS?

  • $\begingroup$ What is your use case? Are you working on a game? Photo-realistic rendering for cinema? CAD? That makes a huge difference to whether people will notice or not. $\endgroup$ – user1118321 Oct 18 '16 at 2:29
  • $\begingroup$ This is for a game but do people anyway notice it in a CAD Visualization or in Cinema Rendering? $\endgroup$ – Arjan Singh Oct 18 '16 at 5:33
  • 3
    $\begingroup$ Certainly in cinema rendering it would be noticeable, especially if it was mixed with live action footage. For CAD, it would probably be desired for renderings shown to, say, an architectural client, but probably not as necessary when doing the modeling, I would think. Most games I've played have not had the greatest shadows. I usually notice, but don't know how much a typical person would. Anyway, I just wanted to clarify the use case because it can make a difference between whether you need realtime or not and what quality vs. time tradeoffs you might be willing to make. $\endgroup$ – user1118321 Oct 18 '16 at 16:19
  • $\begingroup$ "Is it worth it?" entirely depends on your use case. You can (and should) look at what is done in products with a similar use case and set of constraints as yours, but in the end only you can make that decision. $\endgroup$ – Julien Guertault Oct 21 '16 at 3:09

For light sources with larger solid angle and where the shadow caster is relatively closer to the light than the receiver, you get notable soft shadowing effect. So if you render larger light sources closer to the shadow receiver it's important to handle soft shadows properly for realistic lighting. Even with the Sun which has quite small solid angle, you can still see fairly large penumbras from tall buildings.

PCSS is fairly simple algorithm for implementing contact hardening shadows, but it has some notable issues. PCSS fails when you have soft and hard shadows intersecting (blocker search fails), so it's not a good algorithm to use when large penumbras are needed. See in the below image where shadows from the box & triangle intersect. This artifact is particularly disturbing when animated.

PCSS artifact

There's a family of "back-projection" shadow techniques though, which is able to handle larger penumbras. However, there's a little research done how to implement this efficiently for real-time applications that I'm aware of.

enter image description here

In back-projection the principle idea is to project shadow map texels to the light source for every pixel to calculate light occlusion, which when implemented naively is obviously extremely slow and furthermore introduces shadow gaps & overlaps. However, there are some techniques to try to avoid the artifacts, such as adjusting the microquad extents as shown below.

enter image description here

Another improvement to handle the gaps and overlaps is to use bitmask soft shadowing algorithm, where occlusion bitmask determines the occluded areas of the light source.

The most recent paper I have seen on the topic is "Real Time Area Lighting. Now and Next" by Sam Martin from 2012, where the cost was several milliseconds for a single light, but it's definitely worth the read if you are interested of the topic, to get general idea about the state-of-the-art real-time shadow techniques.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.