Lighting Basics

I was told I should post this… so here’s a little bit about the basics of using modern light utilities for Quake Mapping.

The only light compiler worth using these days is MH’s tweaked version of aguirre’s light.exe.  Aguirre’s utility added tons of great features giving a lot of control over lighting and MH managed to make it even better by adding in coloured lighting and more importantly, enabling multi-core processing.

The rest of this guide is aimed solely at this version of light.exe, so some or most may not apply if you do not wish to use this utility.

Some keys apply differently whether they are used on the worldspawn or a light entity, so first:

Light Entity Keys

‘light’

Sets the intensity of the light.
But, it is a little bit more than just that.  The light key value controls the intensity of the the light at the origin of the entity AS WELL as the radius.  So while, yes, you could use a value of 1000 for a big light, areas near the light will look almost pure white.

‘wait’

This was added to counter the above problem with overly high intensity lights.  Wait multiplies the decay rate of the light.  so 0.5 = twice the distance (half decay rate) while 2 is half the distance.

‘_color’

This is the R G B values (0 to 1).  If you are using a radiant editor (or qe3) you can directly use the color picker!  Choosing colours for your lighting would be a completely different article and beyond the scope of this one.  Just try to go easy on people’s eyes.

‘style’

Makes flickering lights and such.  The actual flickering is controlled from QC.  You can check out misc.qc, line 21 to see switchable lights and world.qc, line 297 which defines the stock light styles.  You can see they are strings, and the light values are from a to z, a being dark, z being bright.  You can make more lightstyles by picking a new number and creating a new string, then you set ‘style’ in the map editor to the number you chose.  NOTE however that switchable lights are set IN the light.exe at compile time and use values from 32-63, so don’t use those values for your lightstyles)).

Some points about flickering lights:

 

  • The quake engine only allows for 4 styles on a single face (and that normal non-flickering light counts as a style as well)
  • If you have too many different styled lights hitting a surface, you will see compiler warnings and visual artifacts, so be careful.
  • The lightstyle is global.  If you set two lights with style 13, but only trigger one of them, both lights will turn off.  This is why you do not set the style manually when making a switchable light, although this can be used if, for example, you wantto make a room with multiple lights that turn on at once.  Since if you normally made them switchable, this would overload the number of lightstyles per face, you can set them all to style 13 and target only a single light, causing all of them to turn on.
  • Light values that change during play are rough on the engine.  Even modern machines can stutter.  This goes up the more faces are hit by the light who’s style is changing.  Be careful.

‘delay’

Controls the attenuation formula.  here are the formulas:

  • 0           – Linear falloff, identical to id’s original light program.
  • 1            – Use the 1/x attenuation formula, has wider range than default.
  • 2            – Use the 1/(x*x) attenuation formula, faster falloff than delay 1.
  • 3            – No attenuation (light stays same brightness at any distance).
  • 4            – Local minlight (no attenuation, non-additive and minlight override).
  • 5            – Similar to 2 but with more attenuation and never brighter than “light” value.

I lot of people swear by delay 2, as it does produce a nice exponential light, but I dislike it because there is no cap on the intensity and you can end up with very bright pinpricks of light.
I personally use delay 5.  It has the same look as 2, but it is capped so there is never a danger of getting any intense centers of light.
Good values I use for generic lights:
light – 450
delay – 5
wait – 0.75 to 1.5 depending on how much or little I want the light’s radius to be.

Also of note is that delay 3 is additive whereas delay 4 is not.  I’ll talk about minlight in a bit.

‘_anglesense’

This changes how much a surface is illuminated based on the angle the light is hitting it.  In the real world, if you have a light shining on a surface from a very shallow angle, that surface does not light up much.  Likewise, if the light is shining on a perpendicular angle, then it lights the surface up a lot.

This behaviour is incorporated into the light utility and is the default behaviour.  The key defaults to a setting of 0.5.

Values lower than 0.5 increase the amount of light on shallow angles while higher values decrease it.  A value of 0.99 would make a light only illuminate a face if it was shining from a very steep angle.  On the flip side, you can flood an area with light by setting _anglesense to 0.1 as even from shallow angles, faces will be lit up.

Spotlights

There are two ways to make spot lights:

‘target’ -> ‘targetname’

