• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Yours3!f

need to reduce shadow mapping aliasing

12 posts in this topic

Hi,

 

I've implemented the "screen space soft shadows" technique (in OGL):

[Gumbau] Jesus Gumbau, Miguel Chover, and Mateu Sbert, “Screen-Space Soft Shadows”, GPU Pro, pp. 477 – 490

 

The shadow looks nice and soft, however making the shadow soft didn't remove the blockiness. I found out that this can be reduced by increasing the shadow map size from  1024 to 2048 ( and so on ), but this kills performance, and memory bandwith. Is there some kind of filtering technique that can reduce this basic blocky property of shadow mapping? So that soft shadows can really look soft. Not blocky soft :)

 

I've attached a picture with soft shadows turned up, and of the simple shadow map.

 

Best regards,

Yours3lf

0

Share this post


Link to post
Share on other sites

Options would include cascaded shadow maps, tiled shadow maps for using different shadow maps for different slices / areas of your scene to maximize resolution, or trapezoidal or perspective shadow maps to change the projection to maximize resolution close to the camera. 

1

Share this post


Link to post
Share on other sites

Depends entirely on what you're doing.

 

Is it a point light or directional? Either way there's multi sampling the shadow map is going to improve it, but is going to take up much the same performance hit as just increasing shadow maps size. There's also temporal anti aliasing. The idea being you slightly shift the projection of the shadow map each frame, keeping the last frames results to combine with the new ones. It's basically multi sampling over time, but has issues with moving objects.

 

If it's just a directional shadow, say from the sun, then things get a bit easier. Cascaded shadow maps use multiple shadow maps projected towards the sun, in a neat kind of shadow LOD trick. http://developer.download.nvidia.com/SDK/10.5/opengl/src/cascaded_shadow_maps/doc/cascaded_shadow_maps.pdf There's also a much more advanced version of this this that I have bookmarked somewhere, and I can't remember the name of. Regardless it advances on cascaded shadow maps to the point where you can get results that are basically alias free.

 

Anyway, hope that helps.

2

Share this post


Link to post
Share on other sites

There are much less extreme options to try before doing what's suggested above. The key is to fit the shadow frustum as close as possible to the view frustum and shadow casters onto that frustum. Get your Z depth as tight as you can, boost the shadow precision if you can, make the shadow area smaller if you can. Try centering the shadow in front of the camera. Explore Z precision tricks like reversed depth planes.

 

That said, I haven't tested screen-space soft shadows yet but this might be an intrinsic part of blurring in what is basically the wrong domain.

 

Depends entirely on what you're doing.

 

Is it a point light or directional? Either way there's multi sampling the shadow map is going to improve it, but is going to take up much the same performance hit as just increasing shadow maps size. There's also temporal anti aliasing. The idea being you slightly shift the projection of the shadow map each frame, keeping the last frames results to combine with the new ones. It's basically multi sampling over time, but has issues with moving objects.

 

If it's just a directional shadow, say from the sun, then things get a bit easier. Cascaded shadow maps use multiple shadow maps projected towards the sun, in a neat kind of shadow LOD trick. http://developer.download.nvidia.com/SDK/10.5/opengl/src/cascaded_shadow_maps/doc/cascaded_shadow_maps.pdf There's also a much more advanced version of this this that I have bookmarked somewhere, and I can't remember the name of. Regardless it advances on cascaded shadow maps to the point where you can get results that are basically alias free.

 

Anyway, hope that helps.

SDSM?

http://visual-computing.intel-research.net/art/publications/sdsm/

 

PS Holy shit this text editor we've got nowadays is a piece of trash

Edited by Promit
2

Share this post


Link to post
Share on other sites

Depends entirely on what you're doing.

 

Is it a point light or directional? Either way there's multi sampling the shadow map is going to improve it, but is going to take up much the same performance hit as just increasing shadow maps size. There's also temporal anti aliasing. The idea being you slightly shift the projection of the shadow map each frame, keeping the last frames results to combine with the new ones. It's basically multi sampling over time, but has issues with moving objects.

 

If it's just a directional shadow, say from the sun, then things get a bit easier. Cascaded shadow maps use multiple shadow maps projected towards the sun, in a neat kind of shadow LOD trick. http://developer.download.nvidia.com/SDK/10.5/opengl/src/cascaded_shadow_maps/doc/cascaded_shadow_maps.pdf There's also a much more advanced version of this this that I have bookmarked somewhere, and I can't remember the name of. Regardless it advances on cascaded shadow maps to the point where you can get results that are basically alias free.

 

Anyway, hope that helps.

 

 

It is a spot light, located at (0, 5, -5), looking 20 degrees downwards. It lights a box of size 2x2 units, located at (0, 0, -8). So this is a really up-close shot.

So multi sampling is not an option.... That's sad. I don't want to go in the temporal direction as, I didn't go with it when doing SMAA and other stuff. I it when the scene remains sharp even in motion. I think it is important to preserve sharp percieving of the players especially in a fast shooting situation.

 

I know about the csm and pssm methods for direction lights, but this is for spot/point lights.

0

Share this post


Link to post
Share on other sites

Options would include cascaded shadow maps, tiled shadow maps for using different shadow maps for different slices / areas of your scene to maximize resolution, or trapezoidal or perspective shadow maps to change the projection to maximize resolution close to the camera. 

 

Thanks for the reply, I'm doing perspective projection for the spot light shadow map. I use 45 degree fov.

0

Share this post


Link to post
Share on other sites

