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
x 8
Contact:

farclipdistance and shadows!

Post by eugen »

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!?
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
Contact:

Post by sinbad »

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.
User avatar
eugen
OGRE Expert User
OGRE Expert User
Posts: 1422
Joined: Sat May 22, 2004 5:28 am
Location: Bucharest
x 8
Contact:

Post by eugen »

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!
User avatar
Robomaniac
Hobgoblin
Posts: 508
Joined: Tue Feb 03, 2004 6:39 am

Post by Robomaniac »

setShadowFarDistance should work
phear hingo

My Webpage
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
Contact:

Post by sinbad »

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.
User avatar
eugen
OGRE Expert User
OGRE Expert User
Posts: 1422
Joined: Sat May 22, 2004 5:28 am
Location: Bucharest
x 8
Contact:

Post by eugen »

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!
User avatar
Kencho
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4011
Joined: Fri Sep 19, 2003 6:28 pm
Location: Burgos, Spain
x 2
Contact:

Post by Kencho »

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.
Image
User avatar
eugen
OGRE Expert User
OGRE Expert User
Posts: 1422
Joined: Sat May 22, 2004 5:28 am
Location: Bucharest
x 8
Contact:

Post by eugen »

and u still got to use stencil shadows with clipping distance?!
User avatar
eugen
OGRE Expert User
OGRE Expert User
Posts: 1422
Joined: Sat May 22, 2004 5:28 am
Location: Bucharest
x 8
Contact:

Post by eugen »

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)
User avatar
eugen
OGRE Expert User
OGRE Expert User
Posts: 1422
Joined: Sat May 22, 2004 5:28 am
Location: Bucharest
x 8
Contact:

Post by eugen »

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!
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 »

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 ...
Post Reply