Skip to main content
GameDev.net gamedev.net
🔒 Locked

PCF Soft Shadow

Started by PandaProtector23 Dec 17, 2011 at 2:10 AM 5 replies 3.1k views
Original Post
PandaProtector23
PandaProtector23
Hi guys.
I'm posting concerning shadow implementation. I have try to implement [font=Arial][size=2]soft shadows with PCF. I have test with 2 "map" size and i haven't got the result that i was expecting.[/font]
[font=Arial][size=2]
[/font]
[font=Arial][size=2]Here its a map of 5X6 cube[/font]


Here its a map of 10X12 cube


I haven't change anything except the 3d objects that are create. What should i change to be able to render more objects or bigger objetcs?

Thank you. smile.gif
dpadam450
dpadam450
What should i change to be able to render more objects or bigger objetcs?[/quote]
Cascaded Shadow Maps

and i haven't got the result that i was expecting[/quote]
Because PCF sucks. It eats a lot of samples and produces results based on the aliasing of the projected shadow map. Try Variance shadow maps or screen space soft shadows.

To get rid of that acne on your objects, make sure all surfaces with a normal pointing away from the light are set to shadowed in your shader, that eliminates all acne.
NBA2K, Madden, Maneater, Killing Floor, Sims 
PandaProtector23
PandaProtector23
I have try Variance shadow map on the small map (the 5x6 one)

here is the result:
http://www.youtube.c...h?v=yI_ERZQJwBI
it's kinda weird, i'm probably doing something wrong.

and thank you for the cascaded shadow map, i have start reading on it. Just to make sure i understand, i should try to render the small map perfecly with VSM then try to add more block and bigger construction and implemented cascading shadow map?
Hodgman
Hodgman
Because PCF sucks. It eats a lot of samples
N.B. most GPU's since GeForce 3/4 have supported doing the PCF test in the texture-fetch unit, giving you 4-sample PCF results for the cost of 1 sample, so a basic 4-tap implementation doesn't use any more samples than regular 'hard' shadow mapping.
dpadam450
dpadam450
Well correct, But a 4-tap isnt going to produce soft shadows. So you get a tiny little bit nicer looking image, but not good just by itself. So to Panda, you can always get 4 sample PCF for free. If you set your glTexParameter to GL_LINEAR.

With Cascaded shadows you just take multiple snapshots of your shadow. So you take your light matrix and keep closing its field of view smaller. So you get one map to project to a small 3x3 unit area, then another one with a bigger FOV will map to a 20x20 area, and so on till it is maybe 1,000 x 1,000 GL units. And for each pixel, you determine which map you should use because you want the map that has the best resolution.
NBA2K, Madden, Maneater, Killing Floor, Sims 
PandaProtector23
PandaProtector23
Okay i have successfully implemented VSM shadow :


Now i want to use cascading or parallel split to do bigger map, should i implement that first or multitexturing? (ex: put a brick decal on the wall)

thank you
dpadam450
dpadam450
The VSM looks strange. Also use glTexParameter CLAMP_TO_BORDER, and set glTexParameter Border Color to 1. This way you don't get black outside of the shadow map areas.
NBA2K, Madden, Maneater, Killing Floor, Sims 

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.