Page 1 of 1

farclipdistance and shadows!

Posted: Fri Jan 21, 2005 3:15 am
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!?

Posted: Fri Jan 21, 2005 6:09 pm
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.

Posted: Sat Jan 22, 2005 4:06 am
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!

Posted: Sat Jan 22, 2005 4:24 am
by Robomaniac
setShadowFarDistance should work

Posted: Sat Jan 22, 2005 4:43 pm
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.

Posted: Sat Jan 22, 2005 4:48 pm
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!

Posted: Sat Jan 22, 2005 7:25 pm
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.

Posted: Sun Jan 23, 2005 4:24 pm
by eugen
and u still got to use stencil shadows with clipping distance?!

Posted: Sun Jan 23, 2005 4:41 pm
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)

Posted: Thu Feb 03, 2005 9:44 pm
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!

Posted: Thu Feb 03, 2005 10:18 pm
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 ...