Light Properties

From The DarkMod Wiki
Revision as of 19:32, 24 August 2008 by Greebo (talk | contribs) (Swapped "origin" with "light_center")
Jump to navigationJump to search

NOTE:
This is a first-draft article. It has not yet undergone quality control, so take information with a grain of salt
as it is subject to change

Introduction

For Doom 3 (and subsequently, The Dark Mod), there are 4 different types of lights at our disposal. Each has their own advantages and drawbacks, and hopefully this article will help to familiarize The Dark Mod hopefuls with their use. For information on creating lights and a lot of other useful information, see A - Z Beginner Full Guide Start Here!

Point Light

A point light is the default light (also the default for fog). No option must be checked to make a light a point light. A point light casts light, and subsequently shadows in all directions evenly, falling off after a distance defined by the light texture. This works best for most small indoor and outdoor lighting, like lamps, candles, fireplaces etc. For this reason, it is going to be the most used type.

Parallel Light

A light is said to be parallel when the parallel checkbox is checked in the light inspector. It is subject to all the same options as a point light, but it has a few distinct differences. A parallel light tends to not care exactly where the entity itself is placed. The most important thing is where the light_center vertex is placed and where the light entities bounding box intersects with elements in your map.

The light_center vertex starts right in the middle of the entity. The main difference between the parallel and point lights is that a parallel light does not radiate from the origin around the entity itself. What controls the direction that shadows are cast is the placement of the light_center vertex. Shadows will run parallel (hence the name) to a line between this vertices and the light entity itself. As such, this makes it an excellent choice for sunlight or moonlight. As such, it has some of the elements of a point light and a projected light, it can seem to radiate in a circle (if you use the appropriate texture) whilst casting a shadow in any direction preferred.

Switch to Vertex mode in DarkRadiant to drag the light_center vertex of your selected light entity.

Posted by Greebo: Also, note that a parallel light will only light surfaces "matching" the direction of the "light vector" 
(origin minus light_center). All other surfaces will stay completely unlit, therefore it should be combined with an ambient light to
achieve good lighting effects. [1]

What this means is, you can draw a line from the center vertex to the light entity's origin and on from there, and only objects in the direction of that line will be lit. The light won't light 4 walls of a room and the floor, it would only light one of the walls or the floor (or ceiling)

Troubleshooting

I added a parallel light but I can’t see any light at all!

Parallel lights can have some quirks. The light seems to fail and do nothing when intersecting multiple walls that are parallel to the face the light is actually casting on. It seems the light will work as long as it doesn’t intersect a face parallel to the one it is casting light on.

I have a parallel light but it casts a jagged light on my floor!

Similar to above, a parallel light can sometimes have anomalies when intersecting multiple walls and a floor. Since having the light intersect multiple walls when it can only cast on one of them, having a massive bounding box is pointless anyways so pay attention to what the light is touching and you should be fine.

Projected Light

Projected light is just as the name suggests. It is probably more intuitive and easier to use than a parallel light and is better for things like projecting a window-shaped light on the floor of a room or a spotlight on a wall. To make one, select projected instead of the default omni option at the top of the light inspector.

This creates a triangular prism as the bounding box for the light (instead of a rectangular prism like a regular light), with the point ending right at the entity itself. This can be rotated using any of the XYZ rotation buttons or manually using DarkRadiant’s rotation tool (shortcut R).

You can also manipulate the projected light via the vertices (shortcut V to enable vertices dragging). By dragging the vertices in the center of the projected square, you can lengthen and change the angle of the projection while keeping the projected square the same size. To resize the projection, use the two side vertices in the correct XYZ grid view. Making the bounding box flat against a surface (like a floor) is usually unnecessary (for example, making a moonlight window light on a floor or wall), because with shadows enabled and making the projection long enough to intersect the plane on which the shadow is to be cast, the full shadow will be cast (its simple geometry and just requires minor toying).

As with all the lights, projected lights have a full range of color and texture options to let the mapper find just the effect they need, allowing you to create a great atmosphere for your map.

Ambient Light

Ambient light is really just a lighting texture, but it is also a specific item that is needed in practically every map, so for those purposes it will be treated as if it were its own subset of lights.

An ambient light can be any form: it can be a point, parallel or even projected (though projected would probably be useless).

The only requirement of an ambient light is to use one of the available ambient light textures, accessible by opening the light inspector (with the shortcut L in DarkRadiant, and get used to using it), and selecting ambientlightnfo from the list.


Ambient Light is covered in more detail in A_-_Z_Beginner_Full_Guide_Page_2#Ambient_Light:_Gloom_not_Doom

Light Settings

There are several settings with which to customize your lights. These settings allow the mapper to customize the look of a light (or a combination of lights) into a near infinity of looks. All are accessed through the light inspector (shortcut of L in DarkRadiant)

Color

The color palette allows the mapper to pick the color of the light emitted, arguably one of the most useful controls the mapper has over a light. To access it, click the button under the “Colour” heading. From there, adjust the settings until you find a correct color (can take some trial and error). In a game like The Dark Mod or Doom 3, where darkness is often more prevalent than light, the color picked often needs to be darker than expected. Without a direct brightness option, the color takes on this task. For a low level ambient light, the color picked would be almost pitch black. A pitch black light would not cast any light, but anything less than pitch black will cast a faint light. As such, it can take some trial and error to find the correct light for a situation, as intiailly, one is likely to pick a seemingly correct color only to find it is far too bright.

Remember: changing light settings or adding lights (and models) does not require re-compiling the map!

Parallel

Selecting this option turns the light into a parallel light (as opposed to a point or projected light). See Light Properties#Parallel Light

Do not cast shadows (fast)

As the name suggests, this setting causes the light to not cast shadows on any object. This can cause the light itself to not be confined by walls, which can sometimes be a beneficial and sometimes not. The main purpose of enabling this option is performance. Shadows are processor intensive and are not needed in some cases, so removing them wherever not beneficial to gameplay can improve performance. This option would always be used with an ambient light. Another way to improve performance similarly is to set the entity property on a model or func_static (this doesn’t work on worldspawn) noshadows to 1.

Skip Specular Lighting

Specular Lighting refers to a textures specular map, wherein a flat surface (such as a wall) is applied a texture with a specular component, which causes a surface to have shinier and duller parts on a flat surface based on the darkness of the corresponding location on the specular map. Not all textures have specular maps. Checking this option could improve performance or remove the effect if it is not wanted. [2]

Skip Diffuse Lighting

Like Specular lighting, diffuse lighting also references an attribute of a texture, the Diffuse Map. Diffuse Maps determine the intensity and color of the light reflected off of the different elements of a texture (an example being the difference between bricks and the mortar in between, as well as different bricks having different properties as well giving a less bland appearance). [3]

Lighting Textures

The lighting textures are also accessed in the light inspector. The textures allow the mapper to chamge the intensity and falloff of a light. These also allow for animation of the light, such as a moving light for a fireplace, candle or torch etc, or flickering as well as sound. One can also apply a fog texture to the light (the only way built into doom 3 to create fog). Color is of a similar concern when creating fog, as noted in Light Properties#Color

Further reading

A great tutorial on outdoor lighting can be found here: http://www.katsbits.com/htm/tutorials/doom...ing_outdoor.htm