There are much less extreme options to try before doing what's suggested above. The key is to fit the shadow frustum as close as possible to the view frustum and shadow casters onto that frustum. Get your Z depth as tight as you can, boost the shadow precision if you can, make the shadow area smaller if you can. Try centering the shadow in front of the camera. Explore Z precision tricks like reversed depth planes.

 

That said, I haven't tested screen-space soft shadows yet but this might be an intrinsic part of blurring in what is basically the wrong domain.


SDSM?

http://visual-computing.intel-research.net/art/publications/sdsm/

 

PS Holy shit this text editor we've got nowadays is a piece of trash

 

I know about the z-depth trick, and I experimented with it but at this close distance it didn't really improve much.

 

"The key is to fit the shadow frustum as close as possible to the view frustum and shadow casters onto that frustum."

is there a paper / tutorial on this?

 

"That said, I haven't tested screen-space soft shadows yet but this might
be an intrinsic part of blurring in what is basically the wrong domain."

yeah this is really annoying as one might expect such a strong blur to erase such artifacts.

 

agreed it sucks biggrin.png

 

EDIT:

today I experimented with the shadow mapping setup, I added checking sampling outside the shadow frustum.

I also played around with the perspective projection: I changed the range from (1, 50), to (5, 25). This drastically reduced the aliasing at the same shadow map resolution.

So I think it may be really important to get the near far planes right to squeeze out as much precision out of the available texture space as possible.

Edited by Yours3!f
0

Share this post


Link to post
Share on other sites

Try using randomly jittered samples, à la Crysis (http://i246.photobucket.com/albums/gg90/desert-fox-/crysis2009-01-1422-25-23-04.jpg). Your shadows will look ok when you apply textures over the scene since they'll hide the noise fairly well.

 

 

Once you have jittered shadows, you can try to apply your screen space blur to remove the noise - that should result in a nice soft shadow.

 

Another option is to try VSM or ESM for your shadows - these techniques basically store info that can be blurred and filtered (variance in VSM case, pretty sure it something similar for ESM). Then you just blur it and apply (using the VSM/ESM apply functions of course, it's not a simple depth test anymore). That'll give you noise free, soft shadows. smile.png

 

Maybe google for some more examples/ideas from these techniques, I'm sure one will suit your needs. smile.png

Edited by Styves
1

Share this post


Link to post
Share on other sites

Try using randomly jittered samples, à la Crysis (http://i246.photobucket.com/albums/gg90/desert-fox-/crysis2009-01-1422-25-23-04.jpg). Your shadows will look ok when you apply textures over the scene since they'll hide the noise fairly well.

 

 

Once you have jittered shadows, you can try to apply your screen space blur to remove the noise - that should result in a nice soft shadow.

 

Another option is to try VSM or ESM for your shadows - these techniques basically store info that can be blurred and filtered (variance in VSM case, pretty sure it something similar for ESM). Then you just blur it and apply (using the VSM/ESM apply functions of course, it's not a simple depth test anymore). That'll give you noise free, soft shadows. smile.png

 

Maybe google for some more examples/ideas from these techniques, I'm sure one will suit your needs. smile.png

 

I'm already doing blurring :D but I'll look into the random samples, thanks for the advice!

 

I didn't really like vsm (because of light bleeding), and esm because this way the blurring looks way better, plus it produces correct penumbra too.

0

Share this post


Link to post
Share on other sites

Always wanted to see what applying something like SMAA to a shadow map would look like. Tried it once with FXAA and, well it just kinda blurred it, obviously. But I didn't really try anything more than a simple test.

 

In principle AA'ing your scene and a shadow map should have the same objective. Maybe with some work you can get it to com out alright.

 

As for jittered sampling, I absolutely hated how noisy that looked in Crysis. But maybe with burring away the noise it will work? Hope it does.

0

Share this post


Link to post
Share on other sites

Pre-filtering a standard shadow map won't fix visible aliasing, since the step function in the shadow map comparison will always re-introduce aliasing. You really need to filter the results of the comparison, which of course is the basic premise of PCF. VSM on the other hand don't have this step function, since it's specifically formulated to work with pre-filtering.

1

Share this post


Link to post
Share on other sites

I also agree with the option of randomly jittering the shadow map lookups and then blending them together. The method I use is Poisson distribution. This is pseudo-random, and most of the time, you do not really need to use a Poisson distribution function, but a set of points generated from it. I use these points as a constant array in the shader.

For every pixel just do basic shadow mapping, but offset the shadow texel lookup with each of the sample points. For each sample you blend the shadow color additively in the same way you would do with PCF. This gives an illusion of smoother gradients in most angles, without the pixelated look of PCF so they appear smooth unless you get the camera really close to a surface. Between 10 and 20 samples gives good results. I wouldn't sample many more because you'll be doing a texture lookup every time.

0

Share this post


Link to post
Share on other sites

I also agree with the option of randomly jittering the shadow map lookups and then blending them together. The method I use is Poisson distribution. This is pseudo-random, and most of the time, you do not really need to use a Poisson distribution function, but a set of points generated from it. I use these points as a constant array in the shader.

For every pixel just do basic shadow mapping, but offset the shadow texel lookup with each of the sample points. For each sample you blend the shadow color additively in the same way you would do with PCF. This gives an illusion of smoother gradients in most angles, without the pixelated look of PCF so they appear smooth unless you get the camera really close to a surface. Between 10 and 20 samples gives good results. I wouldn't sample many more because you'll be doing a texture lookup every time.

 

well, since I'm doing deferred shadows, it think it would be a constant cost, if I post process the shadow comparison result, and blur later. Or do you mean doing the Poisson on the shadow map itself when doing the comparison to the depth buffer?

But I'll definitely look into this when I have some time.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0