[2.1] Shadow glitches with recent commit

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Post Reply
User avatar
AshMcConnell
Silver Sponsor
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

Post by AshMcConnell »

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
User avatar
SolarPortal
OGRE Contributor
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

Post by SolarPortal »

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)
Lead developer of the Skyline Game Engine: https://aurasoft-skyline.co.uk
User avatar
dark_sylinc
OGRE Team Member
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

Post by dark_sylinc »

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?
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)
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.
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?
User avatar
SolarPortal
OGRE Contributor
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

Post by SolarPortal »

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:
Image
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
User avatar
AshMcConnell
Silver Sponsor
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

Post by AshMcConnell »

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
Lax
Hobgoblin
Posts: 583
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 50

Re: [2.1] Shadow glitches with recent commit

Post by Lax »

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

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

User avatar
dark_sylinc
OGRE Team Member
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

Post by dark_sylinc »

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
Please do not go off topic, as this post is about a very specific regression.

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.
xissburg
Halfling
Posts: 83
Joined: Sun Feb 21, 2010 4:58 pm
x 28

Re: [2.1] Shadow glitches with recent commit

Post by xissburg »

I had the same problem after updating. Setting the padding to 1.5 seems to have fixed it for me as well.
123iamking
Gremlin
Posts: 152
Joined: Sat Aug 12, 2017 4:16 pm
x 4

Re: [2.1] Shadow glitches with recent commit

Post by 123iamking »

The shadow glitch can even be reproduced with Ogre 2.1 official sample: Sample_Tutorial_DynamicCubemap

User avatar
dark_sylinc
OGRE Team Member
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

Post by dark_sylinc »

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]
Great find! I can now debug this easily! Turns out ShadowMapDebugging has this problem too if looked from a similar angle.
User avatar
dark_sylinc
OGRE Team Member
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

Post by dark_sylinc »

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)
User avatar
SolarPortal
OGRE Contributor
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

Post by SolarPortal »

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:

Image

Clipped:

Image

Edit: putting padding back to 1.5 fixed the clipping problem again.
Lead developer of the Skyline Game Engine: https://aurasoft-skyline.co.uk
User avatar
AshMcConnell
Silver Sponsor
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

Post by AshMcConnell »

Yeah, I have the same issue as SolarPortal: -

Youtube tags seem broken so here it is
User avatar
dark_sylinc
OGRE Team Member
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

Post by dark_sylinc »

Question, does the problem go away if you add some padding to the Z axis?

Code: Select all

mMaxDistance = vMax.z - vMin.z + 1.0f + padding;
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.
User avatar
dark_sylinc
OGRE Team Member
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

Post by dark_sylinc »

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!
User avatar
AshMcConnell
Silver Sponsor
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

Post by AshMcConnell »

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! :)
Last edited by AshMcConnell on Sun Nov 19, 2017 9:12 pm, edited 2 times in total.
User avatar
SolarPortal
OGRE Contributor
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

Post by SolarPortal »

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 :P

Edit: Also tested and is working great too! :D Thanks again!
Lead developer of the Skyline Game Engine: https://aurasoft-skyline.co.uk
Post Reply