The first (and original) way is to use a light and an info_null entity with a target->targetname pointing from the light to the info_null. (Note that info_nulls are removed by the light utility during compile, so do not use them for anything where they are required to be preset during play).

This is great if you have multiple lights that need to point to the same spot.

‘mangle’

This is the newer method to make spot lights.  It is an angle vector of the form:

'DIRECTION PITCH 0'
  • Direction is the same direction you see for ‘angle’ for monsters and such.  0 points off to the east, 90 is north, etc.
  • Pitch is 90 being straight up, -90 being straight down.  You can use greater or smaller numbers than that, but it’s kind of pointless.

This method favours multiple lights that point in the same direction, eg: multiple downward pointing spotlights on the ceiling.

‘angle’

ONLY when you make a light a spot light with the above two methods does the ‘angle’ (note the lack of s) key become active.
‘angle’ controls the width of the spotlight cone.
This is the total angle, so a value of 90 will be 45 degrees on either side of the axis.
Also interesting is you can make a spotlight with ‘angle’ of 180 to make a light that seems like a spherical one, but only casts on the one side.  useful if you need to make some kind of shadow effect or some-such and don’t want extra light bleeding over.

‘_softangle’

This gives more control over the spotlight.  Normally, without _softangle, the spot is uniformly bright over it’s radius (although it of course does decay over distance).  With ‘_softangle’, you can specify an angle value smaller than ‘angle’ where the light value will be scaled 100% from center of the spot to ‘_softangle’ then 100% down to 0% from ‘_softangle’ to ‘angle’.

 

Worldspawn Keys

‘light’

The great evil, this is the minlight value.  This simply raises the minimum value light can take.

For example, if you had a shadow from a single lightsource, but had a minlight set, that shadow would not be pitch black, but would instead be the value you set as the minlight.

I am not at all a fan of it as I do not think it is conducive to good lighting.  The worst thing you can do is add a minlight value to the worldspawn.  This blankets the entire map in that light value and makes everything look very boring as well as prevents you from making dramatic shadows.

You can try to use the delay 4 minlight setting on light entities.  This could potentially work, but still leaves a very flat looking lighting in the areas it is used in.  Try not to use it, instead, rely on groups of low level lights to fill in empty areas.  Using normal (but dim) lights creates more uneven final lighting, adding depth and texture to areas.

As a final point, if you are using delay 2 or 5 lights, their radius is actually quite large, but the light intensity at the farther reaches of the lights are very low, so they can also contribute to illumination a bit.

‘_shadowsense’

This affects how much shadows become darkened based on the angle they hit a face.  In some ways, it is similar to ‘_anglesense’.  It is ONLY useful if you have trisouped terrain or some other brushwork with many faces all with slightly different planes.
Here’s an example to illustrate the difference: http://celephais.net/board/view_thread.php?id=4&start=11737&end=11737

 

The best bet for understanding all these settings is to make a test map with varying values.  You really need to see what it’s doing, especially with things like _anglesense.

One important thing you should consider if you’re using styled lights is that the delay 1, 2 and 5 have very long radii where the light is very dim at the edges.  On it’s own, this isn’t anything to worry about.  The problem is that you can have a styled light casting onto a face far away with an intensity of 1 or lower which still counts as a lightstyle and can overload the maximum lightstyles on a face allowed.

You will want to use the command line argument “-gate 5.0” this just tells light to disregard any light info if the value falls below 5.  You will not see any difference, but it will be culling out the extreme range of your lights.

Sunlight

sunlight is set in the worldspawn with ‘_sunlight’ and ‘_sun_mangle’ and ‘_sunlight_color’

‘_sunlight’

The intensity of the sunlight.

‘_sun_mangle’

This has the same format as ‘mangle’ on spot lights, ‘Direction, Pitch, x’, which way the sun is shining. (Not the position the sun is in)

‘_sunlight_color’

Same format as color on normal lights, sets the colour of the sunlight.

further, you can use

‘_sunlight2’ and ‘_sunlight_color2’ to make a sort of outdoor minlight.  The light utility creates an array of minlight casting suns in a circle and sort of floods outdoor areas.

Setting the sun to a pale yellow colour and the sun2 to a greyish blue colour can yield very nice and natural looking sunlight/shadows.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: