Lighting A to Z

From The DarkMod Wiki
Revision as of 18:50, 21 February 2011 by Springheel (talk | contribs) (→‎Radius)
Jump to navigationJump to search

Lighting A to Z : Baddcog

This will cover all things to do with lighting in Dark Radiant.

Theory

Ramble on about shadows, light and gameplay...

Creating a light

Simply right-clicking in any 2d view will create a light entity in your map. This will create a default white light of 100 brightness, most likely you will want to change the radius of the light and other properties such as color.


Radius

The 'radius' of your light can be changed by dragging it's 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 believeable 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 triangluar 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"


"set _color on light" "0.9 0.8 0.7"
"set light_radius on light" "250 250 250" 

With lanterns and such use 'light' and with torches and candles etc use 'flame'.

Light options

To change a lights options select it and press 'L'. This will open up the lights dialog and give you the following options:

Color & Brightness

Using the color wheel you can select the color of light you want and also the brightness. Lights tend to be very bright if you saty in the brighter colors, dragging the dot towards the black side of the spectrum will dim them.

If you choose pure black you will not have a black light, but instead a lack of light. Pure white will be white and very bright. Medium grey will be white, just less bright than pure white. You can also use the rgb number bars to add exact colors/brightness.


Having the texture selected and displayed in the window means it is applied. To remove it close the folders so you have no texture applied (This may be tricky).

One issue I have found so far is that any objects (tables, chairs, etc..) and patches will be 'full bright' if they fall within the lights bounding box. While this looks good on a fully lit electric chandelier it doesn't look good on a dining room table.

A workaround is to use 2 lights. One with the texture you want, carefully placed to not hit any major objects in the scene, with shadows turned off. And a second light with no texture to light the room, objects and cast shadows.

Parallex

needs defined - something about pointing one direction, like a spotlight.

Specular

I assume this skips a lighting pass on any specular maps on all objects and terrain. Metal has alot of spec. Oldwood is low spec.

Diffuse

This would probably toggle lighting the diffuse map, so maybe you can get some shine from metal (specular) but not light the tex at all, could make cool glimmer effects.

Shadows

Do not cast shadow: This turns off any shadow casting. Lights and objects have this option. Boosts performance. Good for ambient fill lights.

Texture

The texture selection can add some great effects while keeping performance good. Torch entities have an animated 'pulsing' texture applied already. This gives the illusion that light flames are flickering, but it won't cast expensive flickering shadows. It can also be used to give a nice round fade the the stock square lights. It can also be used to cast a window texture across a floor to make it look like moonlight is pouring through the window.

Performance Tips

Light performance is based on how many lights hit a polygon, how many shadows are being cast and how many objects are casting shadows from the lights. This is all computed during game so going overboard can kill performance on slower machines.

Turning off light options is a great way to improve in game performance. But it comes at the cost of your map looking as good. You need to find a good balance.