Quake II Evolved Per Pixel Lighting Tutorial

Standard Lights

For this tutorial you will need the following:

>> A full copy of Quake 2, complete with the latest official patch

>> Quake II Evolved version 0.65 Beta

>> A popular level editor compatible with Quake 2 (GTK Radiant 1.3 etc)

Ok then, lets begin with a little information shall we?

What is a Standard Light?

Standard lights are simple light entities that when placed inside a map, will light up the surrounding area. They contain numerous variables that when changed, will change how the light acts in a level. Lets take a look at a sample point_light:

{
radius 300 100 200
origin 256 64 64
color 1 1 1
classname light_point
shader lights/light1
}

Ok, the above is what an entry for a standard light would look like. Its all pretty straight forward, but I'll explain anyways. Radius is the size of the light. The three variables are in X Y and Z form. As you can imagine, these control the overall volume of the light. Changing these values is as simple as entering a higher or lower number. Origin controls the destination of the light inside the map. This again is in X Y and Z form. This one can be a bit tricky to get right, but following my tutorial below we have a few neat tricks you can do to get the light exactly where you need it. Color does exactly what it says. Working in standard Red Green and Blue values, you can control the overall color of the light here. Classname remains unchanged, this is just to let the engine know that it is indeed a light. Finally, Shader controls the appearance of the light. You may need a light that blinks fastly, or one thats an odd shape. You can do this easily, by pointing at a unique shader name and then maniplutating the shader like you would a standard texture. The default shader to use when making a light is:

lights/q2e1_1
{
{
zeroClamp
map lights/light.tga
colored
}
}

Right then, lets get on with sticking one of these in a map and lighting it up!

 

Adding lights to your level

Remember I said before you needed a copy of a level editor? Well, its not VITAL, but it does save a huge headache. Open up your copy of GTK, and load up your .map file. You should have a pretty empty map in front of you. If your map contains entities everywhere (Which, lets face it, if you de-compile the original baseq2 maps, they will) then press ALT+1 to remove all brushwork from the level. This will leave you with everything BUT basic brushwork. Select everything you can see, everything. Delete the lot, we don't need that cluttering our view. All it really is, is past lighting info and enemy stuff anyway. Right, press ALT+1 again to bring up your brush work. You should be looking at a empty shell of a map, no entity info, just brushwork. Fantastic. Save that map as MAPNAME_ppl.map, and lets begin...

Ok, lets start simple. Go to where the player starts in your selected level (or anywhere you like), and find the nearest actual light source. (Its not needed to place lights next to actual light sources, Quake 2 had them all over the place for example. But it does look a lot more realistic if your shadows and normals come from the right place). Once you find a light source, right click near it and select "light" from the drop down menu. Don't worry about the strength of this light as yet, we will change that, so just select anything. Now, with this light selected, press "N". A window like this should pop up:

Its time we did a few changes. Start by clicking the "light 300" line, and then clicking the "Del Key/Pair" button. This will delete the entry. Next, click on the "classname light" line. Notice that in the "key" and "value" boxes, appear "classname" and "light". What we need to do, is change this from "light" to "light_point". So edit the "value" line, and press enter. Close this window. Your light from before should change to a small green square box. Don't worry, that's how its supposed to look :p What you now want to do, is position this small green box right next to your light source in the level, dead center. For example:

You have now set up your entity as an actual light, and to be cast from an actual light source. Not hard, was it? :p Now then, lets tweak the other settings.

Select your green box again, and press "N" once more. Click in the "Key" box, and type "color" then click in the "value" box and type "1 1 1". Press enter. If you want to change the color, you simply change the values here (The same way we changed "light" to "point_light" before). We now have a white color light. Click on the "key" line once more, and type in "radius", then click on the "value" line and type in "50 50 50". Press enter. This will change your light volume size. This can be tweaked whenever you feel like it, again, by editing from this window. Close this window, and save your map. Woo!

Right, now its time to do something different. Locate where you saved your .map file (should be under baseq2/maps) and in there, create a .txt file with the same mapname as the map you are trying to relight. For example, base1.txt. Open this up, and minimise it. Next, locate the map file we have just been lighting, and open it with wordpad. Yeah, its all just text and numbers. Technology huh? :p Scroll right down to the bottom, because the top is filled with brush info. Scroll all the way down until you reach something that looks like:

//Entity 1

{
"radius" "50 50 50"
"origin" "256 64 64"
"color" "1 1 1"
"classname" "light_point"
}

Ok, now for the science. Copy the above from your .map file, and paste it into your .txt file we just made. Then, go to Edit>Replace and a little window will pop up. In the "Find What" section type ", and in the "Replace With" section, leave it blank. Then click "Replace All". This will remove all the "'s from the file. You can do it by hand but this way is instant :p Save your file. We are nearly done.

Right, open up Quake II Evolved, and load the map we are trying to light. Locate the area we just re-lit, and it *should* be lit up. You may find that the light is too small, but don't worry about that. Simply tweak the X Y and Z fields on "radius" and you can change the size no problem.

That's pretty much how to make a light work. But there is one thing I haven't explained. "Light Shaders". Light shaders are an optional feature that will allow you to manipulate the light like you would a texture. Simple add a "shader" "blah/blah" field like we did all the others in GTK, and then create a shader for it. Its that simple.

Here is a .pk2 file with example maps for both. Simply type map tut_1 or map tut_1_adv in the console.

That about wraps up our tutorial on Standard Lights. If you have any questions please post them in our forums.

 

 

The Blur Logo and website ©2002-2004 Team Blur - All rights reserved. Reproduction of any material on this site without a working link to its original location is prohibited.