Register  |  FAQ  |  Search  |  Memberlist  |  Usergroups  |  Log in 
Reply to topic
 Dynamic Shadow - dest material 
awingsoft
Site Admin

Joined: 25 Dec 2006
Posts: 98
Reply with quote


Dest Material control how to blend shadow map with scene.
e.g. Use alpha test technic to splash shadow map to simulate shader on grass, leaves.

The flow to project shadow map:

1. Set TexCoordIndex[0] to CameraSpacePosition; set TextureTransformFlags[0] to Count3|Projected; set a texture transform matrix for stage0, so let generated texture coordinates bounds to 0 to 1

2. Set texture address mode of stage0 to Clamp (or Border mode if device is supported).

3. Set shadow map texture to texture0

4. Turn on alpha blend; SrcBlend=Zero, DestBlend=InvSrcColor; if reverse shadow, ScrBlend and DestBlend are all =One;

5. For surfaces:
1). If no use ready shadow map, set ColorOp[0] to SelectArg1;
2). If use ready shadow map, set TextureFactor to Light's color, set ColorArg1[0] to Texture|Complement, set ColorArg2[0] to TFactor. Set ColorOp[0] to SelectArg1 ( or Modulate if reverse shadow ).

For meshs:
1). If no use ready shadow map, set ColorArg2[0] to Diffuse, set ColorOp[0] to Modulate;
2). If use ready shadow map, set TextureFactor to Light's color, set ColorArg1[0] to Texture|Complement, set ColorArg2[0] to TFactor. Set ColorOp[0] to SelectArg1 ( or Modulate if reverse shadow ). Set ColorArg1[1] to Diffuse, set ColorOp[1] to Modulate.
3). Turn off all lights, only turn on the current light that produce shadow.

6. Activate dest shadow material and draw the objects in shadow.
View user's profile Send private message Send e-mail
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic