Quote:Original post by OrangyTang
I use this technique in my engine, originally described in 'Modern Graphics Engine Design'. I was using per vertex shadows at the time of the talk, but now I'm doing what you describe above.
Quickie questions for either of you ('cos I'm always interested in new shadow stuff [grin]):
- Hows the memory use compared to vanilla lightmapping? I'd expect an increase, but I assume its managable?
- How do you pull off the lighting for your moving entities? Project your per-light lightmaps vertically or something like Q3's light grid?
- Is that a hard shadow on your dynamic object? Have you tried using a projected shadow texture rendered into the dest alpha (I love using dest alpha for these effects, shame it tends to be quite slow compared to normal rendering).
1) Well its not too bad, b/c the light color is factored out of the occlusion*attenuation maps, so it's a single color. You could either store 4 in a 32 bit rgba texture, or just have separate A8 or DXT5 textures with just an alpha channel ( my plan ). However, it's definitely some cost b/c of one lightmap per light.
2) I do many raycasts ( ~9 ) towards each light every frame, and just use that entire amount over the entities. Since they are relatively small, it looks pretty good. Another approach I haven't done is to do 3 raycasts from 3 different points in a horizontal triangle around the entity's head. Then interpolate for each vertex, between these 3 weights in the vertex shader. This would allow half/half lighting effects.
3) Yes, it's a pretty hard shadow, although I am using bilinear filtering on the map right now. It is first rendered to a texture page offscreen with all other shadows for that light, then rendered to dest alpha, then the lighting is applied. I could certainly blur the entire shadow map, or just sample the shadow at 4 offsets to make it a bit softer.
Why do you say dest alpha rendering is slow? Slower than other forms of alpha blending? I haven't found this myself...