Mapping manual/Advanced lighting

< Mapping manual

370pages on
this wiki

After learning the technical concepts on lighting, it's time to put this to practice. Here we're going to see practical examples of lighting, and tips about lighting itself and where to better place it.

Lighting sources Edit

For the purpose of these tips, here's a definition of a light source:[1]

"Light sources can be anything: small or large lamps hanging on walls or from ceilings, the moon or the sun, crystals, lasers and other type of high tech beams, fire, mirrors, magical effects, water surfaces that bounce back light, lava or radioactive slime and so on. Everything is possible as long as there is a noticeable source."

The most basic rule about lighting is that every light must have a source, and that every light must appear to be cast from that source as well. Also, the lighting a source casts must be balanced with both the size and the brightness of the source. Big light sources are going to illuminate more areas and their area look brighter than small light sources. This should be reflected on the map as well.

The key is the use and positioning of your light sources, whether that be, shader or entity in origin. Try to shine light through interestingly shaped geometry, where it can be cast on to an appropriate surface. After this, increase the resolution of the affected geometry's lightmap. Select the geometry, ungroup it if patch groups are chosen, then assign this geometry the func_group entity. Bring up the entity editing window then add the key "_lightmapscale", with a value less than 1. 0.125 is very Hi Res. Be aware that many Hi Res lightmaps will bump up the size of your .bsp considerably.[2] Also, place the light entities closer to the brighter lights and with strong "light" values.

Lighting colors Edit

The most complex rule of lighting is that colored lighting is a must and absolute requirement in almost every situation. Colors can make or break a composition; they shape the atmosphere and emotions associated with an area and they simply make environments more interesting and lively to look at. Most light sources in the world cast lighting that, in one way or another, have color. Therefore it isn't very realistic to place white lighting in the environment.[1]

Due to the way the OA engine works, it is possible to relay on shaders in order to get the level lit, but 90% of the time, this isn't enough. One must color the lights oneself instead of relying on how the atmosphere or materials might enhance the lighting. If color isn't added, the result will be very bland and fake.

Another aspect of lighting is the light temperature. There's a theory that says light is energy and the stronger the light the more energy it has and thus the warmer it is. The temperature influences the strength. 1600K is sunset and sunrise and 1800K is a candle. 2800K is a regular light, 5000K is midday sun and so on. Thus the chance that the light in the game environment would cast pure white lighting is rather small.

Also, red is actually colder than blue. Arc welding or lightning are blue because they're hotter and stronger compared to weak, regular, orange fire. Blue is only warmer than red in a scientific perspective. Emotionally, on the other hand, red probably feels warmer than blue. Common color associations are at the base of that feeling. When something is hot it will glow red while cold things like water and ice are blue. They influence our perspective toward colors. These are very powerful clichés.

Another reason to use colors is the composition. In fact one color is not enough most of the time; at least two colors are needed or else creating contrast will be impossible. If only one lighting color is used, that very important color contrast is lost and the result would again be very bland.

Targeting lights Edit

Sometimes it may be necessary or desirable to have the light source some distance from the area where you require the light to fall. This 'spot light' effect can be achieved by targeting a light entity at a target_position or an info_null entity.[3][4]

  • Create the light source with one or more brushes.
  • Place the light near the source you have chosen.
  • Add an info_null or info_notnull where the light should be pointed.
  • Move the info_null/info_notnull where you want the light to shine.
  • Connect the light and the info_null/info_notnull.

Unfortunately GTK can not show lighting effect in real time, so it is necessary to compile the map in order to observe the effect you have created. Sometimes it may take 3 or 4 attempts to achieve the result you want, adjusting the strength of the light source and the distance and angle from the info_null.

Light beams Edit

Beams are a pretty neat effect and many OA maps use it. This is what you need to do:[5]

  • Create a brush with the same size as the light texture.
  • Place this new brush below the light texture.
  • Extend this brush on the Z axis.
  • Make this brush a cylinder.
  • Search for a beam texture in the Textures menu and apply it to this cylinder. The beam textures are listed in the texture sets appendix.
  • Open the patch inspector and hit the fit key.
  • Rotate the cylinder by hitting the x button or the y button until it's done.

