Source Shadow Material


leaves cast variegated shadow

Source Shadow Material control how to produce the shadow map.
e.g. Use alpha test technic to produce a variegated map to simulate leaves's shadow.

The flow to produce shadow map:

1. Set matrices for rendering (world,view, proj)

2. Clear shadow map with black color

3. Set ColorArg2[0]to TFactor, set ColorOp[0] to SelectArg2

4. Reverse shadow color (ambient color of environment), and attenuate the color value by distance to Light ,then set to TextureFactor

5. Activate the source shadow material and draw the mobile

 

Remark:

There is preset matrix matShadowViewProj for vertex/pixel shader.