Compositors on shadow textures

· by Steve · Read in about 1 min · (206 Words)

Free Image Hosting at www.ImageShack.us Free Image Hosting at www.ImageShack.usHere’s an interesting technique I’ve been getting working for the past couple of days (when I’ve had time) - attaching compositors to shadow textures, allowing in this case a soft-shadow effect through the application of a gaussian blur on the GPU.

Since shadow textures render much like a regular window, the method for applying this compositor is exactly like setting up a compositor anywhere else, you just have to grab the shadow texture’s render target and apply it. The blur itself is a generic compositor which you can find in the (new) compositor demo and is scripted like all the others. The only bit that requires any code is to set up the gaussian coefficients for the shaders.

This isn’t actually the most efficient way to do texture-based soft shadows, since it requires 2 additional renders to texture to do it at the full resolution of the texture (in this case, 1024×1024). A more efficient approach would be to use shaders directly in the shadow receiver render to apply percentage closest filtering. But I thought it was interesting to show how you can take one feature and use it for something else, and someone had raised this in the forum so I wanted to try it.