Software Lighting Techniques

Can someone tell me some common realtime lighting techniques used in software renderers? Do they calculate colors ahead of time and store them in a shade table? Or do they somehow calculate it on the fly? Right now I’m using the shade table approach and it only supports 8-bit color. It takes some serious calculation to build a shaded surface from the shade table.

No ones answered yet so I’ll share my limited knowledge.

My understanding is there are basically 2 ways to do lighting; precalculated using lightmaps and mulitexturing (Quake 3) or applying gauroud (or phong or flat) shading for each polygon.

For more info on lightmaps check google. I don’t know much about them or how dynamic lights are implemented with lightmaps.

For gauroud shading each polygon its pretty straight forward; calculate the light color and intensity at each vertex (edit these can come from a look up table) and add (or some other operation depending on specular, emmisive, or ambient properties) that color to the texture interpolating between vertices. So far as finding the color I’ve seen the idx3d software renderer build a huge (64k) lookup table from the list of lights and it seems to be very fast.

[quote]Right now I’m using the shade table approach and it only supports 8-bit color. It takes some serious calculation to build a shaded surface from the shade table.
[/quote]
Why only 8 bit? I haven’t implemented lighting in my software renderer yet but when I do I’d planned to start simple with a single static light; a lookup table with only 64 entries or something.

I found a way to store colors from an image only once using an IndexColorModel. If you aren’t familiar with that, it’s an index that stores colors only once from an image. If there are 75 green pixels in an image, it stores the green color once, and then moves on. It saves a ton of memory, but I haven’t found a way to make it work with 16-bit images.