Lighting is one the most important parts in mapping for Cube 2. This article is directed to new mappers, who are not yet familiar with the very basic aspects of lighting. Most of it should apply for other Cube-Engine-based games (the default keys may differ, though).
First I will introduce some basic commands, then I will explain the most important general light settings of a map. The following part deals with the usages of light entities. The last part contains some thoughts about the lighting-tab of the ingame menu.
The are way more commands and features which are involved within the lighting of a map, but I'll come to that later.
/calclight -1/0/1 - This command applies the changes you made to your map. The default key bind while editing in cube2 is "K" set at 0 (as the detail of calculation).
/fullbright 0/1 - This command toggles between a lit and an unlit view of your map. The default key bind while editing in cube2 is "L".
To light up your map in an appealing way it is very important to set the following values the right way, because they determine the overall feel and atmosphere.
When you have decided, what theme your map should have, you should choose a matching skybox. The easiest way is the ingame menu (esc/editing/skybox). Then you should set the following commands in a way that matches the theme and the skybox.
Red skylight coming from a blue skybox or an intense skylight coming from a dark, nightly skybox do not make sense. Having a skybox that displays a sun, but setting no sunlight will make your map look strange, too.
/ambient R G B
This value determines, how much and what kind of light the textures in your map emit. You can enter a value of 0-255 for each color (R = red, G = green, B = blue). "/ambient 0 0 0" will result in total darkness, while "/ambient 255 0 0" will give your textures an intense red touch. I myself prefer low ambient values, since this is the key to create contrast.
You will only see the effects of ambient, if one of the following settings is set or if you already have created a light entity.
/skylight R G B
This value determines, how much light the skybox of your map emits. You can enter a value of 0-255 for each color (R = red, G = green, B = blue).
/sunlight R G B
This value determines, what kind of light will be emitted from the direction of the sun in your skybox. You can enter a value of 0-255 for each color (R = red, G = green, B = blue).
This command determines the direction, where the sunlight should come from. Just stand somewhere in your map, aim your crosshair directly at the sun and execute the command. It's useful to aim at the sun over an edge of a building, to estimate, what shadows the sunlight will produce at its current position. The following values will be displayed at the console:
You can adjust the horizontal position of the sunlight with this command.
You can adjust the vertical position of the sunlight with this command.
This commands rotates the skybox. It's very useful, if your skybox has a sun. You can rotate and put it where ever you want using this command. It does not affect the lighting technically, but it does in appearance.
To see the effects of the skylight and the sunlight, it is useful to temporarily set "/ambient" to a very low value. That way you can see the shadows very well due to the high contrast. It's also interesting to choose some extreme colour values as an experiment, just to get an idea of the results of those commands.
If these settings are set, there will still be some dark areas like caves, closed rooms e.g. To light these up, you will have to set light entities.
/newent light X R G B
This is how you create a new light entity. The X-value determines the radius. You can enter a value of 0-255 for each color (R = red, G = green, B = blue).
This command can help you to align your light entities properly. Set to 1, you can drag your entities aligned to the grid. The standard key bind while editing in cube2 is "6".
Now, that you have made a light entity, it still needs a source, since it looks stupid, if light appears just out of nowhere. A light source can be a mapmodel (a torch e.g.), a particle (fire) or a texture (lamps, computer-desks e.g.) - anything, that would emit light.
It is very important, that the entity and the source match: a big source should emit much light, a small one should emit just a little bit of light. A red source should emit red light, a green source should emit green light etc. Generally, there shalt not be light sources without light entities and vice versa.
To make light sources look glowing, it is often a good idea to put one or more entities with a smaller radius right next to the source and another entity with a bigger radius (that lights up the room) in a bigger distance to the source.
/vshaderparam glowcolor R G B
This command lets you change the colour of many lamp-/light-textures. You can enter a value of 0.0-1.0 for each color (R = red, G = green, B = blue). Just select the face/texture you want to colour and then enter the value.
Speaking of colors:
Plain white light almost aways looks unrealistic and boring.
It is often better to give the light a slightly orange/yellow (warm feel) or blue (cold feel) touch. Lighting up the map with only one colour is boring, too. Next to the basic lighting tone, there should be a second, contrasting colour. I think the map nucleus (orange basic tone, some green contrasting lights at the computer desks) is a good example. Also the map complex has some blue, contrasting spots, which I think is a good solution.
Do not overdo it, though: choosing more than 2 or 3 different colours will in most cases result in some noisy disco lighting-style.
In most of the cases there is no need to touch the variables "lighterror" and "lightprecision". Just leave it, as it is. Those are only needed, if you like very hard, precise shadows or if you need to fix lighting errors in your map. But be aware: Lowering these values will drastically increase the filesize of your map.
There is a lot more to learn about lighting, such as spotlights, fog, watercolour, shaders and a lot of other commands/variables. And the described way is definitely not the only way to light up a map nicely, but if you focus on this way for the beginning, you are heading the right direction.
As a last thought keep in mind, that the technical knowledge about values, variables and commands is not everything and will not automatically lead to success. You need creativity and ideas also, but that cannot be described in a guide like this.
List of commands and variables on Cube Engine 2: Sauerbraten
Tutorial by Hourences (not cube2-specific, but very interesting)