Hi,
just started to use shadows. What can i do against this bad looking,flickering shadows?
I'm currently using just one directional light.
I'm using this function to set the shadows: http://www.ogre3d.org/forums/viewtopic. ... 34#p522394
I'm using the following settings:
numShadowCastingLights = 1
resolution = 2048
usePssm = true
numPssmSplits = 3,
shadowFilter = Ogre::HlmsPbs::PCF_3x3
If i don't use the function, the shadows on the model are looking good, but the model doesn't 'cast' shadows on the floor -_-
[2.1] flickering bad shadows on model
-
- Goblin
- Posts: 224
- Joined: Wed Jul 31, 2013 1:58 pm
- Location: germany
- x 8
[2.1] flickering bad shadows on model
You do not have the required permissions to view the files attached to this post.
-
- OGRE Contributor
- Posts: 203
- Joined: Sat Jul 16, 2011 8:29 pm
- Location: UK
- x 51
Re: [2.1] flickering bad shadows on model
How far does your directional shadow cast? 250 is a nice number with good quality.
This can also happen when the light is just grazing off the model. Try rotating the light to see if the same quality is all the way around.
Hope this helps
This can also happen when the light is just grazing off the model. Try rotating the light to see if the same quality is all the way around.
Hope this helps

Lead developer of the Skyline Game Engine: https://aurasoft-skyline.co.uk
-
- OGRE Expert User
- Posts: 1148
- Joined: Sat Jul 06, 2013 10:59 pm
- Location: Chile
- x 169
Re: [2.1] flickering bad shadows on model
The second picture you posted has no shadows at all, those "shadows" you see are just dark faces of the mesh because light can't reach (aka NdotL=0) and you have no ambient light so it looks very dark.
So lets talk about the first picture, with the ugly shadows. the main problem I see is peter panning, you'll need to adjust mShadowConstantBias just so you don't get shadow acne, and that's very hard. Increasing shadow resolution helps a lot. There are a few techniques to help with that (reduce peter panning without introducing acne), like slope scale bias but I tried to implement them once and I couldn't (too noob).
And about the flickering, something I've always wanted is Stable Shadows http://www.garagegames.com/community/blogs/view/21284 but I tried to implement them once and I couldn't (again... too noob). This would solve 99% of that issue
sorry for not being too helpful
So lets talk about the first picture, with the ugly shadows. the main problem I see is peter panning, you'll need to adjust mShadowConstantBias just so you don't get shadow acne, and that's very hard. Increasing shadow resolution helps a lot. There are a few techniques to help with that (reduce peter panning without introducing acne), like slope scale bias but I tried to implement them once and I couldn't (too noob).
And about the flickering, something I've always wanted is Stable Shadows http://www.garagegames.com/community/blogs/view/21284 but I tried to implement them once and I couldn't (again... too noob). This would solve 99% of that issue
sorry for not being too helpful

-
- Goblin
- Posts: 224
- Joined: Wed Jul 31, 2013 1:58 pm
- Location: germany
- x 8
Re: [2.1] flickering bad shadows on model
Do you mean this?:SolarPortal wrote:How far does your directional shadow cast? 250 is a nice number with good quality.
This can also happen when the light is just grazing off the model. Try rotating the light to see if the same quality is all the way around.
Hope this helps
Code: Select all
//Set sane defaults for proper shadow mapping
mOgreSceneMgrPtr->setShadowDirectionalLightExtrusionDistance(500.0f);
mOgreSceneMgrPtr->setShadowFarDistance(500.0f);
Did you get the shadows work properly, without any problems? (screens? Did you customize something?)
Well, now as you say it.xrgo wrote:The second picture you posted has no shadows at all, those "shadows" you see are just dark faces of the mesh because light can't reach (aka NdotL=0) and you have no ambient light so it looks very dark.

You shocked me! I don't want to implement that, nor i'm able to do thatxrgo wrote: So lets talk about the first picture, with the ugly shadows. the main problem I see is peter panning, you'll need to adjust mShadowConstantBias just so you don't get shadow acne, and that's very hard. Increasing shadow resolution helps a lot. There are a few techniques to help with that (reduce peter panning without introducing acne), like slope scale bias but I tried to implement them once and I couldn't (too noob).
And about the flickering, something I've always wanted is Stable Shadows http://www.garagegames.com/community/blogs/view/21284 but I tried to implement them once and I couldn't (again... too noob). This would solve 99% of that issue
sorry for not being too helpful

