Quake II Evolved Per Pixel Lighting Tutorial

Adding A Center Field To Your 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 does the "center" field do?

First of all, I presume you had read Tutorial 1 on standard lights? If not, go do so now because this tutorial will borrow heavily from it.

Ok, what does the center field really do? If you recall, making a light required that you provide not only an "origin", but also a "radius". The "radius" is in X Y Z values, and controls the width, height and depth of a light. Pretty basic stuff. Well, "center" expands upon this. If you think about it, what you are really doing is creating a volume for your light, an area for it to light up. You may think this stops when it hits a wall and just doesn't draw, but unfortuntaly, that's not true. It will still hurt performance if your crossing to many lights behind the wall, even if you will never see it. So what can we do about this?

The answer is simple really, we provide a center origin. This field controls an "offset" from the light, which means we can make a light come from a location, light up how we want, but behind the light (or wall) will not contain any information at all. This can help increase performance in most cases, if not all.

Adding Lights With A Center Field To Your Level

Ok, rewind back to how we added lights to our level, by adding a light_point and changing its values by using the Entities window inside GTK Radiant? Well, bring the old Entities window back up and add a new field. Call this key "center" and for the moment, give it a value of 0 0 0. This has now created a center light, however because we have not provided an offset, it will look exactly the same as a standard light at the moment. Now, this is where it gets tricky. In Doom 3, users can simply modify the light in real time and select where they want the center origin to be. Fantastic, so easy! But... This... Isn't... Doom 3... So, its a complete bitch to do. What you have to do, is quite simple in theory, but putting it into practise requires a little skill. So, lets do this step by step shall we?

Great, you have your light we just made, and it has a blank center value origin. It should look something like this:

Ok, what we now need to do, is take the light (green box) and move it to the "middle" of the area we want lit. So, lets say we want this light to light up to the opposite wall. We move it to the center, like so:

Ok, now stop. Think about this. If we leave this light as is, its going to light up the area but the light will be coming from the center of the room, which is clearly wrong. What we need to do, is provide a "center" for the light, an origin for the light to come from (Yeah, just clicked in your head didn't it, duh :p). So, what we now need to do is quite tricky. You DO NOT take the "origin" of the light source as shown in the editor, otherwise this will be wrong. Instead, what you need to do is a slight hack.

Select both your light source brush, and your light. Now, drag them both so that the point_light is EXACTLY on the 0,0,0 origin of the GTK grid. Now then, de-select both of these by presing ESC, then select your point_light and press SPACE to copy it. Move this NEW point_light and place it exactly on the light source (The brush is the light source). Ok, now open its entity properties by pressing E and look for the "origin" field. Copy the value here, and then close the Entities window. Delete the point_light file we just made, not the original, and then select the ORIGINAL point_light file. Open its entity properties by pressing E again and edit the "center" value, by pasting the value that we just took from the other one. Ok, now that we have our origin and center field, we should move both our light source brush and poin_light back to where it was on the first place... And we are done. Yeah... Long winded or what? The reason it has to be done like this is because the center light need a origin for the light to come from, but its not in relation to world space, more so the actual light.

And breath...

Ok, you should have a working light now with a center field. It may take a bit of tweaking to get the light looking the same as before, but the great thing about center lights is that its a MASSIVE jump in performance because it wont render useless rubbish it doesn't need to. Another great advantage of center lights is that when you disable shadows, it wont look messed up. The only thing left now is to save your map, and open the .map file and copy the data into a txt file like we did previously. And that's it, done!

Here is a .pk2 file with an example map. Simply type map tut_2 in the console.

That about wraps up our tutorial on center fields. 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.