Page 1 of 1

Shadows not working well

Posted: Fri Feb 13, 2015 4:30 pm
by xrgo
Hello here is another question =)

I am trying to setting up shadows, like this:

Code: Select all

compositor_node_shadow ShadowNode
{
	technique pssm

	num_splits		3
	pssm_lambda		0.5
	shadow_map 0 2048 2048 PF_FLOAT16_R light 0 split 0
	shadow_map 1 1024 1024 PF_FLOAT16_R light 0 split 1
	shadow_map 2 1024 1024 PF_FLOAT16_R light 0 split 2

	shadow_map 0 1 2
	{
		pass clear
		{
			colour_value 1 1 1 1
		}
		pass render_scene
		{
		}
	}
}
I have just 1 directional light

and I see nothing =(

But! when I do sceneManager->setShadowFarDistance(10); I am starting to see something when the camera is near the floor:
Image

It seems that the shadow render pass sees the mesh with worng normals so it culls most of the faces?
and the fact that I can only see shadows when setShadowFarDistance is very low and the camera is very close.. is because I am getting only one split?

How to solve this?

And a final question: Is there a way to make pssm shadows "Stable" so it wonk flick as a move the camera, like in the CSM implementation?

Thanks!

Re: Shadows not working well

Posted: Fri Feb 13, 2015 7:19 pm
by dark_sylinc
  1. Download the latest code. Late yesterday bug fixes for PSSM shadows were pushed.
  2. With the new fixes, a pssm_lambda of 0.95 gives much better results than 0.5
  3. Check the source code, it calls:

    Code: Select all

    //Set sane defaults for proper shadow mapping
    mSceneManager->setShadowDirectionalLightExtrusionDistance( 500.0f );
    mSceneManager->setShadowFarDistance( 500.0f );
  4. Try toggling HlmsManager::setShadowMappingUseBackFaces
  5. The default shadow bias is 0.01f Perhaps this is too much/little for you? Adjust it via HlmsDatablock::mShadowConstantBias.
  6. Use PF_FLOAT32_R until you get it to look correct. Then you can start worrying about lowering precision to get better performance.
And a final question: Is there a way to make pssm shadows "Stable" so it wonk flick as a move the camera, like in the CSM implementation?
Umm... what CSM implementation?

Edit: If the problem persists, also checkout the new Sample_ShadowMapDebugging; and include screen from multiple angles.

Re: Shadows not working well

Posted: Fri Feb 13, 2015 7:37 pm
by xrgo
Thank you very much! I going to test all those points now...

meanwhile, this is the CSM implementation that I was referencing:
http://www.ogre3d.org/forums/viewtopic.php?f=11&t=71142

it is stable and it was amazing =), With stable I mean like this:
https://www.youtube.com/watch?v=oy4T67h_618

shadow pixels wont flick as you move the camera even in low res

Thanks again

Re: Shadows not working well

Posted: Fri Feb 13, 2015 7:48 pm
by dark_sylinc
Interesting. May be worth integrating it at some point as an alternative. Adding to my todo list.

Re: Shadows not working well

Posted: Fri Feb 13, 2015 8:08 pm
by xrgo
dark_sylinc wrote:Interesting. May be worth integrating it at some point as an alternative. Adding to my todo list.
That's awesome!!

btw, everything iis working fine now, with the new version + adjusting the bias =), thank you!

Re: Shadows not working well

Posted: Fri Feb 13, 2015 10:03 pm
by al2950
I had completely forgotten about that post, I was going to add it to Ogre and RTSS, but I guess I must of got distracted!!

Re: Shadows not working well

Posted: Wed Jun 17, 2015 8:06 pm
by Lax
Hi xrgo,

how did you get CSM working with Ogre terrain?
Do you have some source code?

Regards
Lax

Re: Shadows not working well

Posted: Wed Jun 17, 2015 9:03 pm
by xrgo
Hello! Sorry :( , I am not using Ogre terrain, and I am not longer really interested in that CSM implementation for Ogre 2.1, since I am really happy with the current PSSM implementation + 4x4PCF =), so I have no code. But I am waiting for this https://twitter.com/matiasgoldberg/stat ... 8154705920 =D!!

Re: Shadows not working well

Posted: Thu Jun 18, 2015 8:29 pm
by Lax
ok good to know.