|
The
Road to Enlightenment? |
|||
|
|
In the beginning there was nothing.
This document is in many ways a followup to my RTL lighting demo, so you should probably start by looking at that. It does smooth pixel-level lighting in a 320x200 VGA mode, but I've been thinking about various other possible approaches, and ways to do similar things in higher resolutions or with more colors. In particular I spent most of today wandering around Croydon looking for a new flat (my current lease expires next month), and in between peering at an assortment of dingy and decrepit basements that were invariably described by the landlords as "nice attractive studio flats", I had a number of programming ideas which I think are worth describing here.
There are basically two approaches to realtime lighting. Either the lights are part of the environment and illuminate the player sprites as they move around, or the lights are part of the gameplay (carried by players, triggered by explosions, etc) and they light up the environment. Of course you can mix both methods in a single game, but it is generally better to concentrate on one or the other. Remember that you can't have a light without some dark as well. If you have a well-lit environment to start with, there is very little point in giving your player a torch, and those lovely illuminated areas around your explosions are at best going to look rather weedy. Conversely, if you have lots of lights being triggered by actions within the game, you probably want to keep the basic level very dark to get the maximum benefit out of them. If you want to take this approach, the important thing is that the background lights (drawn by the artist) must match up exactly with the programmed lights used for the character sprites. Nothing would look worse than a character stepping out of the shadows into a floodlit area, and then the graphic only turning from black to normal colors a few pixels later :-) You will probably need a decent editing tool and a lot of patience to position all the lights correctly, and this will be much easier if you stick to soft-edged illumination rather than any really sharp bright/dark contrasts. Also consider that if your lights are all coming from static parts of the environment, you mustn't trigger any major lightsources as part of the game itself. It would look great to have a swordfight in a dungeon, with the players moving in and out of the torchlit areas, but it would look really silly if one of them then set off a grenade in the shadows, causing a huge explosion but not changing the environment lights at all... |
||
|
|