rabe | 2014-04-26 18:05
Basic Lighting Guide

The Basics of Lighting

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.

I. Basic commands

1. /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).
2. /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".

II. General light settings

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.

1. /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.

2. /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).

3.a) /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).

3.b) /getsundir
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:

3.c) /sunlightyaw Y
You can adjust the horizontal position of the sunlight with this command.

3.d) sunlightpitch X
You can adjust the vertical position of the sunlight with this command.

3.e.) /yawsky 0-360
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.

III. Light entities

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.

1. /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).

2. /entselsnap 0/1
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.

3. /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.

IV. The Ingame Menu

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.

V. Other Stuff

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)

User login
Users on Quadropolis
1 guest & no users online
Created 2024-06-02 22:13
3 weeks 3 days ago
Created 2024-06-02 14:26
3 weeks 3 days ago
Created 2024-04-11 22:25
10 weeks 6 days ago
points ]
 (4 votes)
Created 2010-05-30 10:00
14 years 4 weeks ago
points ]
 (4 votes)
Created 2020-10-22 00:50
3 years 35 weeks ago
points ]
 (1 vote)
Created 2024-02-11 21:20
19 weeks 3 days ago
points ]
 (1 vote)
Created 2023-07-23 20:02
48 weeks 3 days ago
points ]
 (4 votes)
Created 2020-12-10 12:49
3 years 28 weeks ago
Created 2023-12-12 23:34
28 weeks 1 day ago
Created 2023-11-27 23:00
30 weeks 2 days ago
points ]
 (2 votes)
Created 2023-10-01 15:21
38 weeks 3 days ago
points ]
 (2 votes)
Created 2021-05-24 00:01
3 years 5 weeks ago
points ]
 (1 vote)
Created 2023-06-13 17:54
1 year 2 weeks ago
points ]
 (3 votes)
Created 2023-05-05 20:58
1 year 7 weeks ago
points ]
 (2 votes)
Created 2023-03-02 01:40
1 year 16 weeks ago
Created 2023-01-29 23:27
1 year 21 weeks ago
Created 2023-01-19 19:36
1 year 22 weeks ago
Created 2023-01-10 17:10
1 year 24 weeks ago
Created 2023-01-01 14:30
1 year 25 weeks ago
points ]
 (1 vote)
Created 2023-01-01 10:58
1 year 25 weeks ago
Who's new
  • ColdIV
  • Aidan
  • Hunk
  • letic86