I have a couple of questions.
Once I set this
Code: Select all
mSceneMgr->setShadowTextureCasterMaterial("Ogre/DepthShadowmap/Caster/Float");
so I am guessing not, could someone verify? Using either approach I have not seen any self shadowing yet.You don't need to set caster material to entities - it's common for all with *->setCastShadows(true).
This is the receiver code I am using (slightly altered from the cookbook)
Code: Select all
// Basic materials which support shadows as a seperate scheme
material Ogre/DepthShadowmap/BasicTemplateMaterial
{
// This technique supports dynamic shadows
technique
{
// Base ambient pass
pass Ambient
{
// base colours, not needed for rendering, but as information
// to lighting pass categorisation routine
ambient 1 1 1
diffuse 0 0 0
specular 0 0 0 0
// Really basic vertex program
vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
{
}
}
// Now do the lighting pass
// NB we don't do decal texture here because this is repeated per light
pass Lighting
{
// base colours, not needed for rendering, but as information
// to lighting pass categorisation routine
ambient 0 0 0
// do this for each light
iteration once_per_light
scene_blend add
// Vertex program reference
vertex_program_ref Ogre/DepthShadowmap/ReceiverVP
{
}
// Fragment program
fragment_program_ref Ogre/DepthShadowmap/ReceiverFP
{
}
texture_unit
{
content_type shadow
tex_address_mode clamp
filtering none
}
}
// Decal pass
pass Decal
{
// base colours, not needed for rendering, but as information
// to lighting pass categorisation routine
lighting off
// Really basic vertex program
vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
{
param_named ambient float4 1 1 1 1
}
scene_blend modulate
texture_unit
{
texture_alias MainTexture
//commented out because texture was not stretching with object
//tex_address_mode clamp
}
}
}
}
Code: Select all
import * from "DepthShadowmap.material"
material MyMaterial : Ogre/DepthShadowmap/BasicTemplateMaterial
{
set_texture_alias MainTexture rockwall.tga
}
Material generated by 3ds max scene export
Code: Select all
material "buddhadefault"
{
technique buddhadefault_technique
{
pass buddhadefault_standard
{
ambient 0.588 0.588 0.588 1
diffuse 0.588 0.588 0.588 1
specular 0 0 0 0 25.5
emissive 0 0 0 1
}
}
}
Code: Select all
material "sponzaleaf"
{
technique sponzaleaf_technique
{
pass sponzaleaf_standard
{
ambient 1 1 1 1
diffuse 1 1 1 1
specular 0 0 0 0 25.5
emissive 0 0 0 1
scene_blend alpha_blend
depth_write off
vertex_program_ref sponzavsLightGENNORM0
{
}
fragment_program_ref sponzafpLightGENDIFF0NORM0
{
param_named normalMul float 0.02
}
texture_unit sponzaleaf_Diffuse#0
{
texture sponzasponza_thorn_diff.png
tex_coord_set 0
colour_op modulate
}
texture_unit sponzaleaf_Unknown#1
{
texture sponzasponza_thorn_mask.png
tex_coord_set 0
colour_op modulate
}
texture_unit sponzaleaf_Normal#2
{
texture sponzasponza_thorn_bump.png
tex_coord_set 0
colour_op modulate
}
}
}
technique sponzaleaf_basic_technique
{
scheme basic_mat
pass sponzaleaf_standard
{
ambient 1 1 1 1
diffuse 1 1 1 1
specular 0 0 0 0 25.5
emissive 0 0 0 1
scene_blend alpha_blend
depth_write off
texture_unit sponzaleaf_Diffuse#3
{
texture sponzasponza_thorn_diff.png
tex_coord_set 0
colour_op modulate
}
texture_unit sponzaleaf_Unknown#4
{
texture sponzasponza_thorn_mask.png
tex_coord_set 0
colour_op modulate
}
}
}
}