Yes, that's right, we finally have model lights on MD2s. Thanks to Henrik's fixing of lw2md2, you can model light entities that have been redelivered with the new tool (or CTCs)
Creating Lights
Creating Point Lights
To make point lights, you must make an entity with the classname "modellight". Then, set the key, "lighting" to be the radius of the light. This is the distance from the source that the light will affect entities. Set the R, G, and B keys to be the color of the light.
Creating a World Ambient Light
You can also have a default light source which will affect all entities that aren't in the range of one of the light entities. This is the world ambient light source. To set this, you set the angles of the worldspawn for the direction and the R,G,B values for the color. This is an infinite parallel light source which will affect all relevant entities.
By default, all entities are not directionally lit. That is, if the lighting field in the entity.dat is 0, it won't be affected by these model lights. To change this, change the field to either 1 or 2. If 1 is selected, only model lights will affect the entity (including the world ambient). If it is set to 2, the normal lighting scheme will be mixed with the directional light so it's effectively combining both the standard Quake2 lighting model with the model lights
You can modify the direction and color of the dynamic light through a series of APE and Planet commands. This is useful for when you move to significantly different areas where the lighting needs to be drastically different (such as going from inside to outside, etc.)
In APE
Change the color with the following command:
LIGHT_SetAmbientColor [r] [g] [b]Where R, G, and B are the Red, Green, and Blue components of the ambient light color
Change the direction with the following command:
LIGHT_SetAmbientDir [yaw] [pitch] [roll]Where, yaw pitch and roll are the angles of the light direction vector.
In Planet
Change the color with the following command:
setambientcolor [r] [g] [b]
Where r, g, and b are the red, green, and blue components of the color.
setambientdir [yaw] [pitch] [roll]
Where yaw, pitch, and roll are the angles of the light direction vector.
Because the lights are entities, and use the RGB fields to determine their color, you can do a color lerp on the entity to change the color of the light itself.
The lights can also be triggered, much like the particles to be off or on. By setting the light_disable key in noxdrop, the light will be spanwed as off. When it is triggered, the light will activate. By default, the lights are on until that key is set. If they are on, the triggering will turn the light off
Only flag essential entities as lit. Lighting is computationally expensive. Only entities that you feel need to be lit should be marked as such in the entity.dat.
Keep the lights to a minimum. Only the single closest light is applied to the model. It's not that hard to change it to multiple light sources, but we also incur a major performance hit (essentially doubles the work for 2 lights, etc.). For now, I'm keeping it at a single source--either ambient or a light entity.
Right now I have it capped at 4 lights per PVS. I'm going to add a light # in the performance meter so you can gague your progress. Also, 4 lights is a tad oppressive, so I may max it to 16, but please, keep these lights to a minimum
Complain about this document to the wonderful author, Ralph Barbagallo