Shadow texture

Hi!

What I want to do is render my stencil shadow volumes and copy them to a texture. In the main rendering loop, this shadow texture is written to the alpha buffer modulating the light intensity. The most simple way would be to use an alpha texture for the shadow texture. But the problem is that CTT is much slower for an alpha texture than for a RGBA texture map. But using a RGBA texture would be a waste of memory since only the alpha part is needed.

My idea is to combine 4 shadow textures in one RGBA map. This would be memory efficient and also pretty fast since less CTT calls are needed.

The problem is now that I can’t think of a way at the moment to copy for example shadow texture #1 that is stored in the red channel into the alpha buffer in the main rendering loop using register combiners. Any ideas?

Thanks in advance
LaBasX2

I think using the simplest solution is better. You only need 1-bit per light, so you could store the shadows from 8 ( overlapping ) lights in destination alpha, then copy RGBA to a texture. Saving memory and making the implementation more complex is really not worth it.

simple:
use a dotproduct in the combiners with the constant 1,0,0 for red, 0,1,0 for green, 0,0,1 for blue, and put this out in the output register for the alphapart…

@PH: Thanks! Encoding 8 lights in one channel is also a good idea but the problem is that I don’t get any blurring then and that could look even more jaggy in combination with low resolution textures.

@Dave: Great! That’s what I’ve been looking for Thanks!

LaBasX2