PDA

View Full Version : Shadow mapping, what technique should i choose??



Darkpower
07-09-2015, 04:30 PM
Hey!

I have been reading a lot about Shadow mapping. It exists dozens of different techniques with its pros/cons. It's very hard to choose which one that can fit in a complex scene. I need good looking shadows without very serious artifacts. Which technique is the most widely used nowadays?

-PCF seems to "suck" when it comes to performance... It also suffers from banding artifacts.

-PCF with filtering, more expensive.

-Variance shadow mapping suffers from light bleeding . This can be reduced with other stuff.

-Shadow volumes. This technique dies if the camera is located inside a volume..

-Cascaded shadow maps. Don't know how it works right now.

-Exponential Shadow Maps

etc...

Thanks in advance!

Alfonse Reinheart
07-09-2015, 07:23 PM
-PCF seems to "suck" when it comes to performance... It also suffers from banding artifacts.

-PCF with filtering, more expensive.

PCF is filtering; it's what happens when you turn on filtering and use depth comparison lookups (https://www.opengl.org/wiki/Sampler_Object#Comparison_mode). It's also not orthogonal with any particular shadow mapping technique.


-Shadow volumes. This technique dies if the camera is located inside a volume..

No, it does not. You can use Carmack's reverse (https://en.wikipedia.org/wiki/Shadow_volume#Depth_fail) to make it work.

Also, shadow volumes are not a shadow mapping technique; they're a completely different way of dealing with shadows.

Dark Photon
07-10-2015, 06:55 AM
-PCF seems to "suck" when it comes to performance... It also suffers from banding artifacts.

Not in my experience. How old is your GPU? It's basically free on NVidia GPUs.


-Variance shadow mapping suffers from light bleeding . This can be reduced with other stuff.
Read up on Exponential Shadow Maps (ESM) and combinations of this with VSM.


-Shadow volumes. This technique dies if the camera is located inside a volume..
See Alonso's correction. Nevertheless, unless your scene is trivial, it's very fill intensive. If you don't like PCF performance, you'll absolutely detest shadow volumes.


-Cascaded shadow maps. Don't know how it works right now.

Describe your requirements. If you're doing the standard thing of rendering a scene in perspective with a camera that moves through the world, and if your camera frequently is facing generally toward the horizon, you should strongly consider Cascaded Shadow Maps (CSM) (aka Parallel-split Shadow Maps - PSSM) and the various extensions that have been applied to these over the years.

Note that choosing CSM/PSSM (or not) is orthogonal to the filtering technique you choose. So you could CSM with EVSM (ESM + VSM) filtering. Back when I was looking into shadow mapping, this looked like the leading candidate.


(Note that in shadow mapping lore, CSM might also be used as an abbreviation for Convolution Shadow Maps which is another type of filtering.)

Grognard
07-12-2015, 03:47 PM
Describe your requirements. If you're doing the standard thing of rendering a scene in perspective with a camera that moves through the world, and if your camera frequently is facing generally toward the horizon, you should strongly consider Cascaded Shadow Maps (CSM) (aka Parallel-split Shadow Maps - PSSM) and the various extensions that have been applied to these over the years.

Note that choosing CSM/PSSM (or not) is orthogonal to the filtering technique you choose. So you could CSM with EVSM (ESM + VSM) filtering. Back when I was looking into shadow mapping, this looked like the leading candidate.


(Note that in shadow mapping lore, CSM might also be used as an abbreviation for Convolution Shadow Maps which is another type of filtering.)

What is the best option for a 2.5d game?

Alfonse Reinheart
07-12-2015, 04:36 PM
"2.5d game" is really not enough information to go on. Some 2.5D games use 3D backgrounds with 2D sprites. Some 2.5D games use 3D backgrounds, but actually change the camera angle during gameplay, so that rather than remaining on a flat plane, the player moves forward/backwards through a bent plane.

Your lighting (and shadowing) needs depend on the specifics of what you're doing when you say that it's "2.5D".

Grognard
07-12-2015, 05:23 PM
I'm making a game where the angle is constrained to be between around 45 degrees and 85 degrees with the surface (ie mostly overhead).

I want to have 30-40 animated characters with 6000-1000 vertices and less than 100 bones active onscreen at the same time. I want to have high quality lighting and shadows but I do not need more than a few light sources visible on any particular character at a time. The 'surface' itself would be a 3D surface, mainly something like a spaceship interior or space station interior. So far none of the interiors are very large, and I don't plan to make them very large at this point.

It's a turn-based strategy game so most of the time the characters will just be idling (and if performance gets to be a big enough problem I can pause the animation for characters that are not moving).

I was using C4 game engine but I am trying to move to my own game engine. I am still mostly in the information gathering and learning stages, though.