Stencil modulative shadows

NoodlesOnMyBack

28-03-2008 10:53:10

If i turn on SHADOWTYPE_STENCIL_MODULATIVE and activate PagedGeometry, i get a really bad performance in my game, so i tried changing the material for the grass (i only load grass)


material grass
{
transparency_casts_shadows off
receive_shadows off
technique
{
pass
{
// lighting off
cull_hardware none
cull_software none
scene_blend alpha_blend
alpha_rejection greater_equal 128
// depth_write off

texture_unit
{
texture grass2.png
}
}
}
}


This makes the grass look better, but the performance problem remains the same.
So i uncommented the code in GrassLoader.cpp:

tmpMat->setReceiveShadows(false);

But same thing again :( any idea? I just want the grass not to be affected by shadows at all

JohnJ

28-03-2008 17:44:54

Other than disabling grass from receiving and casting shadows, I don't know of any other way to improve performance, since the rest is in Ogre's hands.

NoodlesOnMyBack

28-03-2008 18:34:15

Other than disabling grass from receiving and casting shadows, I don't know of any other way to improve performance, since the rest is in Ogre's hands.

Yes i know, but if i disable pagedgeometry the performance its ok, and only when i turn shadows on i get the performance hit, its like in some part of the code the shadows still bothering Pagedgeometry, i just dont know where, im using only a grassloader.
i'll take a deeper look later, but... :roll:

JohnJ

28-03-2008 18:45:57

Yes i know, but if i disable pagedgeometry the performance its ok, and only when i turn shadows on i get the performance hit
Well the problem is obviously due to stencil shadows being performed on the grass, which are hundreds of small polygons. This is bound to be slow, so it's no surprise that turning shadows on with grass gives a massive performance hit. PagedGeometry's grass just wasn't meant to be used with stencil shadows. You might get better results with texture shadows, or disabling grass shadows completely like you originally tried to do.

NoodlesOnMyBack

28-03-2008 20:10:04

Yes i know, but if i disable pagedgeometry the performance its ok, and only when i turn shadows on i get the performance hit
Well the problem is obviously due to stencil shadows being performed on the grass, which are hundreds of small polygons. This is bound to be slow, so it's no surprise that turning shadows on with grass gives a massive performance hit. PagedGeometry's grass just wasn't meant to be used with stencil shadows. You might get better results with texture shadows, or disabling grass shadows completely like you originally tried to do.


I still want to use Stencil shadows, so you say i just need to change the pagedgeometry code to do this.The modification i made to tmpMat->setReceiveShadows(false); its not enough?
And with texture shadows i can get nice results like with stencil? because with stencil they look much better.

JohnJ

02-04-2008 15:24:01

You can get good results with texture shadows, but they will probably never look as sharp as stencil, if that's what you like. Personally, I think sharp shadows look unrealistic, but that's just me.

If you do want to use stencil shadows, just make sure that grass shadows are completely disabled, so disable it from the material, and from the PagedGeometry code.