My Problem with Shadows

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
User avatar
Marc
Gremlin
Posts: 182
Joined: Tue Jan 25, 2005 7:56 am
Location: Germany

My Problem with Shadows

Post by Marc »

Hi !

I experienced unstopable shadows:

Image

It seems as if the shadow goes "through" everything that is behind the shadowcaster and casts on everything. You can see the shadow on the wall of that tent and on the floor behind the tent, too. Do I have to change some options to fix this or is this on the todo list, or maybe already fixed (I'm using 1.0.0 atm.)?

For converting the models, I used -t and my shadow initialization looks like this:

Code: Select all

	mSceneMgr = mRoot->getSceneManager(ST_GENERIC);
	mSceneMgr->setShadowTechnique(SHADOWTYPE_STENCIL_MODULATIVE);
	mSceneMgr->setShadowColour(ColourValue(0.5, 0.5, 0.5));
	mSceneMgr->setShadowDirLightTextureOffset(0.1);
	mSceneMgr->setShadowFarDistance(50);
ciao
Marc
User avatar
DWORD
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 1365
Joined: Tue Sep 07, 2004 12:43 pm
Location: Aalborg, Denmark

Post by DWORD »

I may be wrong, but I think this is a 'feature' of stencil shadows. If you turn on shadow casting for the building, too, it should look correct. But that'll of course impact performance a bit.
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 7

Post by haffax »

Yep, the second shadow you see on the floor behind the tent is there, because it is well in the shadow volume of the character. It is far too expensive to cap the shadow volume with the occluding tent. So either turn the shadow for the building on too or use some nifty shader magic (if there is one) that I don't know about.

You get much better results with light from a less steep angle.
team-pantheon programmer
creators of Rastullahs Lockenpracht
User avatar
Marc
Gremlin
Posts: 182
Joined: Tue Jan 25, 2005 7:56 am
Location: Germany

Post by Marc »

Hmm, right, a shadow for the tent fixes it.

Do shadow volumes get cached if I use stencil shadows with static objects and lights? Or do they get recalculated each frame? E.g. in that scene the light stays forever where it is and the tent, too.


Do you know why, when I change the shadow initialization to

Code: Select all

	mSceneMgr->setShadowTechnique(SHADOWTYPE_TEXTURE_MODULATIVE);
	mSceneMgr->setShadowTextureSettings(512, 4);
	mSceneMgr->setShadowColour(ColourValue(0.5, 0.5, 0.5));
	mSceneMgr->setShadowDirLightTextureOffset(0.1);
	mSceneMgr->setShadowTextureFadeStart(10);
	mSceneMgr->setShadowTextureFadeEnd(15);
	mSceneMgr->setShadowFarDistance(50);
I don't see any texture shadows?
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66

Post by sinbad »

Covered in the manual here: http://www.ogre3d.org/docs/manual/manual_54.html#SEC207 , but to summarise - texture shadows are only received by objects which have shadow casting turned off.
User avatar
Marc
Gremlin
Posts: 182
Joined: Tue Jan 25, 2005 7:56 am
Location: Germany

Post by Marc »

Ah, my problem prolly was that my sun-spotlight was very far away and the shadow texture got scale quite large. When I use a directional light instead, it works.