Calculating Global Coordinates
by Fluen

This tutorial is a thorough and in-depth explanation on the global coordinates of the level editor - partly meant as a reference. However, if you are only interested in how to use the lens flare, you may safely skim through this tutorial as you only need a cursory overview of this information to make a fairly nice lens flare - just go to the last part of this tutorial, where I have made the 'recipe' for calculation of the coordinates (written in red).

I will explain all I have discovered about the LensFlare-command in the tutorial:

How to set up a Global Lens Flare

Global coordinates and how to calculate them

Look at the coordinates shown when FlyCheat is enabled and F1 is pressed:

Thanks to some fortunate coincidences involving a cramped room with blocks to climb, a fixed camera, a target nullmesh and Lara fooling around in a jeep (but not all of it at the same time), I discovered, that the line:
p aaaaa,-bbbb,ccccc is the set of coordinates for the camera, while
t ddddd,-eeee,fffff is the set of coordinates for the camera target (usually Lara) and
r gg is the room number (but I guess most of us knew that already).
(That would explain the letters: p = point of view, t = target and r = room.)

I suspect that Lara's heart or something close by is the centre of her coordinates. Hold F1 while she sits in the jeep and notice that when she changes gear from forwards to backwards, the middle coordinate 'decreases' (the negative number becomes a bit smaller). So the centre of her coordinates must be a part of her which moves during this process.

There is room for one hundred blocks in either direction in the global editor room. 
Some block climbing showed, that a block is 1024 * 1024 in global coordinates. And finally one click is 256 - four clicks are 1024, so the raised block has the same dimensions on all sides.
Be aware that height is negative upwards: If you raise a block four clicks from zero level, the height coordinate goes from 0 to -1024.

I'll use the coordinate description as shown below:

Just to add to the confusion, there is a non usable zone one block wide all around the edge of the level editor window. Try to place a room in one of the corners and you will notice that you can't get your room all the way out to the edge.

When you place a room as far upwards and left as possible and then click the upper- and leftmost block in that room, the (X, Y)-data for that block will say 'Selected Block [ X:0 Y:0 ]'.
But the global coordinates start counting from the edge of the editor window, so the non usable zone counts for the first 1024 in both the X- and the Y-direction and the global coordinates for the block with the editor-coordinates X = 0, Y = 0 (the one you clicked) will be Xglobal= 1024, Yglobal = 1024.

It also means that the X- and Y-coordinates in the level editor window go up to 104448 (100 blocks plus 2 unusable blocks - all multiplied with 1024).

Here is an example taken from the Playable Tutorial Level on how to calculate the global coordinates for a specific block:
I chose this Room:

And in there I highlight a block:

The red 'square' accentuates the coordinates for this particular block. The first piece of information is general for the Mid Room: 'Floor: -16 Ceiling: -8' and it uses clicks.

This is the first challenge! This data always gives you the lowest level of the floor and the highest level of the roof in the chosen room. Try to lower just one block in a room with a levelled floor (use the fresh room the editor always presents when opened) and you will see that the 'Floor:'-information lowers with this one block even though the rest of the floor stays in one place.

The same is the case for the roof. If you raise just one block in the roof, the 'Roof:'-information will raise with it.

I have made things easy for myself by picking a block which is level with the lowest part of the floor. So I already know that its height is -8 clicks. If I needed to know the click-height of another block, I would have to either raise another block from the floor or lower one from the roof and count the clicks until it had the same height as the block I was examining.

Ok, each click is 256 in global coordinates. This block is below zero level so it has a positive value. All I have to do is to multiply 256 with 8 (forget about the negative sign):
Zglobal = 8 * 256 = 2048

Assuming the height for the above block had been above zero, say +11, I would have done the same calculation:
Zglobal = 11 * 256 = 2816 and because it would be above zero level I would put a negative sign in front of it, so +11 clicks are -2816 in global coordinates.
When I do height calculations I only work with the numerical value (the number itself) and add the negative sign afterwards if the block is above zero level.

Now the X- and Y-coordinates:
They are read directly from 'Selected Block [ X:72 Y:31 ]'. But I have to add one (1) to either number because of the non usable zone around the rim of the level area before I can multiply each with 1024.
Xglobal = (72 + 1) * 1024 = 73 * 1024 = 74752
Yglobal = (31 + 1) * 1024 = 32 * 1024 = 32768

The general rule is then:
Xglobal = (X-coordinate from the editor + 1) * 1024
Yglobal = (Y- coordinate from the editor + 1) * 1024
Zglobal = height in clicks (must be examined closer and forget about any negative sign) * 256, and add a negative sign to the final value, if the height is above zero level

Normally, you don't have to use such precision when you work with the lens flare. The command for the lens flare used in Coastal Ruins from Tomb Raider 4 is:
LensFlare = 250000, -32000, 110000, 128, 96, 0 - not very precise, right?
So the exact coordinates are only necessary if it is important for you to be able to see the lens flare in a very specific place. The picture below shows that I wanted it to appear at the same level as the road Lara is driving along. With the road being only three blocks wide, precision is needed.

This leads to the exact order of the coordinates and I must say that it is the strangest coordinate system I have ever encountered. There must have been a compelling reason for this coordinate system when the Tomb Raider Editor was designed (or a wicked devil doing the program design).

The coordinates for the LensFlare-command are:
LensFlare = Y,Z,X,red,green,blue - no wonder, it's confusing!
The same order is used for the coordinates you get when you use F1:
p yyyyy,-zzzzz,xxxxx
t yyyyy,-zzzzz,xxxxx
r nn (= no.)

As an example I suggest you start TRLE and let Lara stay on one spot while you hold F1. If she crouches, the only coordinates that change are the middle coordinates in the p- and the t-line, because Lara only changes her position in height (the t-line) and so the camera aims lower to follow her (the p-line). Remember, Z is height.

Next, climb onto a block so Lara faces exactly north (you know her orientation is right, when you enter the inventory and the compass needle is transparent - it is the red compass needle that must point north). Hold F1 and let Lara roll and notice that the first coordinates in the p- and the t-line stay calm, while the others go crazy.

The real compass directions

Here I have to add something about compass directions. The manual that comes with the level editor says that the upward edge of the editor window is north. That is wrong!

The real compass directions as they work in-game are:

The X-coordinate runs from south to north and the Y-coordinate runs from west to east. If you want the sun (i.e. the lens flare) to rise in the east and set in the west, you must be aware of this. But the Tomb Raider games take place out of our world, so it is not mandatory. For instance, the sunset in Coastal Ruins takes place in the east, so what? 

So when Lara does the rolling around on the block mentioned above, she only moves along the X-axis, while remaining at the same 'Y-height'. And that is why the first coordinate (the Y) in both lines doesn't change.

To make things clear, here is an easy to understand diagram showing the relationship between compass directions and global coordinates: