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.

Links:
List of commands and variables on Cube Engine 2: Sauerbraten
Tutorial by Hourences (not cube2-specific, but very interesting)

User login
Users on Quadropolis
2 guests & no users online
30
points ]
 (9 votes)
Created 2011-06-16 13:56
5 years 41 weeks ago
Created 2017-02-02 00:22
8 weeks 10 hours ago
74
points ]
 (9 votes)
Created 2012-07-01 13:12
4 years 38 weeks ago
Flitzpiepe
Created 2017-01-28 22:59
8 weeks 4 days ago
214
points ]
 (22 votes)
Created 2012-10-20 09:56
4 years 23 weeks ago
AtlasSteal
23
points ]
 (3 votes)
Created 2016-12-27 04:35
13 weeks 2 days ago
theradical
Created 2016-12-26 16:25
13 weeks 2 days ago
theradical
11
points ]
 (2 votes)
Created 2016-12-20 14:15
14 weeks 1 day ago
20
points ]
 (3 votes)
Created 2010-03-04 23:30
7 years 3 weeks ago
KATZ_2142
13
points ]
 (2 votes)
Created 2016-09-06 23:34
29 weeks 1 day ago
50
points ]
 (5 votes)
Created 2010-02-18 22:58
7 years 5 weeks ago
DeathStarPC
Created 2016-10-09 12:48
24 weeks 3 days ago
Created 2016-05-10 23:14
46 weeks 1 day ago
Created 2016-07-28 12:06
34 weeks 6 days ago
7
points ]
 (1 vote)
Created 2016-08-19 06:04
31 weeks 6 days ago
92
points ]
 (10 votes)
Created 2010-06-23 21:33
6 years 40 weeks ago
Fatality
50
points ]
 (6 votes)
Created 2014-05-14 01:01
2 years 45 weeks ago
Pyccna
31
points ]
 (4 votes)
Created 2015-09-22 23:19
1 year 27 weeks ago
Fatality
86
points ]
 (10 votes)
Created 2014-09-03 23:36
2 years 29 weeks ago
19
points ]
 (2 votes)
Created 2016-05-19 23:35
44 weeks 6 days ago
Who's new
  • Flitzpiepe
  • M16
  • theradical
  • torben
  • KATZ_2142