[2.1] Shadow glitches with recent commit
- AshMcConnell
- Silver Sponsor
- Posts: 605
- Joined: Fri Dec 14, 2007 11:44 am
- Location: Northern Ireland
- x 16
- Contact:
[2.1] Shadow glitches with recent commit
Hi Folks,
I had an issue with a recent commit which decreases the padding for the FocusedShadowCameraSetup.
I seem to need the padding, as if I don't I get these shadow glitches: -
When I revert the change to padding it works for me: -
Should the padded be reintroduced or could I have a conflicting setup?
Thanks!
Ash
I had an issue with a recent commit which decreases the padding for the FocusedShadowCameraSetup.
I seem to need the padding, as if I don't I get these shadow glitches: -
When I revert the change to padding it works for me: -
Should the padded be reintroduced or could I have a conflicting setup?
Thanks!
Ash
- SolarPortal
- OGRE Contributor
- Posts: 203
- Joined: Sat Jul 16, 2011 8:29 pm
- Location: UK
- x 51
- Contact:
Re: [2.1] Shadow glitches with recent commit
I too had the same problems, adding the padding back in for me fixed it too. im running it at around 1.5
The error i still get is a shadow square after the end of the shadow distance when using a focused shadow only and no PSSM.. (like a low quality mode)
The error i still get is a shadow square after the end of the shadow distance when using a focused shadow only and no PSSM.. (like a low quality mode)
Lead developer of the Skyline Game Engine: https://aurasoft-skyline.co.uk
- dark_sylinc
- OGRE Team Member
- Posts: 5296
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1278
- Contact:
Re: [2.1] Shadow glitches with recent commit
Interesting... I was hoping the padding was no longer needed. The more padding, the lower the quality unnecessarily (assuming the padding was not needed).
I guess a in-between value like 1.5 could work as SolarPortal suggest. Ash, could you check if 1.5 works for you?
However as it was fixed, bugs from tightly calculating the depth of the scene appeared.
Is this a directional, spot or point shadow map?
That bug supposedly got fixed in this commit.
The problem was that the depth was too small. And even though this fits perfectly well for casters, receivers may end up with depth > 1. So when we ask the PCF hardware to perform the depth comparison (depth buffers have a maximum value of 1) it sees depth_in_receiver > depth_in_shadow_map (e.g. 5 > 1.0) and thus we think the area is shadowed, when it's not.
Bugfix was to make the depth range at least as large as to what our frustum can see.
I'll repeat the question because this is very important: you're seeing the bug with a directional, spot or point shadow map? Could you post a screenshot?
I guess a in-between value like 1.5 could work as SolarPortal suggest. Ash, could you check if 1.5 works for you?
I think I know what you're talking about. It loos like this? These problems started in a commit that fixed a precision bug where we vastly overestimate the depth of the scene for shadow casters.SolarPortal wrote: ↑Tue Nov 14, 2017 10:26 pmThe error i still get is a shadow square after the end of the shadow distance when using a focused shadow only and no PSSM.. (like a low quality mode)
However as it was fixed, bugs from tightly calculating the depth of the scene appeared.
Is this a directional, spot or point shadow map?
That bug supposedly got fixed in this commit.
The problem was that the depth was too small. And even though this fits perfectly well for casters, receivers may end up with depth > 1. So when we ask the PCF hardware to perform the depth comparison (depth buffers have a maximum value of 1) it sees depth_in_receiver > depth_in_shadow_map (e.g. 5 > 1.0) and thus we think the area is shadowed, when it's not.
Bugfix was to make the depth range at least as large as to what our frustum can see.
I'll repeat the question because this is very important: you're seeing the bug with a directional, spot or point shadow map? Could you post a screenshot?
- SolarPortal
- OGRE Contributor
- Posts: 203
- Joined: Sat Jul 16, 2011 8:29 pm
- Location: UK
- x 51
- Contact:
Re: [2.1] Shadow glitches with recent commit
Identical to that image and its through the use of a directional light with no PSSM at all.
Note: I have not had this with using a point or spot light.
It appeared after updating to the latest branch last week.
Will post an image as soon as i have a compile of my app
Edit: Shadow distance of 50:
can go from that shape to a square based on angle your looking, e.g. looking straight down its a square. side on its a triangle.
Note: I have not had this with using a point or spot light.
It appeared after updating to the latest branch last week.
Will post an image as soon as i have a compile of my app
Edit: Shadow distance of 50:
can go from that shape to a square based on angle your looking, e.g. looking straight down its a square. side on its a triangle.
Lead developer of the Skyline Game Engine: https://aurasoft-skyline.co.uk
- AshMcConnell
- Silver Sponsor
- Posts: 605
- Joined: Fri Dec 14, 2007 11:44 am
- Location: Northern Ireland
- x 16
- Contact:
Re: [2.1] Shadow glitches with recent commit
Hi Folks,
Yep, I recompiled with a 1.5 buffer and it works fine. I am also using a directional light (i.e. sun)
Thanks!
Ash
Yep, I recompiled with a 1.5 buffer and it works fine. I am also using a directional light (i.e. sun)
Thanks!
Ash
-
- Hobgoblin
- Posts: 583
- Joined: Mon Aug 06, 2007 12:53 pm
- Location: Saarland, Germany
- x 50
Re: [2.1] Shadow glitches with recent commit
Hi,
what I'm encountering is the following:
- My camera's near clip distance is set to 0.01, because I'm using the units 1 = 1 meter because of physics.
- So the shadows will change immediately to a worse detail when I move the camera just a few units away from from an object that casts shadows.
- I tried several parameters like:
shadowFarDistance
shadowDirectionalLightExtrusionDistance
shadowDirLightTextureOffset
But nothing seems to affect the shadows quality. Is there a parameter to change, at which distance the shadows details will be changed?
Regards
Lax
what I'm encountering is the following:
- My camera's near clip distance is set to 0.01, because I'm using the units 1 = 1 meter because of physics.
- So the shadows will change immediately to a worse detail when I move the camera just a few units away from from an object that casts shadows.
- I tried several parameters like:
shadowFarDistance
shadowDirectionalLightExtrusionDistance
shadowDirLightTextureOffset
But nothing seems to affect the shadows quality. Is there a parameter to change, at which distance the shadows details will be changed?
Regards
Lax
http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62
- dark_sylinc
- OGRE Team Member
- Posts: 5296
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1278
- Contact:
Re: [2.1] Shadow glitches with recent commit
Please do not go off topic, as this post is about a very specific regression.Lax wrote: ↑Wed Nov 15, 2017 10:42 pm Hi,
what I'm encountering is the following:
- My camera's near clip distance is set to 0.01, because I'm using the units 1 = 1 meter because of physics.
- So the shadows will change immediately to a worse detail when I move the camera just a few units away from from an object that casts shadows.
- I tried several parameters like:
shadowFarDistance
shadowDirectionalLightExtrusionDistance
shadowDirLightTextureOffset
But nothing seems to affect the shadows quality. Is there a parameter to change, at which distance the shadows details will be changed?
Regards
Lax
What you're talking about sounds like PSSM switching splits (you can see if the quality jump matches the PSSM splits via enabling HlmsPbs::setDebugPssmSplits) If PSSM is the reason, you can increase the resolution of the upper splits, or play with pssm_lambda parameter.
-
- Halfling
- Posts: 83
- Joined: Sun Feb 21, 2010 4:58 pm
- x 28
Re: [2.1] Shadow glitches with recent commit
I had the same problem after updating. Setting the padding to 1.5 seems to have fixed it for me as well.
-
- Gremlin
- Posts: 152
- Joined: Sat Aug 12, 2017 4:16 pm
- x 4
Re: [2.1] Shadow glitches with recent commit
The shadow glitch can even be reproduced with Ogre 2.1 official sample: Sample_Tutorial_DynamicCubemap
- dark_sylinc
- OGRE Team Member
- Posts: 5296
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1278
- Contact:
Re: [2.1] Shadow glitches with recent commit
Great find! I can now debug this easily! Turns out ShadowMapDebugging has this problem too if looked from a similar angle.123iamking wrote: ↑Fri Nov 17, 2017 4:56 am The shadow glitch can even be reproduced with Ogre 2.1 official sample: Sample_Tutorial_DynamicCubemap
https://vimeo.com/243239394
[vimeo]243239394[/vimeo]
- dark_sylinc
- OGRE Team Member
- Posts: 5296
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1278
- Contact:
Re: [2.1] Shadow glitches with recent commit
OK!!!
I think I fixed this problem for good this time.
Could you guys confirm? (remember to update the shader template files, specifically Hlms/Pbs/Any/ShadowMapping_piece_ps.any got changed, aside from C++ code)
I think I fixed this problem for good this time.
Could you guys confirm? (remember to update the shader template files, specifically Hlms/Pbs/Any/ShadowMapping_piece_ps.any got changed, aside from C++ code)
- SolarPortal
- OGRE Contributor
- Posts: 203
- Joined: Sat Jul 16, 2011 8:29 pm
- Location: UK
- x 51
- Contact:
Re: [2.1] Shadow glitches with recent commit
I can confirm that the distance shadow is gone, no more black square appearing after the length of the distance on a directional light with or without PSSM
However, i am still having problems with the padding. This time instead of getting a shadow appear, i am finding it is clipping the shadow away when looking from a particular angle.
I will post screenshots asap, but i am currently trying with an increased padding again to see if the problem goes away and i am also using that commit c++ code and the HLMS shader edits to the shadow piece.
How it should look:
Clipped:
Edit: putting padding back to 1.5 fixed the clipping problem again.
However, i am still having problems with the padding. This time instead of getting a shadow appear, i am finding it is clipping the shadow away when looking from a particular angle.
I will post screenshots asap, but i am currently trying with an increased padding again to see if the problem goes away and i am also using that commit c++ code and the HLMS shader edits to the shadow piece.
How it should look:
Clipped:
Edit: putting padding back to 1.5 fixed the clipping problem again.
Lead developer of the Skyline Game Engine: https://aurasoft-skyline.co.uk
- AshMcConnell
- Silver Sponsor
- Posts: 605
- Joined: Fri Dec 14, 2007 11:44 am
- Location: Northern Ireland
- x 16
- Contact:
- dark_sylinc
- OGRE Team Member
- Posts: 5296
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1278
- Contact:
Re: [2.1] Shadow glitches with recent commit
Question, does the problem go away if you add some padding to the Z axis?
Let me know how much padding you need until the bug disappears. Given recent changes, if padding is in range [0; 100] the quality differences would be negligible (much more negligible than adding padding in the XY directions)
Edit: Nevermind, I could repro it too.
Code: Select all
mMaxDistance = vMax.z - vMin.z + 1.0f + padding;
Edit: Nevermind, I could repro it too.
- dark_sylinc
- OGRE Team Member
- Posts: 5296
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1278
- Contact:
Re: [2.1] Shadow glitches with recent commit
Fixed.
WOW!!! Talk about tight! If you see the commit change, this happened because we were missing "1.0" in padding, because we just step the camera backwards by 2.0 units.
The bug disappeared if either increased the padding by 1.0 or decreased how much we walked backwards by 1.0. More impressive is that increasing the padding by 0.9 decreased the artifacts but it wasn't 100% perfect (some areas still remained incorrectly unshadowed).
This means Focused shadow camera setup is as tightest as ever (maximum possible quality in regards depth range and XY size of the shadow map camera, considering the information we have available. Increasing the quality further could only be achieved by either playing projection tricks like LiPSM did, or with additional information, such as analyzing a frame from GPU).
Thanks for the feedback!
WOW!!! Talk about tight! If you see the commit change, this happened because we were missing "1.0" in padding, because we just step the camera backwards by 2.0 units.
The bug disappeared if either increased the padding by 1.0 or decreased how much we walked backwards by 1.0. More impressive is that increasing the padding by 0.9 decreased the artifacts but it wasn't 100% perfect (some areas still remained incorrectly unshadowed).
This means Focused shadow camera setup is as tightest as ever (maximum possible quality in regards depth range and XY size of the shadow map camera, considering the information we have available. Increasing the quality further could only be achieved by either playing projection tricks like LiPSM did, or with additional information, such as analyzing a frame from GPU).
Thanks for the feedback!
- AshMcConnell
- Silver Sponsor
- Posts: 605
- Joined: Fri Dec 14, 2007 11:44 am
- Location: Northern Ireland
- x 16
- Contact:
Re: [2.1] Shadow glitches with recent commit
Thanks for your hard work Matias, much appreciated! I just wish I had the knowledge to pin issues down a bit more
I'll try and test it tomorrow
*edit* Tested works great, thanks!
I'll try and test it tomorrow
*edit* Tested works great, thanks!
Last edited by AshMcConnell on Sun Nov 19, 2017 9:12 pm, edited 2 times in total.
- SolarPortal
- OGRE Contributor
- Posts: 203
- Joined: Sat Jul 16, 2011 8:29 pm
- Location: UK
- x 51
- Contact:
Re: [2.1] Shadow glitches with recent commit
Thanks for the hard work! I am compiling now and will let you know how it turns out.
Getting the best quality ever is what we need
Edit: Also tested and is working great too! Thanks again!
Getting the best quality ever is what we need
Edit: Also tested and is working great too! Thanks again!
Lead developer of the Skyline Game Engine: https://aurasoft-skyline.co.uk