Shadow Mapping


Shadow Mapping is a popular technique for dynamic shadows. Currently, only Point and Spot  light supports shadow mapping, and valid Outer angle is 0 ~ 90 for Spot light.

To use shadow mapping, you need:

1. Check light's
Dynamic & Dynamic Shadow style

   
   
    You need adjust light's SW Bias( shadow bias ) & NBias( normal bias ) to get a good shadow.

   

2. Use shaders that supports Shadow Mapping.
 


Shader File

texture setting

Explanation
base \ rigid_shadow.fx 0: base texture for all kinds of object except skinning
base \ rigid_lm_shadow.fx 0: base texture 1: lightmap for lightmaped object ( surface, terrain )
base \ rigid_vc_shadow.fx 0: base texture for vertex colored object ( static mesh )
base \ skin_shadow.fx 0: base texture for skinning object ( skin mesh )
     
bump \ rigid_bump_shadow.fx 0: base texture
1: normal map ( rgb: normal, a: gloss, the same below )
bump effect, for all kinds of object except skinning
bump \ rigid_lm_bump_shadow.fx 0: base texture 1: normal map 2: lightmap bump effect, for lightmaped object
bump \ rigid_vc_bump_shadow.fx 0: base texture 1: normal map bump effect, for vertex colored object
bump \ rigid_vc_bump_wet_shadow.fx 0: base texture 1: normal map
( wet info stored in the alpha channel of vertices color )
bump & wet effect, for vertex colored object
bump \ skin_bump_shadow.fx 0: base texture 1: normal map bump effect, for skinning object
     
parallax \ rigid_parallax_shadow.fx 0: base texture 1: normal map ( alpha as height map & gloss simultaneously, the same below ) Parallax Mapping effect, for all kinds of object except skinning
parallax \ rigid_lm_parallax_shadow.fx 0: base texture 1: normal map 2: lightmap Parallax Mapping effect, for lightmaped object
parallax \ rigid_vc_parallax_shadow.fx 0: base texture 1: normal map Parallax Mapping effect, for vertex colored object
parallax \ rigid_vc_parallax_wet_shadow.fx 0: base texture 1: normal map Parallax Mapping & wet effect, for vertex colored object
     
pom \ rigid_pom_shadow.fx 0: base texture 1: normal map Parallax Occlusion Mapping effect, for all kinds of object except skinning
pom \ rigid_lm_pom_shadow.fx 0: base texture 1: normal map 2: lighmap Parallax Occlusion Mapping effect, for lightmaped object
pom \ rigid_vc_pom_shadow.fx 0: base texture 1: normal map Parallax Occlusion Mapping effect, for vertex colored object
pom \ rigid_vc_pom_wet_shadow.fx 0: base texture 1: normal map Parallax Occlusion Mapping & wet effect, for vertex colored object
     
terrain \ terrain4tex.fx 0: blending control ( auto set, no need assigning )|
1~4: terrain surface texture
5: lightmap
4 layer texture blending, for terrain
terrain \ decallm.fx 0: blending control ( auto set, no need assigning )|
1: decal texture
3: lightmap
for decal, the Factor.x is tiling scale.
terrain \ decalbump.fx 0: blending control ( auto set, no need assigning )|
1: decal texture
2: normal map ( alpha as height map & gloss simultaneously )
3: lightmap
for bumped decal, the Factor.x is tiling scale.

Remark: There is a "effects\include\shadowdef.fx" file, you can switch Hard/Soft shadow, change shadow strength etc.
               
There is a console variable "r_shadowmapping" for turn on/off Shadow Mapping.