So my only option to fix that, is playing around with:
4. The default shadow bias for every material is 0.01f. Perhaps this is too much/little for you? Adjust it via HlmsDatablock::mShadowConstantBias.
Will try it (How stupid from me. Expecting that shadows would work out of the box -_- ).
-
- Goblin
- Posts: 224
- Joined: Wed Jul 31, 2013 1:58 pm
- Location: germany
- x 8
Re: [2.1] flickering bad shadows on model
Well, values from 0 to 1 for mShadowConstantBias doesn't help.
-
- OGRE Expert User
- Posts: 1148
- Joined: Sat Jul 06, 2013 10:59 pm
- Location: Chile
- x 169
Re: [2.1] flickering bad shadows on model
but you do see a difference? more/less acne less/more peterpanning (if not you must be doing something wrong), its very hard to find the perfect value and sometimes its impossible, in my case I just live with a little of both, and 4k shadowmaps and 4x4 pcf, looks good enough =).Thyrion wrote:Well, values from 0 to 1 for mShadowConstantBias doesn't help.
You can play with the lambda too so near shadowmaps looks higher res.
they mostly do, its just impossible to have default values to fit every scene configuration.Thyrion wrote:Expecting that shadows would work out of the box -_- )
-
- Goblin
- Posts: 224
- Joined: Wed Jul 31, 2013 1:58 pm
- Location: germany
- x 8
Re: [2.1] flickering bad shadows on model
Yes i tried resolution 4096 and PCF_4x4. The flickering is gone and the shadows are looking good, except those white spaces!xrgo wrote:its very hard to find the perfect value and sometimes its impossible, in my case I just live with a little of both, and 4k shadowmaps and 4x4 pcf, looks good enough =).
You can play with the lambda too so near shadowmaps looks higher res.
I already noticed them in the 2.1 Samples and in the upcomming wild west shooter.
in UE4 it "just" works. -_-xrgo wrote:they mostly do, its just impossible to have default values to fit every scene configuration.
You do not have the required permissions to view the files attached to this post.
-
- OGRE Expert User
- Posts: 1148
- Joined: Sat Jul 06, 2013 10:59 pm
- Location: Chile
- x 169
Re: [2.1] flickering bad shadows on model
good! I hope you didn't get too much performance lossThyrion wrote:The flickering is gone and the shadows are looking good

Also you could try root->getHlmsManager()->setShadowMappingUseBackFaces(false); but you'll need to play with the bias again.
maybe the defaults just happened to fit the scene you tried =), I have seen myself this problems in UE4, it might be less common because maybe they implemented those features I mentioned, but its definitely there, its a well known problem with shadow mappingThyrion wrote:in UE4 it "just" works. -_-

https://forums.unrealengine.com/showthr ... b8d4d9007c
-
- Goblin
- Posts: 211
- Joined: Wed May 08, 2013 2:58 pm
- x 10
Re: [2.1] flickering bad shadows on model
Yeah, shadows is a pain in the a** to get it working right.
I can't get the bias low enough, bugs starts to appear if u use anything below 0.5.
And the current implementation have a lot of precision problems.
In Sunset Ranges(the wild west shooter), we have multiple shadow presets like this:
More than 3 shadow cascades is a HUGE performance bottle neck for us.
The very high preset have two 4k maps. Is very resource hungry, the high preset is good enough. Bias still present in any preset.
Those settings will vary from project to project.
Regarding Unreal, they have mages and wizards working on that shi*. Its just unreal.
I can't get the bias low enough, bugs starts to appear if u use anything below 0.5.
And the current implementation have a lot of precision problems.
In Sunset Ranges(the wild west shooter), we have multiple shadow presets like this:
Code: Select all
ompositor_node_shadow LowShadowNode {
technique pssm
num_splits 3
pssm_lambda 0.85
shadow_map 0 512 512 PF_D32_FLOAT light 0 split 0
shadow_map 1 1024 1024 PF_D32_FLOAT light 0 split 1
shadow_map 2 2048 2048 PF_D32_FLOAT light 0 split 2
shadow_map 0 1 2 {
pass clear {
colour_value 1 1 1 1
}
pass render_scene {}
}
}
compositor_node_shadow MediumShadowNode {
technique pssm
num_splits 3
pssm_lambda 0.85
shadow_map 0 1024 1024 PF_D32_FLOAT light 0 split 0
shadow_map 1 2048 2048 PF_D32_FLOAT light 0 split 1
shadow_map 2 2048 2048 PF_D32_FLOAT light 0 split 2
shadow_map 0 1 2 {
pass clear {
colour_value 1 1 1 1
}
pass render_scene {}
}
}
compositor_node_shadow HighShadowNode {
technique pssm
num_splits 3
pssm_lambda 0.85
shadow_map 0 2048 2048 PF_D32_FLOAT light 0 split 0
shadow_map 1 2048 2048 PF_D32_FLOAT light 0 split 1
shadow_map 2 4096 4096 PF_D32_FLOAT light 0 split 2
shadow_map 0 1 2 {
pass clear {
colour_value 1 1 1 1
}
pass render_scene {}
}
}
compositor_node_shadow VeryHighShadowNode {
technique pssm
num_splits 3
pssm_lambda 0.85
shadow_map 0 2048 2048 PF_D32_FLOAT light 0 split 0
shadow_map 1 4096 4096 PF_D32_FLOAT light 0 split 1
shadow_map 2 4096 4096 PF_D32_FLOAT light 0 split 2
shadow_map 0 1 2 {
pass clear {
colour_value 1 1 1 1
}
pass render_scene {}
}
}
More than 3 shadow cascades is a HUGE performance bottle neck for us.
The very high preset have two 4k maps. Is very resource hungry, the high preset is good enough. Bias still present in any preset.
Those settings will vary from project to project.
Regarding Unreal, they have mages and wizards working on that shi*. Its just unreal.
-
- OGRE Contributor
- Posts: 203
- Joined: Sat Jul 16, 2011 8:29 pm
- Location: UK
- x 51
Re: [2.1] flickering bad shadows on model
Sorry, i was not meaning this. But rotating the light or model to get the head in full shadow to see the quality is what i meant. It was to see if the same lines existed while fully shadowed.Should the rotation change the quality of the shadows? tried it but it's the same in every direction.
We use a similar technique to GlowingPotato and have multiple shadow qualities which could be controlled from the end game.
Lead developer of the Skyline Game Engine: https://aurasoft-skyline.co.uk