Lightmaps - on, off and flickering

Blitz3D Forums/Blitz3D Programming/Lightmaps - on, off and flickering

Yes, you would use one main lightmap for all lights which always stay on, and one lightmap for each dynamic light.

Then you would blend the dynamic lights with the main lightmap by either applying the dynamic map to the second texture channel with the texture set to add blend, or by making copies of only those polygons which are affected by the dynamic light, and texturing those with a multiply blend texture, but setting the copied entity itself to add blend.

If you're going to have a dynamic light, then there's a ton of effects you can do at little or no additional cost.

Render the lightmap as if the light were white, and you can change the entity color to dynamically set the color of the light. Adjust the brightness of said color, and you can make the light flicker.

Create a second set of UV coordinates for all the geopmetry using a spherical projection from the light, and you can apply a multiply texture as the second texture, setting it to use this second set of UV coordinates, and you can then make your light cast diffrent colors in different directions, or make the light into a spotlight which you can change the angle of... You could make a police light which is red one one side, and blue on the other and make it rotate. Or you could make a disco ball effect with little points of light and spin it around the horizontal axis.

You do this by using the texture position command to change it's U location. You don't want to change the V location though because of how spherical mapping works. It won't look right. But if you change how you apply the sphericla map you can make it so you can move vertically but not horizontally.