Original reporter: MasterD
The terrain sample shadow setup code bears the impression that a specific shader is used, although another one is actually used. This leads to false assumptions and troubles when implementing terrain based on this sample.
When using the SM2Profile terrain shader setup and using the texture depth shadow setup, it is required that the pixel values produced by the shadow caster shader are in the scene_depth_range of the shadow scene.
The documentation of the SM2Profile does not state which requirements to the shadow setup there are. However, by looking at the terrain sample it looks like the terrain sample is using pixel values in the [0,1] range.
This is because the call
(-> referring to pssm.material)
is overridden by the the material created in buildDepthShadowMaterial, which is a material cloned from the material
(-> referring to shadows.material)
in which the shadow caster material is modified.
Original Mantis Ticket: http://www.ogre3d.org/mantis/view.php?id=500