Why are their bumps in my shadow mapping?

Started by
14 comments, last by Paul C Skertich 9 years, 7 months ago

And Tada!

[attachment=23401:Snapshot1.jpg]

A couple of things I've changed. When creating the depth stencil view - I also created a depth stencil state with stencil enabled and depth enabled.

My program would constantly crash like a mad man - found out it was the XMVECTOR and XMMATRIX inside a 32 bit Dynamic Library. The engine will be brough into the x64 bit later on. So as far as setting up the view and projection matrixes from the light source - I multiplied them both and stored them into a XMFLOAT4x4 inside the ShadowMap class.

Now this isn't multisampled - I could multisample it then blur it a bit with gaussian blur. I just don't like the dark area way above on the plane floor. Is this another depth buffer issue when it starts to self shadow or is this normal?

The jagged lines got better with perspective set instead of orthographic view. I read perspective is good for spot lights and point lights and Orthrographic is good for Directional Lights.

Another issue I noticed is sometimes the shadow map will detatch from the box when I move it around make it float. The bais is set to 0.001f - would I have to perhaps configure the DepthBias inside the Rasterization State?

Another thing I changed was the shadow map resolution from whatever the scene height and width was to 2048. The program crashes when I try to use 4096x4096.

I believe changing the resolution higher made the shadow map turn out nicer; also changing the near plane and far plane to be 1.0f to 1000.0f.

I read on MSDN that a depth texel sampled too big will cause shadow acne. Also depth texel that sampled to close to the light cameras view port will cause sharp and changed lines. Shadow map resolution will also cause jagged shapes inside the shadow map. I may have got some of this confused what MSDN - I'm trying to remember it all.

Instead of the camera position being (100, -100, 100) I changed it to (-10,50,-50) which helped as well.

On the DepthStencilView I thought the higher the depth stencil resolution DXGI_FORMAT_D32_FLOAT would be better but I couldn't notice any differience. So I changed it back to DXGI_FORMAT_D24_UNORM_S8_UINT;

Game Engine's WIP Videos - http://www.youtube.com/sicgames88
SIC Games @ GitHub - https://github.com/SICGames?tab=repositories
Simple D2D1 Font Wrapper for D3D11 - https://github.com/SICGames/D2DFontX
Advertisement

Also if you look closely I noticed the shadow map is projected onto the cube - that can't be normal, right?

Game Engine's WIP Videos - http://www.youtube.com/sicgames88
SIC Games @ GitHub - https://github.com/SICGames?tab=repositories
Simple D2D1 Font Wrapper for D3D11 - https://github.com/SICGames/D2DFontX

The comment above asking about the self projection of the shadow map on the cube - was because of depth bias in the shadowmap.

So I changed a few things - I made the sampler state to be BiLinear with multisample and this is how it looks:

[attachment=23402:Snapshot1.jpg]

Now, I'll get around to blurring it to a nice soft blur.

Game Engine's WIP Videos - http://www.youtube.com/sicgames88
SIC Games @ GitHub - https://github.com/SICGames?tab=repositories
Simple D2D1 Font Wrapper for D3D11 - https://github.com/SICGames/D2DFontX

I would suspect the dark area behind the cube is beyond the edge of your shadow map. I had an issue like that, I simply did a range test for the edge and didn't render the shadow beyond that. Later on I will go back and see if it's possible to adjust texture clipping to nullify the need for the range test. Just an idea of what it may be...

******************************************************************************************
Youtube Channel

Nicely done. As your scene gets larger and more complicated, you will find back-face issues, and the "peter-panning" (shadow separation from base of caster).

I moved from PCF filtering to Variance shadow maps; they were faster and solved many of the problems.

I then tried Exponential shadow maps, and perform a gaussian blur. This is what I settled on.

I don't plan on sticking to one technique when it comes to shadow mapping. I'm going to try and understand various of ways. I like shadow volumes but which will come later. I want to try sparse voxel global illumination as well as well as the shadow voxelization used in CryEngine 3. What's sad about the shadow mapping - I've gone from 60 frames per second and when I place three objects in a screne it drops down to 30 frames per second. Hopefully, when I rework the rendering system and the deferred rendering system - the frame drops won't be so drastic.

I've been doing research about shadows in deferred shading - what I can tell it's not lighting per pixel par say - it's more light volumes than what forward pass rendering does. For point lights one can draw a sphere or a billboard of a circle and blend them together. Which again - the rendering system needs to be reworked a lot for performance and quality.

I'm pretty sure there'll be some issues if I stick with this type of shadow mapping. I'm going to look up some of your suggestion HScott like Exponential shadow map. What caught my eye is sub-pixel shadow mapping. I really like that.

Game Engine's WIP Videos - http://www.youtube.com/sicgames88
SIC Games @ GitHub - https://github.com/SICGames?tab=repositories
Simple D2D1 Font Wrapper for D3D11 - https://github.com/SICGames/D2DFontX

This topic is closed to new replies.

Advertisement