Thanks for your comments.

Quote:

how does it work?



1) The scene is rendered from the lightsource with a shader that outputs the depth.
2) The scene is then rendered with the normal camera and the depth texture is projected from the lightsource onto the scene. I then check the depth in the depth texture to the distance from pixel to the lightsource. If the pixel's distance to the light is greater than the depth stored in the depth texture, it is in shadow.

Quote:

does the light source have to have special parameters? or the block (like _litAndShodow)?



The light source is basicly a view, so you can set it's position, angle, arc, etc. The occluder/reciever doesn't need anything, it just needs to be a mesh.

Right now the scene is only rendered once from the camera but I'm planning to change it so that the camera is first rendered with the normal shaders, and then with a shader that only draws the shadows (with the other areas transparent) and overlay that on the first render. That way, you can still use your normal shaders.

This also allows to use a simple screenspace blur on the shadow texture. However this will result in dark halos around the silhouette of the model. I will try to prevent that by using the differntial of the neighbouring pixels on the shadow map (Don't blur if neighbouring pixels are much 'deeper'). If that doesn't work I will use percentage closer filtering: check how many points near this pixel are in shadow to decide shadow darkness. The drawback of PCF is that a smoother shadow will require more samples (thus slower rendering).

Quote:

can we set if a surface can receive shadows?



Everything casts and recieves shadows by default. You can use a different material in the depth-pass that doesn't render the object so that it is 'ignored'.

Quote:

Please talk with JCL about this topic. Maybe he can add your excellent shaders into the upcoming shader template package?



When the shader is done, I'll talk to JCL about this.

Quote:

what about multiple lights?



Not yet supported, I'll have to think about the implications of adding another light but it should be possible.

I think implementing this shader in your project could be as easy as including a script and passing a vector pointer to a function. You can then set that vector to any position and angle you want. You will probably also have to add two lines of code to all your materials for switching to a depth material when rendering from the lightsource.