How to improve DirectX lights dramatically

Blitz3D Forums/Blitz3D Programming/How to improve DirectX lights dramatically

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

The major problems with DX (or GL) lights are as follows:

1) There can only be 8.

2) They have an unlimited range, more or less.

The solution to both, which I have implemented in OpenGL, is as follows: For each object, calculate the closest 8 light entities to it, and enable the 8 or less DX lights you need for that object. Give the DX lights infinite range, and just darken them according to distance from the current object, so as to give the lights a definite inverse square or linear falloff. It's easy to do, and improves the quality of the dynamic lighting dramatically. The same can be done with vertex lights, but DX light handling is so much more optimized. As of now, DX lights are pretty much useless for dynamic lighting of characters and items, which is what they are usually used for.