Working on a two passes material, the shadow pass being potentially added automatically in the material by enabling shadows.
Here is how it looks:
material two_pass_shadows
{
receive_shadows ontechnique
{
shadow_caster_material shadowscaster
pass standard
{
ambient 0.0 0.0 0.0 1.0
diffuse 0.8 0.8 0.8 1.0
specular 0.0 0.0 0.0 1.0 0.0
emissive 0.0 0.0 0.0 1.0
alpha_to_coverage off
colour_write on
cull_hardware clockwise
depth_check on
depth_func less_equal
depth_write on
illumination_stage
light_clip_planes off
light_scissor off
lighting on
normalise_normals off
polygon_mode solid
scene_blend one zero
scene_blend_op add
shading gouraud
transparent_sorting on
// SUPER IMPORTANT TO AVOID FLICKERING
depth_bias 0 -1
texture_unit
{
texture rock.jpg
tex_address_mode wrap
scale 1 1
colour_op modulate
}
}
pass pssm
{
scene_blend add
// SUPER IMPORTANT TO AVOID FLICKERING
depth_bias 0 0
vertex_program_ref ShadowsPssm_vert
{
}
fragment_program_ref ShadowsPssm_pix
{
}
texture_unit
{
content_type shadow
tex_address_mode border
tex_border_colour 1 1 1 1
}
texture_unit
{
content_type shadow
tex_address_mode border
tex_border_colour 1 1 1 1
}
texture_unit
{
content_type shadow
tex_address_mode border
tex_border_colour 1 1 1 1
}
}
}
}
There is still issue with wireframe materials for instance ( polygon_mode wireframe ). Another issue is the poor definition of the shadows once the camera is a bit further.
As shown in this image, there is a clear cut in definition when going from the near texture (green one, 2048) to the second one (red one, 1024). I guess I have to look much closer to the distance steps.
3 Comments
Nice. We want moarrr screenshots :-D.
Could you also make the last one work in realtime? Pleeez.
cool!! And if you had blur that could be fix the definition problem… or not?
Can’t wait to test it 😉
the code will be available soon in the repo 🙂