Horde3D
http://horde3d.org/forums/

Improving shadows for daylight scenes
http://horde3d.org/forums/viewtopic.php?f=1&t=1646
Page 1 of 1

Author:  zoombapup [ 27.02.2012, 12:25 ]
Post subject:  Improving shadows for daylight scenes

Ok, wanted to fix some issues with my scene, you can check out work in progress here: http://youtu.be/lvJF7QTq-sY?hd=1

Basically, if you look at the ground when I'm moving stuff around, you'll see that shadows in general have a problem when close to the object I'm standing on when I took the vid.

The light that is being used here is about 500 units up from the platform, with a range of around 1700 units (1 unit = 1 meter).

So I'm really trying to figure out how to get the best results for a skylight, which presumably wasn't the intention of the spotlight used in Horde. So I could use some feedback on what would be useful to change code wise.

If you read the paper on CSM from the nvidia site here: http://developer.download.nvidia.com/SD ... w_maps.pdf

So what I'm wondering is that the CSM implementation in horde, as far as I can make out, uses 1 texture to render the shadow map. It also seems to use a perspective projection from the shadowing light, rather than the ortho projection I'd expect. Finally, I seem to be getting depth resolution issues (shadows don't seem to project onto near objects, only when the distance between them increases).

So, really just wondering what actually to change here to fix up a decent directional "skylight" light and shadow projection for a typical daylight scene. Any advice would be welcome!

Author:  marciano [ 27.02.2012, 23:47 ]
Post subject:  Re: Improving shadows for daylight scenes

zoombapup wrote:
So what I'm wondering is that the CSM implementation in horde, as far as I can make out, uses 1 texture to render the shadow map. It also seems to use a perspective projection from the shadowing light, rather than the ortho projection I'd expect.

The CSM implementation uses one shadow map but splits it into an atlas with four quadrants that will be used for the cascades. Regarding the parallel shadow projection, this thread might help you: http://horde3d.org/forums/viewtopic.php?f=2&t=368

The precision issues you describe could be related to the shadow map bias which is tweakable per light source. Also make sure that the shadow casting scene is as tight as possible and that there is no skybox or other large objects outside your main scene that have shadows enabled, otherwise you can lose a lot of resolution as the implementation will try to fit the merged shadow caster AABBs into the shadow map.

Author:  zoombapup [ 28.02.2012, 13:52 ]
Post subject:  Re: Improving shadows for daylight scenes

Hmm, ok, I'll have a look at the bias function and see how that effects the scene. Ideally the shadow maps should be bounded by the box created from the splits though shouldn't they. So it really shouldn't be affected by geometry at all (more the frustrums created by the splits). Although one thing that occurred to me when reading the nvidia CSM paper was that casters might be behind the camera and actually hit the frustum splits, so need some way of determining a reasonable distance for the skylight. I guess it might be ok to just assume a given distance (some param on the renderer) and project an ortho projection from the center of each frustum from the skylight direction onto the frustum.

So really, this should (theoretically) just be a pretty simple tweak of updateShadowMap to encompass the split frusta? into an ortho projection.. hmm, will try it later this week I think.

Thanks for the info on the shadow bias, will have a look at that now.

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/