Lighting

Lighting can be a daunting and time consuming task, but when finished can add real depth and feeling to a level.  There are 2 main types of lighting, being point lights and texture lights.  You should only use point lights in areas where the light must be able to be turned on and off.  In all other areas, the best way to achieve realistic looking results is to use texture lights.  The other types of lighting you can use are by using the sky texture, and a light_environment; by setting the minimum light level of a brush entity, although this technically isn't lighting; and by using another point entity, light_spot.

Point Lights

These are a point entity which you place in a level, and give out light in all directions.  You basically put them where you want them, and set their colour and brightness.  You can also specify whether or not they should be lit initially.  As I mentioned before, you should only really use them in areas where a light needs to me turned on and off.  To do this, you must give it a name and then target it with some kind of trigger ( ie a button or trigger_multiple or someother entity ).  When it is triggered it's state will be toggled, ie if it's off, it'll turn on and if it's on, it'll turn off.

Texture Lights

These are where you create a brush and cover one or more sides of it with an texture that looks like it should give out light.  It is possible for any texture to give out light though, so you don't have to stick to the ones that look like lights.  However, you should be aware that if you decide to set up a texture as a light, whenever you use that texture in your level, it will have the same colour and brightness in all the different places.  Once you have created your brush, and put on the texture you want, you then have two options to turn it into a light.  First of all, you will notice in your worldcraft folder a file called lights.rad.  This file contains the information that qrad ( or hlrad if you use that ) uses to work out which textures should give out light.  You can edit this file directly, or the second option is to create your own file which will override the values in lights.rad.  If you choose the second options, you must create a normal text file and save it with the .rad extension, in your worldcraft folder ( or wherever your compile tools are, if it's different ).  You then need to add the file to the command line for qrad ( or hlrad ).  To do this, just put "-lights <yourfile>.rad" in the commandline, without the speech marks.  Qrad ( or hlrad, ok if I mention qrad again, I am also referring to hlrad or any other program which you may have found that performs the radiosity calculations ) will then use your file and any textures in there will override the textures in lights.rad.  Whichever of the two methods you use, you now need to set up the file.  A line in the file might look something like this:

+0~LIGHT1 40 60 150 3000

The first bit is the name of the texture, so qrad knows which texture you are referring to.  The next 3 values are the colour of the light that should be given out.  The first of these is how much red it should be, the second is how much green and the third is how much blue, so you get a standard RGB value.  These figures should be between 0 and 255.  The final figure is how bright the light should be.  You will notice if you use point based lights that this value is much larger than the brightness of point based lights.  I'm not sure why this is, but if you set it to the same type of value as point based lights, it won't be nearly as bright as you want it to be.

Using the sky

To use the sky to light your level, you need to create a brush to act as the sky, and then make sure that ALL of it's faces are covered by the texture called 'sky'.  You then need to place a light_environment in your level.  This is a point based entity which needs to have a line of sight to any sky brushes that you want it to effect.  In this entity, you specify which angle you want the light to come from, and the pitch at which it should come.  To start with, I would suggest a pitch of about -40 to -60 as this tends to give good results, casting shadows behind the outside objects.  Also, play with the angle, to see which direction you want the light to come from.  You can drastically effect how the outside looks just by changing this.  The last value in here that you should be aware of is the brightness and colour, but these are straight forward enough.

The 'Minimum light' property

This property is used in entities where you want them to be a minimum light.  I find this most useful if I am creating something that will move, such as a tracktrain.  This way, you can create the entity 'outside' of your level, so that it doesn't cast any shadows inside your level while it is compiling.  This done, when you try to run your map, you would normally find that the train is completely black, but this is where the minimum light is used.  When you set this, you can light the entity without actually using lights.

light_spot

A light_spot entity can be used to create a good spotlight effect.  If you have placed a spotlight in your level, such as those in the yard in rock2, then you can use a light_spot as the light it gives out.  To use this entity, place it right in front of your spotlight brush.  You then need to specify where you want to point it towards.  If you already have an entity which you want the light to be pointed at, then specify the name of that entity in the target property in the light_spot.  If, however, you haven't yet got an entity there, create an info_target and give it a name for you to point at.  Now for the interesting bit in this entity.  The next property on the list is the 'inner (bright) angle'.  This, along with the next property, specify how wide the beam should be.  Set this to the angle of light you want coming out of the spotlight.  You can then specify how much more light you want on either side of this fading out to nothing with the 'outer (fading) angle'.  The pitch is how much it is pointing up and down. ( I don't know why you have to use this, but if you don't it won't point in exactly the right direction).  The brightness you know about, and you probably won't need to change any of the other values.  Again, as this is a point entity, you can switch it on and off, and also specify if you want it to be initially dark in the flags tab.

Well, I hope that this has given you an insight into how to use lights effectively in your level,

Az.

Back to tutorials...

© 2000-2001 TFX-Soft, all rights reserved