Shadows not working well

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


Post Reply
xrgo
OGRE Expert User
OGRE Expert User
Posts: 1148
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 169

Shadows not working well

Post 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!
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5586
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1413
Contact:

Re: Shadows not working well

Post 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.
xrgo
OGRE Expert User
OGRE Expert User
Posts: 1148
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 169

Re: Shadows not working well

Post 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
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5586
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1413
Contact:

Re: Shadows not working well

Post by dark_sylinc »

Interesting. May be worth integrating it at some point as an alternative. Adding to my todo list.
xrgo
OGRE Expert User
OGRE Expert User
Posts: 1148
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 169

Re: Shadows not working well

Post 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!
al2950
OGRE Expert User
OGRE Expert User
Posts: 1227
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 157

Re: Shadows not working well

Post 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!!
Lax
Orc Shaman
Posts: 721
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 83
Contact:

Re: Shadows not working well

Post by Lax »

Hi xrgo,

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

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

xrgo
OGRE Expert User
OGRE Expert User
Posts: 1148
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 169

Re: Shadows not working well

Post 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!!
Lax
Orc Shaman
Posts: 721
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 83
Contact:

Re: Shadows not working well

Post by Lax »

ok good to know.

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

Post Reply