Lights
Introduction
This screen allows you to define and edit lights that will affect the output texture. You get to this screen by clicking on Lights from the toolbar on the main screen.
The addition of lighting to your output texture can add a lot of realism to the view. You will normally have one direction light to represent the sun but T2 also allows you to have as many lights as you want and to have spot lights as well as directional ones. T2 will also calculate shadows.
There are some buttons along the top and light thumbnails on the right. The currently selected light details are shown centrally and global light parameters in the bottom left.
Buttons
The buttons along the top provide a number of options:
- New - Create a new light
- Duplicate - Create a new light and copy the settings of the current light to it
- Delete - Delete the current light
- Close - Close the editor window
Light Types
There are two buttons, Directional and Spot that allow you to change the type of light. The spot light has some more values than the directional light.
Directional Light
A directional light has a direction but no position in the world. This means that the light at every point on the texture is calculated based on the angle the light is to that point only. (In fact you can put a position in T2 for this light but this is just so you can easily enter the light direction i.e. it is calculated as the direction between the position and the focus point). The sun is a good example of a directional light.
Tip: using a couple of sun lights slightly offset from each other can sometimes create more realistic lighting and shadows.
Spot Light
A spot light has a direction and a position in the world. This means areas of the world behind the light will not be lit. A good example of a spot light would be a torch.
A spot light has three additional parameters to a directional light:
- Range - this is the distance the light travels before it becomes too weak to affect the world.
- Attenuation - this is how the light intensity falls off. A high value means it falls off quickly.
- Cone Spread - a spot light casts a circle of light like a torch. You can determine how wide this is by changing the cone spread (measured in degrees).
Shadows
T2 can calculate shadows caused by parts of the terrain blocking the light. For each light you can enable or disable shadows via the tick box. The sharpness of shadows is controlled via the Create Texture dialog.
The included example project file lights shows four spot lights shining onto a centre T2:
Light Controls
There are a number of controls on this screen, apart from the global ambient and darkness settings they are all dependent on the current light. You select the current light by clicking on its thumbnail.
Name
Click on the name to rename it.
Light Colour Sliders
You can set the light colour by changing the RGB values of the light. One important thing to note is that you are also changing the power of a light and you must be careful not to 'burn out' the lighting. e.g. if you have sunlight set to 255,255,255 (maximum white) your world will be so bright you will loose all detail. So when setting the colour of your light you are also setting the power. e.g. A red light could be 100,0,0 - it has a red value and green and blue are 0. You could also have a red light of 200,0,0 - it is the same colour but has twice the power of the first.
Tip: Double clicking on any slider allows you to type in a value
Position %
Click on the values to change them. This allows you to set the position of your light in the world. If it is a directional light the position is just used to calculate the light direction. You set the x, y and z position in percentages of the whole output (see note below for more information about this). If looking up your world, x is to the right, z is into the world and y is upwards. So a position of x=50, y=100, z=50 would put a light right in the centre of your world and high up.
Focus Point %
This sets the position in the world the light is pointing at. For directional lights it is just used to calculate the light direction but for spot lights it is the centre of the spot light cone, i.e. the focus point.
Casts Shadows
A light can be set to cause shadows or not dependant on this button. If a light is set to cast shadows geometry that is between a point on the texture and the light will cause no light to fall on that spot - a shadow.
Tip: if you use a skybox with a sun in it you can orientate it to match your directional light (see Mesh Screen)
Global Controls
The global controls affect the lighting of the world overall and are not related to the current light.
Global Ambient Light Sliders
Ambient lighting is light caused by multiple reflections from the main lights but to us its just a general raising of the background light in the world. If you set it to 0,0,0 then your shadows will be completely black and you will see nothing under them, a good balance is needed.
Tip: you can apply an overall tint to the world by setting a coloured ambient light. The sunset sample project shows this off well. It applies a slight red tinge to the whole world.
Darkness Slider
We have to take a step back here to understand this. We are adding lights to our world but if we did not do any lighting calculations our world would still be visible because of the colours in the input textures. We could use very dark input textures but we want to use the colour in them (which actually defines how they reflect light). So we have input textures which actually have lighting already built into them. e.g. the snow texture is a bright white but snow is not white at night when there is no light? Taking these input textures we then add ambient light and light from our lights defined on this screen and we can get a very bright world. Therefore the darkness slider is used to counteract the lighting that is built into the input textures. Good values tend to be about 100 but you have to experiment because it is a balancing act between the light power, ambient level, this slider, light built into the inputs and any emissive lighting from the materials.
Normalise Lighting
If you enable this option (via the radio button) T2 analyses the lighting in the output texture and spreads it evenly throughout the lightmap, this can take maximum advantage of the range of colours and is generally a good option. You can also set minimum and maximum brightness values. For example if you were to set minimum to 10 and maximum to 90 all the pixels in the lightmap would be mapped from their existing range to a range of 10 to 90 (no black or pure white). Obviously a range of 100 gives the best lighting definition.
A note on percentage positions
When creating your output texture you can change the size of it at will, you can also change the size of the mesh at will. So to position lights so they are always in the same relative place, T2 uses percentages. So if your texture is 512 by 512 and a light is positioned at x=50% y=100% z=50% your light will be positioned over the texture at 256,512,256. If you then decide to change your output texture size to say 512 by 512 you will not need to reposition your lights because they use percentages and so will be positioned at 256,512,256.
Note: you can set values to more than 100% if you want, so if you have a spot light that you want to be way above the world you could set its y position to 150%
|