farclipdistance and shadows!

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
User avatar
eugen
OGRE Expert User
OGRE Expert User
Posts: 1422
Joined: Sat May 22, 2004 5:28 am
Location: Bucharest
Contact:

farclipdistance and shadows!

Post by eugen » Fri Jan 21, 2005 3:15 am

enabeling shdows makes camera->setFarClipDistance() call useless!
my light is beyond my view area...
what would be the possibilies to have proper shadows and use farclipdistance right!?
0 x

User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19265
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 2
Contact:

Post by sinbad » Fri Jan 21, 2005 6:09 pm

If you mean stencil shadows, we set the camera to infinite projection where it is available since that makes stencil shadows much more robust. Failing to do this can cause artefacts because of shadow volumes poking out the back of the far clip plane.

Use SceneManager::setShadowFarDistance to help remove far casters.
0 x

User avatar
eugen
OGRE Expert User
OGRE Expert User
Posts: 1422
Joined: Sat May 22, 2004 5:28 am
Location: Bucharest
Contact:

Post by eugen » Sat Jan 22, 2005 4:06 am

i understand!
so there isnt a way (maybe telling the manager to not set to infinite the distance in a stencil shadows scene) of having stencil shadows and a custom finite far clip distance?!
my problem is as follows: i have a scene constructed gradually...i want the constuction not to be visible to the player (that is why i need farclipdistance...to hide it)...but i will like to have modulative stencil shadows also!
my shadow casters are only the ones in range of 10 meters around the camera!
0 x

User avatar
Robomaniac
Hobgoblin
Posts: 508
Joined: Tue Feb 03, 2004 6:39 am

Post by Robomaniac » Sat Jan 22, 2005 4:24 am

setShadowFarDistance should work
0 x
phear hingo

My Webpage

User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19265
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 2
Contact:

Post by sinbad » Sat Jan 22, 2005 4:43 pm

Why not only add the newly constructed pieces gradually, or fade them in using alpha, or use fog? There are lots of options which are frankly better than relying on the far clip anyway.
0 x

User avatar
eugen
OGRE Expert User
OGRE Expert User
Posts: 1422
Joined: Sat May 22, 2004 5:28 am
Location: Bucharest
Contact:

Post by eugen » Sat Jan 22, 2005 4:48 pm

i add them gradually...but this method would have been less programming excpensive for me...fog is also a good idea! i'll try that :) thanks!
0 x

User avatar
Kencho
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4011
Joined: Fri Sep 19, 2003 6:28 pm
Location: Burgos, Spain
x 1
Contact:

Post by Kencho » Sat Jan 22, 2005 7:25 pm

Well, I, even using fog, used the far clipping distance to cull large parts of my scenarios in a project I was working on. I find it extremely useful.
0 x
Image

User avatar
eugen
OGRE Expert User
OGRE Expert User
Posts: 1422
Joined: Sat May 22, 2004 5:28 am
Location: Bucharest
Contact:

Post by eugen » Sun Jan 23, 2005 4:24 pm

and u still got to use stencil shadows with clipping distance?!
0 x

User avatar
eugen
OGRE Expert User
OGRE Expert User
Posts: 1422
Joined: Sat May 22, 2004 5:28 am
Location: Bucharest
Contact:

Post by eugen » Sun Jan 23, 2005 4:41 pm

regarding fog method..is not helping...as i expected!
is there a way of telling to a mesh to fade in from material script?
i have many objects on a large area loaded at once and is to obviuos not using farclipdistance!

edit: actually the fade in technique on material scripts (if there is one) wont help (since i need per entity fade in, not per mesh type)
0 x

User avatar
eugen
OGRE Expert User
OGRE Expert User
Posts: 1422
Joined: Sat May 22, 2004 5:28 am
Location: Bucharest
Contact:

Post by eugen » Thu Feb 03, 2005 9:44 pm

i tried different aproaches...the far clip distance is better...!
so, i'm asking again since i'm not sure about the result:

Is there a way of using stencil shadows with a finite far clip distance?

if yes, and the answer relies on the setShadowFarDistance, then i must try again, since this doesnt work for me!
0 x

qsilver
OGRE Community Helper
OGRE Community Helper
Posts: 198
Joined: Sat Oct 02, 2004 9:11 am
Location: San Francisco, California, USA

Post by qsilver » Thu Feb 03, 2005 10:18 pm

Yes, but the results may be off. Infinite far clip is the only way to get perfect stencil shadows. You want to use this function:
pSceneManager->setShadowUseInfiniteFarPlane(false);

You'll have to be very careful with light placement (especially point lights!) or you're going to get nasty artifacts like inverted shadows ...
0 x

Post Reply