I'm struggling at the moment with getting shadows working on OpenGLES 2
At the moment I'm using a depth buffer based technique, but my scene is so big that the shadows end up big and clumpy.
I'm thinking about stencil shadows, but I'm not sure it will work with a huge scene.
Any ideas people?
I started this project two weeks ago and have two weeks left, so I'm very tight for time and can't afford another failed attempt.
Shadow techniques
Started by Stainless, Yesterday, 08:57 AM
7 replies to this topic
#1
Posted Yesterday, 08:57 AM
#2
Posted Yesterday, 03:01 PM
How big is the scene? What is target platform?
I implemented Z-fail shadow volumes through geometry shader some months ago (and had a thread about it here), and it performed very well for complex scenes on Radeon 6770 (also on GTX 580 - but what doesnt perform well on this category of GPU), and for moderate scenes even on notebook graphics (Mobility Radeon 5470). Though if youre targeting mobile devices, I doubt they will perform that good.
There are also other possibilities of computing shadows. Ray tracing on GPU (it IS realtime, but most probably will need a bit more work than 2 weeks)? Plannar shadows (assuming you dont have too much geometry you cast shadows on)? Shadow blobs + light maps (works well, light maps do awesome work in static scenes)? Light maps + shadow map for N dynamic actors/objects in specific range (you can create shadow map atlas pretty well, smaller objects get smaller shadow map, larger objects get larger shadow map)? etc.
If you describe a bit more details, I might give you few suggestions on how to implement it quickly, because 2 weeks arent that much time.
I implemented Z-fail shadow volumes through geometry shader some months ago (and had a thread about it here), and it performed very well for complex scenes on Radeon 6770 (also on GTX 580 - but what doesnt perform well on this category of GPU), and for moderate scenes even on notebook graphics (Mobility Radeon 5470). Though if youre targeting mobile devices, I doubt they will perform that good.
There are also other possibilities of computing shadows. Ray tracing on GPU (it IS realtime, but most probably will need a bit more work than 2 weeks)? Plannar shadows (assuming you dont have too much geometry you cast shadows on)? Shadow blobs + light maps (works well, light maps do awesome work in static scenes)? Light maps + shadow map for N dynamic actors/objects in specific range (you can create shadow map atlas pretty well, smaller objects get smaller shadow map, larger objects get larger shadow map)? etc.
If you describe a bit more details, I might give you few suggestions on how to implement it quickly, because 2 weeks arent that much time.
My blog about game development (and not just game development) - http://gameprogramme...y.blogspot.com/
If you don't know how to speed up application, go "roarrrrrr!", hit the compiler with the club and use -O3 :D
If you don't know how to speed up application, go "roarrrrrr!", hit the compiler with the club and use -O3 :D
#3
Posted Yesterday, 03:15 PM
Stencil shadows will give you pixel accurate resolution, but it's not without its problems. z-near is faster than z-fail and would be more suitable for mobile devices, but you have to deal with in-shadow problems. Your shadows will also be tact sharp, something shadow maps can alleviate almost for free. I would suggest investigating cascaded shadow maps if you have some spare cycles to support it. An alternate solution would be to limit your shadow casters so that you can focus your shadow map only on the most important area in the scene rather than everything. Not that awesome, but I've played a few games that do that. If however you're not bluring your shadow maps, then switching over to stencil shadows might not be all that bad since both will look the same.
http://www.nutty.ca - Being a nut has its advantages.
#4
Posted Yesterday, 03:37 PM
What about Dual-Paraboloid Shadow Mapping and its improvement, Improved Paraboloid Mapping?
http://hpcg.purdue.e...Vanek11ISVC.pdf
http://hpcg.purdue.e...Vanek11ISVC.pdf
#5
Posted Yesterday, 03:58 PM
#TheNut - first a note, i think you mis-written z-near for z-pass 
Blurring the shadow volumes is another thing. You can perform accurate penumbra shadows by penumbra wedges (this comes at high cost though), or just simple screen-space bilateral blur - both are although suited for PCs rather than mobile devices.
EDIT: Oh... and also an important note! The actual Z-fail algorithm seems still patented by someone. Although you are fine by using two-sided stencil instead of multi-pass version.
Blurring the shadow volumes is another thing. You can perform accurate penumbra shadows by penumbra wedges (this comes at high cost though), or just simple screen-space bilateral blur - both are although suited for PCs rather than mobile devices.
EDIT: Oh... and also an important note! The actual Z-fail algorithm seems still patented by someone. Although you are fine by using two-sided stencil instead of multi-pass version.
My blog about game development (and not just game development) - http://gameprogramme...y.blogspot.com/
If you don't know how to speed up application, go "roarrrrrr!", hit the compiler with the club and use -O3 :D
If you don't know how to speed up application, go "roarrrrrr!", hit the compiler with the club and use -O3 :D
#6
Posted Today, 09:03 AM
I can't give details of what I am doing (NDA's), but think of a car racing game with a track in excess of 3.5 miles long and you've got the basic idea.
I already have the track and cars in with phong shading, sky cube, reflective and refractive glass, simple physics (I do mean simple, 2 weeks isn't long) , simple AI etc.
Shadows are the last major problem to solve.
The target platform is performing well (now I am using VBO's) I'm getting 370fps so far, plenty of spare grunt to do the shadows.
(Interestingly I get 172 fps on my laptop and over 200fps on my galaxy s3.)
I'm waiting for the GA to supply final assets and have no control over what he supplies me ( It's a well known game company that's doing me a favour), so I don't know if they have baked the textures and light map.
I'm now hoping they have, so I just have to create shadows for the visible cars.
I already have the track and cars in with phong shading, sky cube, reflective and refractive glass, simple physics (I do mean simple, 2 weeks isn't long) , simple AI etc.
Shadows are the last major problem to solve.
The target platform is performing well (now I am using VBO's) I'm getting 370fps so far, plenty of spare grunt to do the shadows.
(Interestingly I get 172 fps on my laptop and over 200fps on my galaxy s3.)
I'm waiting for the GA to supply final assets and have no control over what he supplies me ( It's a well known game company that's doing me a favour), so I don't know if they have baked the textures and light map.
I'm now hoping they have, so I just have to create shadows for the visible cars.
#7
Posted Today, 02:06 PM
Quote
#TheNut - first a note, i think you mis-written z-near for z-pass
http://www.nutty.ca - Being a nut has its advantages.
#8
Posted Today, 04:58 PM
For general shadows in outdoor areas, I think cascaded shadow maps are the way to go. It's a proven technique that's been used in quite a lot of games and it allows you to easily tweak the trade-off between quality and performance by adjusting the number and size of cascades.
Additionally, if you resolve all the shadow maps into a single screen-space mask, then apply the mask in the lighting shaders, you can have a lot of freedom about how many shadow maps you use and how you combine them together without adding a lot of expense to your shaders. It's "deferred shadows", sort of (doesn't require deferred shading, although having the depth buffer available to sample as a texture is very helpful). For instance you could decide to have a shadow map per car when the cars are close enough to the camera, and you could blend the shadows from the per-car maps smoothly with the shadows from the overall cascade.
There's some more details about this in Ben Diamand's GDC 2010 talk on shadows in God Of War III. The screen-space mask I referred to is called a "white buffer" in his talk.
Additionally, if you resolve all the shadow maps into a single screen-space mask, then apply the mask in the lighting shaders, you can have a lot of freedom about how many shadow maps you use and how you combine them together without adding a lot of expense to your shaders. It's "deferred shadows", sort of (doesn't require deferred shading, although having the depth buffer available to sample as a texture is very helpful). For instance you could decide to have a shadow map per car when the cars are close enough to the camera, and you could blend the shadows from the per-car maps smoothly with the shadows from the overall cascade.
There's some more details about this in Ben Diamand's GDC 2010 talk on shadows in God Of War III. The screen-space mask I referred to is called a "white buffer" in his talk.
reedbeta.com - developer blog, OpenGL demos, and other projects
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












