[SOLVED] Grass and disabling texture shadowing

DaveC

24-12-2007 23:27:46

This paged geometry addon's grass looks lovely, except when I enable the scenemanager's shadowing with...
mpRoot = Ogre's root object.

mpRoot->getSceneManager("GENERIC")->setShadowTechnique(SHADOWTYPE_TEXTURE_MODULATIVE);

or any other shadowing technique.

What I want to know is, how to disable shadowing for the grass billboards rendered by the pagedgeometry addon.

I've tried editing the demo "grass.material" file and adding...

receive_shadows off
transparency_casts_shadows off

(off or false for the param)
Yet still, the grass geometry looks like it's having the shadowmap projected upon it.

Here's a screenshot of the problem I'm having...


PS. Thanks for working upon this addon and I appologise if I've placed this post in the wrong forum section, as I've only been using Ogre for a week and this may be Ogre related, as there's probably a simple solution, yet I felt to post in this addon's section as it is related.

JohnJ

25-12-2007 03:10:13

I think the strange grass appearance with shadows can be fixed with some tweaking of the shadow system (at least for texture shadows - stencil shadows worked fine for me automatically), but here's how to turn off grass shadowing manually:

Search GrassLoader.cpp for "//tmpMat->setReceiveShadows(false);", and remove the "//" to un-comment it. This should force the grass to not receive shadows. I'm not sure why "receive_shadows off" doesn't work though.

PS. Thanks for working upon this addon and I appologise if I've placed this post in the wrong forum section, as I've only been using Ogre for a week and this may be Ogre related, as there's probably a simple solution, yet I felt to post in this addon's section as it is related.
This is definitely the correct forum for PagedGeometry related questions :).

Some people post PagedGeometry questions in the Ogre Help forum (probably because they don't know this forum exists) which is unfortunate because I often don't notice them until a week later because they're hard to spot.

DaveC

25-12-2007 13:14:47

Uncommenting the manual shadow setting in the GrassLoader.cpp file worked a treat :)

I'm sorry I can't be of any help as to why the setting within the grass.material file isn't working, it's definately the material being applied to the grass, I'm looking into it...

OK, this shows that I'm new to OGRE, I've sussed out why the material setting to disable shadows wasn't working, I'd placed it in the wrong section.
Wrong, non-working grass.material...

material grass
{
technique
{
pass
{
transparency_casts_shadows off
receive_shadows off
// 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
}
}
}
}


Working grass.material...

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
}
}
}
}


Now all works great without the need to modify the pagedgeometry code at all, thanks for the help and giving me clues as to where I was going wrong :)