Typical values for Texture Shadows

Problems building or running the engine, queries about how to use features etc.
Post Reply
Owl53
Halfling
Posts: 83
Joined: Sat Jul 22, 2017 2:32 pm
x 4

Typical values for Texture Shadows

Post by Owl53 » Thu Apr 18, 2019 9:34 pm

Ogre Version: 1.11
Operating System: Windows 10
Render System: OpenGL

I was wondering what typical values for texture shadows are to achieve a fairly smooth effect? Using the example ogre media sphere, the shadow cast is fairly jagged as you can see. If I increase the value in shadowTextureSettings considerably - i.e. to 4096 - the shadows obviously get considerably smoother as they're a higher quality. Is that the only way to improve the smoothness of the shadows? As I'd imagine having the value set that high would be expensive as the number of objects in the scenes increase? Is the standard generally used 1024? If so, how do people achieve smoother shadows than those shown in the example below? Or is the general practice just to set them as high as the PC specs will allow without too big a performance hit? The scenemanager setup for shadows is also shown. For lower polygon models the jagged effect is understandably worse than this sphere.

Image

Code: Select all

sceneManager = m_root->createSceneManager("DefaultSceneManager", "Scene");
sceneManager->setAmbientLight(Ogre::ColourValue(1, 1, 1));
sceneManager->setShadowTechnique(Ogre::ShadowTechnique::SHADOWTYPE_TEXTURE_MODULATIVE);
sceneManager->setShadowTextureCountPerLightType(Ogre::Light::LT_SPOTLIGHT, 1);
sceneManager->setShadowTextureSettings(1024, 1);
sceneManager->setShadowColour(Ogre::ColourValue(0.35f, 0.35f, 0.35f));
0 x

User avatar
EricB
Gnome
Posts: 314
Joined: Fri Apr 09, 2010 5:28 am
Location: Florida
x 103
Contact:

Re: Typical values for Texture Shadows

Post by EricB » Fri Apr 19, 2019 1:34 am

If you want good looking shadows, you should be using a shader.

But if you want to use the predefined stuff, I personally lean toward stencils my self (OGL/DX9 in anycase). As that's nice a smooth. Although personally, I let the user choose their settings. The following is from the lowest shadow setting to the best.

Code: Select all

	if(OF::getSingletonPtr()->b_shadows > 0)
	{
		if(OF::getSingletonPtr()->b_shadows == 1)
		{
			m_pSceneMgr->setShadowTechnique(Ogre::SHADOWTYPE_TEXTURE_MODULATIVE);
			m_pSceneMgr->setShadowTextureSize(128);
			
		}
		else if(OF::getSingletonPtr()->b_shadows == 2)
		{
			m_pSceneMgr->setShadowTechnique(Ogre::SHADOWTYPE_TEXTURE_ADDITIVE);
			m_pSceneMgr->setShadowTextureSize(256);
			
		}
		else if(OF::getSingletonPtr()->b_shadows == 3)
		{
			m_pSceneMgr->setShadowTechnique(Ogre::SHADOWTYPE_STENCIL_MODULATIVE);
		}
		
		m_pSceneMgr->setShadowCasterRenderBackFaces(true);
	}
Example: https://steamcdn-a.akamaihd.net/steam/a ... 1551142828
0 x
Image

paroj
OGRE Team Member
OGRE Team Member
Posts: 837
Joined: Sun Mar 30, 2014 2:51 pm
x 147
Contact:

Re: Typical values for Texture Shadows

Post by paroj » Fri Apr 19, 2019 3:00 am

take a look at the projection options in the "Shadows" sample
0 x

Owl53
Halfling
Posts: 83
Joined: Sat Jul 22, 2017 2:32 pm
x 4

Re: Typical values for Texture Shadows

Post by Owl53 » Fri Apr 19, 2019 11:11 am

EricB wrote:
Fri Apr 19, 2019 1:34 am
If you want good looking shadows, you should be using a shader.

But if you want to use the predefined stuff, I personally lean toward stencils my self (OGL/DX9 in anycase). As that's nice a smooth. Although personally, I let the user choose their settings. The following is from the lowest shadow setting to the best.

Code: Select all

	if(OF::getSingletonPtr()->b_shadows > 0)
	{
		if(OF::getSingletonPtr()->b_shadows == 1)
		{
			m_pSceneMgr->setShadowTechnique(Ogre::SHADOWTYPE_TEXTURE_MODULATIVE);
			m_pSceneMgr->setShadowTextureSize(128);
			
		}
		else if(OF::getSingletonPtr()->b_shadows == 2)
		{
			m_pSceneMgr->setShadowTechnique(Ogre::SHADOWTYPE_TEXTURE_ADDITIVE);
			m_pSceneMgr->setShadowTextureSize(256);
			
		}
		else if(OF::getSingletonPtr()->b_shadows == 3)
		{
			m_pSceneMgr->setShadowTechnique(Ogre::SHADOWTYPE_STENCIL_MODULATIVE);
		}
		
		m_pSceneMgr->setShadowCasterRenderBackFaces(true);
	}
Example: https://steamcdn-a.akamaihd.net/steam/a ... 1551142828
Thanks. I'll add the option to choose shadow quality then. That's an interesting suggestion of using stencil shadows as the highest quality, I had almost discounted them due to the performance hit, but that makes a lot of sense when the smoother quality is needed.
paroj wrote:
Fri Apr 19, 2019 3:00 am
take a look at the projection options in the "Shadows" sample
I'll have a look, thanks. More options to consider are always welcome :)
0 x

User avatar
EricB
Gnome
Posts: 314
Joined: Fri Apr 09, 2010 5:28 am
Location: Florida
x 103
Contact:

Re: Typical values for Texture Shadows

Post by EricB » Wed Apr 24, 2019 3:59 am

My scenes are not complex at all. So as I mentioned before and as Parjo linked, you're better off using one of the non-fixed shadow techniques if you need performance. If you don't, I find that stencils work great on practically every potato out there.
0 x
Image

Post Reply