Page 1 of 1

Casting Receiving Shadows

Posted: Sat Sep 22, 2012 12:24 am
by Thade
Hi

I have some low poly trees - textures are with alpha channel
If I do not build a Shadowvolume ## BuildMeshShadowVolume(PlantMesh2) ## for the mesh then the trees look great but they do not cast a shadow
If I build a Shadowvolume I have a not so good looking shadow and the trees look terrible because they receive their own shadows which makes the transparent alpha parts visible.

I solved this problem in another engine I used before using fake shadow maps and a HLSL-shader I found in the internet - but have no idea how to fix it in PB 5.00beta3

I edited the material file with many different settings - all failed when I added BuildMeshShadowVolume ...

Question is: Is there a way to make an entity casts shadows (even considering transparent textures) but does not receive shadows itself ?

Re: Casting Receiving Shadows

Posted: Sat Sep 22, 2012 10:15 am
by Fred
From what i understand, this flag is per material, not per entity. I think you can do it like that:

http://www.ogre3d.org/tikiwiki/Materials

Code: Select all

material Material/SOLID/erdboden.jpg
{
    receive_shadows off
    ...
}
Just a shoot in the dark here :)

Re: Casting Receiving Shadows

Posted: Sat Sep 22, 2012 12:15 pm
by Thade
Thanks Fred

The Page is a great additional help - much better than the original Ogre Manual I went through - on the other hand I figured out how the functions and parameters fit together and tried hundreds of combinations. Actually I can write most Material files by hand out of my head now :)

The problem is, that the entity receives the shadows - with some more parameters for EntityRenderMode(#Entity, Mode) you could probably change the render behavior
#PB_Entity_CastShadowYes | #PB_Entity_ReceiveShadowsNo ... alternative #PB_Entity_ReceiveShadowsYes ... #PB_Entity_CastShadowNo for instance

Image Image

Left picture without BuildMeshShadowVolume(PlantMesh2) ... right picture with BuildMeshShadowVolume(PlantMesh2)

On the other hand - I would need another Shadow behavior anyway. Transparent parts of the Texture should not cast a shadow. Problably a feature for the next Beta :D

Cheers

Re: Casting Receiving Shadows

Posted: Wed Oct 10, 2012 11:07 pm
by Olby
Not sure if Ogre has this functionality in the first place. Honestly, based on my experience I don't think that stencil shadow volumes are designed to cast shadows from alpha masked surfaces. Guess you need to use custom made shaders for that unless there is something unexposed in PB's OGRE implementation.