Light Properties: Difference between revisions
Line 164: | Line 164: | ||
=== Skip Specular Lighting === | === Skip Specular Lighting === | ||
Specular Lighting refers to a | Specular Lighting refers to a texture's specular map, wherein a flat surface (such as a wall) is painted with a texture that has a specular component. This 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. [http://www.modwiki.net/wiki/Texturing#Specular_maps] | ||
=== Skip Diffuse Lighting === | === Skip Diffuse Lighting === |
Revision as of 05:10, 15 February 2014
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!
Light Volume Properties
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.
- Note, a misconception about Point Light is that they project spherically. The box shaped bounding volume in Dark Radiant is no mere simplification, it is the literal area affected by the light for calculation purposes. Point Light volumes should be perceived as cylindrical prisms that on one axis are shaped by the silhouette of the projection texture (think of a stack of cheese cut with a cookie cutter) and the other axis (z-axis) traditionally determines the distance from origin brightness (usually vertical... or how tall you make your cheese stack) with the LightFalloffImage.
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.
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 Parallel Lights
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.
Light Interaction Properties
Normal Light
This is the default light type. It performs all the surface interaction stages and shadow calculations. It has the heaviest performance impact.
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.
Properties: No shadows, No specular, Bumpmapping or Directionality (Note: The "Enhance Ambient" does add Bumpmapping )
Use the ambientLight keyword.
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 Ambient Light: Gloom not Doom
- To understand The Dark Mod's unique ambient light detection system see: Virtual Darkness
- Ambient Light can be set to automatically adjust color and brightness per "location" see: Location Settings and Dynamic ambient light
Fog Light
This applies Doom 3's style distance fog to a light volume. The texture applied will become more opaque with distance away from the viewer. There is a variant called No Portal Fog which will not apply opaque fog to Portal areas in view. ( Beginner Tutorial: Fog )
In rare cases, you may wish for some surface inside a fog-volume to be fog-free. You can use the "noFog" keyword in the material definition for the texture applied to this surface to keep it from being "fogged".
Very thin fog (or BlendLight ) can also be used to soften the apparent light interactions near surfaces in a similar manner to the Post Process shader effect but with more mapper control. You can fake certain radiosity effects simply by amplifying small ambient light with small thin fog volumes.
Use the fogLight keyword.
Blend Light
Blend lights can be considered to be like volumetric decals. They do not perform most of the interaction shader operations and merely apply a texture to a volume using an OpenGL Blend Mode. Blend lights have the least performance impact. Blend lights can also be used to create "negative light".
Use the blendLight keyword.
Spectrum
You may use the "spectrum" keyword to isolate specific lights to specific materials which have the same spectrum value in their material definition. Spectrum Keyword at Modwiki
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!
Radius
The 'radius' of your light can be changed by dragging its corners around in the 2d windows. Doom 3 lights do not have an actual radius, they are actually square lights and will light up everything they touch inside their bounding box in the editor. They will evenly light everything to their edges. While square lights might seem fairly odd there are options to make them more believable and have a nice fade, namely the 'texture' applied.
Tip: you can rotate a light so only one corner will touch a wall and make a triangular shaped light.
Or rotate it so 2 corners touch a wall and make a line of light.
Changing Radius of Light Entity:
If you put a premade light entity into your map, the radius of the light won't be visible.
To change it, use the following syntax (and whichever value you wish):
"set _color on flame" "0.9 0.8 0.7" "set light_radius on flame" "250 250 250"
With lanterns and such use 'light' and with torches and candles etc use 'flame'.
"set _color on light" "0.9 0.8 0.7" "set light_radius on light" "250 250 250"
(Copied from Baddcog's old "Lighting A to Z" article)
Parallel
Selecting this option turns the light into a parallel light (as opposed to a point or projected light). See 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 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 vastly improve performance. Note that ambient lights never cast any shadows. 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.
- Further details: Turning Shadows Off , Noselfshadows
Skip Specular Lighting
Specular Lighting refers to a texture's specular map, wherein a flat surface (such as a wall) is painted with a texture that has a specular component. This 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.
Lights can be modified by two different texture types:
- Projection Image - This is the texture that is projected on the surface
- LightFalloffImage - This texture varies the intensity of the light through the volume along the Z Axis
- (Notes: While the Falloff Image is a 2D texture it is rendered as 1D (one dimensional) you will notice that almost all Falloff Images are thin strips with perpendicular stripes. Traditionally Falloff with be used to diminish the light with distance to the source but you can violate the physics of real lights and have the intensity increase with distance or vary intensity from bright to dim to bright... etc. )
These textures allow the mapper to change the intensity and falloff of a light.
Light textures with the addition of material keywords like scroll,rotate, etc.. will grant lights the ability to animate and produce special effects such as;
- A moving light for a fireplace
- A candle or torch
- A light flickering along with 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 Color
- A typical "Light Shader" material definition
lights/My_Custom_Light1 { lightFalloffImage makeIntensity( textures/My_Custom_Light1_Z ) // Falloff Image { forceHighQuality map textures/My_Custom_Light1_XY // Z-Projection Image zeroClamp } }
(For advanced detail and techniques see Light Textures and Falloff Images )
Further reading
A great tutorial on outdoor lighting can be found here: http://www.katsbits.com/htm/tutorials/doom_3_lighting_outdoor.htm
Modwiki's summarized Doom 3 lighting article: Light