An alternative way is to use a brush:

  • Create a brush with the same size as the light texture.
  • Place this new brush below the light texture.
  • Extend this brush on the Z axis.
  • Apply this brush the common/noclip texture.
  • Select the lateral faces and apply it the beam texture.
  • Open the texture inspector and hit the fit key.
  • Rotate the texture by hitting the x button or the y button until it's done.

Light styles Edit

Although the OA engine doesn't allow the use of real time or dynamic lighting, thanks t Q3Map2 it's possible to "fake it" by using shader tricks. That can be used for simple flickering/blinking lights like torches. Just be careful in the use of dynamic lighting, as with all shaders, overuse impacts upon performance in terms of a loss of framerate. Also, any surface must not receive light from any more than 4 dynamic light sources.[3]

  • Create a light entity.
  • Open its properties and add the key _style with a value between 1 and 13. Some experimentation is required to achieve the look that is required.

When the map is compiled Q3map2 generates a custom shader and texture folder, used in game to achieve the flickering light and shadow effects. The texture folder, which will have the same name as the map, is placed automatically in the maps folder and the shader, named q3map2_mymapname.shader, is placed in the scripts folder. Both the texture folder and the shader must be included in the .pk3 for distribution, just like other custom map content. Each time the level is compiled the texture folder and shader are updated, so be careful to include the current versions of the textures and shader with the compiled map.

Lightstyles page in q3map2 shader manual explains "lightstyles" with some differences from what's reported here: it does not mention the automatic creation of texture and shader files, it mentions "style" instead of "_style" key (who knows if they are just aliases or they do something different?), it does mention max 3 lights per surface instead of 4, and it does explain how to customize the styles (and mentions styles from 1 to 31 instead of 1 to 13). Some real testing and then updating this page would be welcome.

Lighting tips Edit

  • Bots don't use light information. In a pitch-black room, they would still see an opponent. Keep that in mind when designing your maps.[6]
  • Use coloured lights with care, to emphasis light emitted from flame for example, but let subtlety be your guide.[7]
  • For models, check the mapmodels page.
  • For brushes and patches to get a better lightmap, group them into func_group entities and use the key-value pair "_lightmapscale" "0.125".
  • OA isn't that good at rendering curved shadows or angled shadows. You can end up with ugly jagged shadows if the light is emitted from or hits geometry at certain angles. Changing light sources can help, also making affected geometry into func_group entities and assigning the keys "_rc" or "_cs" with a value of 0 is a useful trick. The "_rc" key prevents shadows being cast on to geometry, and "_cs" prevents it from casting shadows.[2]
  • The proper use of light-emitting textures like skies and lava add real moody light. And it's a lot easier to do than tons of light entities.[8]

See alsoEdit

Notes Edit

  1. 1.0 1.1 Lighting in game environments by Hourences
  2. 2.0 2.1 LevelDK 4: lighting and curves
  3. 3.0 3.1 LevelDK 6: faking dynamic lighting
  4. Target a light
  5. Light Beams
  6. GTKR manual Lights and lighting
  7. LevelDK 3: adding lights
  8. Shader Lights

External Links Edit

<< Previous (Lighting) Mapping manual (Weapon and item placement) Next >>

OpenArena's Mapping manual
Prologue /// Pre-mapping stage - Map gameplay /// Choosing an editor /// Your first map
Brush manipulation - 2D/3D clipping /// Curve manipulation /// Textures /// Introduction to Entities
Lighting - Advanced lighting /// Weapon/Item placement /// Triggers and movers - Dynamic features
Shaders /// Terrains and liquids /// Mapmodels /// Sounds /// Gametype support
Optimization and Troubleshooting - Hint brushes - Bot play - Troubleshooting
Final touches /// Compilation & packaging
Glossary of terms - Advanced features - Modelling a map - Editor differences - Default assets (Textures/Models/Sounds) - GPL

Around Wikia's network

Random Wiki