Page 1 of 1

stencil shadows only on idle time

Posted: Fri Jun 03, 2011 9:48 am
by max6666north
Hi folks

because the stencilshadows sometimes are slow (on old computers or
large scenes) i want to enable them only if the program is idle and
switch them off if i move the camera...

for this i need some hints to solve it.

thanks
max

Posted: Fri Jun 03, 2011 10:09 am
by Radikalizm
Unless you have a static camera 90% of the time, doesn't this kind of beat the point of having shadows at all? (not to mention that this would look rather ugly)

You could always set your shadow volume scene nodes as invisible while updating your camera to achieve what you want, might get a bit hard to manage though

EDIT:

To propose a better alternative, I'd suggest you look into shadow mapping and tweak this to your liking; it looks nicer than stencil shadows in general, and you should be able to make them as simple or as complex as you want depending on your performance needs

Posted: Fri Jun 03, 2011 10:23 am
by hybrid
Yeah, but shadow maps and old computers might be a problem. Moreover, there's no default implementation for them in Irrlicht. Maybe someone could suggest and provide an implementation for inclusion into the engine?!
The suggestion for changing visibility of the shadow nodes is correct, though I'm not sure if it works currently. Shadow nodes are handled slightly special, which means that there might be some issues with the default scene nodes handling. But giving it a try shouldn't hurt. Checking the times when to enable or disable them is up to you, though. There's no way to check for idle times or camera movement in Irrlicht automatically.

Posted: Fri Jun 03, 2011 10:29 am
by max6666north
[quote="Radikalizm"]Unless you have a static camera 90% of the time, doesn't this kind of beat the point of having shadows at all? (not to mention that this would look rather ugly)

You could always set your shadow volume scene nodes as invisible while updating your camera to achieve what you want, might get a bit hard to manage though

EDIT:

To propose a better alternative, I'd suggest you look into shadow mapping and tweak this to your liking; it looks nicer than stencil shadows in general, and you should be able to make them as simple or as complex as you want depending on your performance needs[/quote]

thanks for re

i tried to make the shadow volume scene nodes invisible and it works
in general, but the handling is the problem.
if shadows are on the mouse actions are very slow and the time
until i can switch off the visibility is very long (first click event).
The second is, if i release the mouse (cameramovement stops)
the shadows should come after a specified time....

max

Posted: Fri Jun 03, 2011 10:35 am
by Radikalizm
hybrid wrote:Yeah, but shadow maps and old computers might be a problem. Moreover, there's no default implementation for them in Irrlicht. Maybe someone could suggest and provide an implementation for inclusion into the engine?!
The suggestion for changing visibility of the shadow nodes is correct, though I'm not sure if it works currently. Shadow nodes are handled slightly special, which means that there might be some issues with the default scene nodes handling. But giving it a try shouldn't hurt. Checking the times when to enable or disable them is up to you, though. There's no way to check for idle times or camera movement in Irrlicht automatically.
Flexible render passes would make the implementation of various shadow mapping techniques much easier I suppose, I haven't had time yet to mess around with shadow maps in irrlicht, although I have some simple implementations in my own engine which I could port (given that they are good enough performance-wise for irrlicht, since my engine does not need to maintain compatibility with older or mobile systems)

Posted: Fri Jun 03, 2011 11:36 pm
by Mel
Stencil shadows are done extruding the silouette that creatres a mesh, so, a way to speed them up is to use simpler meshes to create just the shadows, and work with them.