Lightmaps - on, off and flickering

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

Caff(Posted 2003) [#1]
I'm building 3d worlds using a mixture of packages. I'm using pre-rendered lightmaps. However, I'd also like some way of creating a 'flickering' effect on the walls. Also for turning lights on / off by a lightswitch. As the lightmap is applied with fullbright, how could I go about doing this? Would I need two or more lightmaps and then apply as necessary?

Obviously as lightmaps aren't small things, I've thought as I write this the best way would be to have seperate meshes for the parts of the map where the lightining needs to be modified independantly of the rest of the level.


Mustang(Posted 2003) [#2]
I've thought as I write this the best way would be to have seperate meshes for the parts of the map where the lightining needs to be modified independantly of the rest of the level.


I'm going to use this method... it's easier to switch geometry chunks (with mapped maps) than fiddle with lightmaps themselves IMO. There is slight geometry overhead / duplication of course with this method, but it is not that bad, I think.


Robert(Posted 2003) [#3]
Lightmaps are normally 1024x1024 maximum size, so surely if you preloaded a series of them, there wouldn't be a big delay switching between them?


sswift(Posted 2003) [#4]
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.