Terrain sample, setShadowTextureCasterMaterial is misleading

Description

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

mSceneMgr->setShadowTextureCasterMaterial("PSSM/shadow_caster");
(-> referring to pssm.material)

is overridden by the the material created in buildDepthShadowMaterial, which is a material cloned from the material

Ogre/shadow/depth/integrated/pssm
(-> referring to shadows.material)

in which the shadow caster material is modified.

See also http://www.ogre3d.org/forums/viewtopic.php?f=2&t=68947#p451247

Original Mantis Ticket: http://www.ogre3d.org/mantis/view.php?id=500

Environment

None

Assignee

Unassigned

Reporter

Philip Allgaier

Labels

None

Components

Fix versions

Affects versions

Priority

Minor
Configure