Greeting everyone, I have posted this on the ogre forum and would like to open the discussion here as well.
I have recently added per pixel lighting to my game, then tried to implement custom shadow mapping, both are taken from the wiki,
here is a screenshot of the problem:
my terrain is loaded in chunks using 1 mesh for every chunk, I'm trying to achieve self shadowing. Terrain is a procedural voxel terrain powered by polyvox.
my terrain material
Code:
material terrain
{
technique
{
// Base ambient pass
pass
{
vertex_program_ref Ambient
{
}
shadow_caster_vertex_program_ref ShadowCasterVP
{
}
}
pass
{
// do this for each light
iteration once_per_light
scene_blend add
vertex_program_ref PerPixel_Vert
{
}
fragment_program_ref PerPixel_Frag
{
}
shadow_receiver_vertex_program_ref LightingWithShadowMapVP
{
}
shadow_receiver_fragment_program_ref LightingWithShadowMapFP
{
}
vertex_program_ref LightingVP
{
}
fragment_program_ref LightingFP
{
}
}
}
}
Custom shadow mapping shader is taken directly from here
http://www.ogre3d.org/tikiwiki/Custom+Shadow+Mapping, per pixel shader is taken directly from here
http://www.ogre3d.org/tikiwiki/PerPixel+Lighting+II I use the "perpixel" one.
My createscene shadow code:
Code:
sceneMgr->setShadowTexturePixelFormat(Ogre::PF_FLOAT16_R);
sceneMgr->setShadowTechnique(Ogre::SHADOWTYPE_TEXTURE_ADDITIVE);
sceneMgr->setShadowTextureSelfShadow(true);
sceneMgr->setShadowTextureCasterMaterial("ShadowCaster");
sceneMgr->setShadowTextureReceiverMaterial("ShadowReceiver");
I don't know if there is any simpler method to achieve the self shadowing technique using ogre, any help would be appreciated.