04-13-2006 19:00
Let There Be Lights!
An easy guide to the new lighting system, new in 1.10

For years, avatars across the grid have struggled with the dilemma of local lighting: such a pretty glow, yet so taxing on performance.

All that changes with Second Life 1.10, where the lighting system has been completely reworked, and not only is it faster, but a lot more flexible too. The bleak darkness has come to an end and like cavemen discovering fire, mastering light will add abundance and fun to your in-world experiences. Best of all - it's simple to use!

Lighting Basics
Here's what you need to know: four new options replace the old Local Lighting checkbox, in order of eye candy. They can be found in the Edit menu > Preferences > Graphics tab > Lighting Detail section:

• "Sun and moon only"
The most basic, which means when the sun's out, it'll be light, and when the moon's out, it'll be dark. No prim lights.
• "Nearby local lights"
You'll need a compatible graphics card to turn this on (see http://secondlife.com/corporate/sysreqs.php for a list). This includes the sun and moon, and on top of that, takes advantage of your graphics card to provide real-time lighting for six nearby lights with minimal slowdown.


How to Use Lighting
Want to cast your own light on the world? Here's how!

1. In the Preferences for Lighting Detail as described above, set it to at least "Nearby local lights" so you can see prim lights.
2. Press OK.
3. Go to World menu > Force Sun > Midnight and watch as it instantly gets dark!
4. Rez (make) a cube by right-clicking the ground near your avatar and selecting Create, then clicking. (You must be on buildable ground. You can tell by making sure there's no little picture of a yellow cube in a red circle on the menu bar at the top of the screen.)
5. On the tools window that popped up when you rezzed the cube, select the Features tab.
6. Click the Light checkbox.
7. Voila! Watch as the warm glow permeates.


NOTE: Want to tweak more? Be sure to check out Nighttime Brightness in the Adv. Graphics panel, to make sure it's set towards the left--a very dark night provides ample contrast for lights to shine. Drag it all the way to the left if you wish.

Fine Tuning Your New Lights
Next, you'll notice some fancy options underneath the Light checkbox. These allow you to "sculpt" how the light radiates. Have fun, all of these settings are easily understood by doing, and observing what happens.
Color - Self-explanatory. Click on the square and change it to anything you'd like. Changes take place immediately. This will also affect the color of the prim itself (set under the Texture tab).
Intensity - Also easy to use. 1.000 is full brightness, and lower numbers are good for dim ambiences like candlelight.
Radius - Measured in meters and covers the distance the light spreads. The maximum radius of 20 m is suitable for a spotlight in a big room, while smaller ones are appropriate for more subtle effects.
Falloff - Think of this as the shape of the light's edges. 0.000 means the light will be lit completely within its radius, while 2.000 means the center will be bright, but the intensity will quickly drop and provide a fainter presence outwards. 1.000 is in the middle and provides a balanced falloff.



Lighting Tips:
There's a lot of versatility to how you use the new lighting system, so be creative, experiment extensively, and keep the light bulbs appearing above your head!

Lights, camera, reaction!


• If you set Intensity or Radius to 0.000, or set the light's color to black, you might as well uncheck Light because it's visually the same as turning the light off.
• Remember, ANY prim you've made can be turned into a light. No matter what shape or size, its light properties can be set independently.
• Objects which used the Light material from the older system have been automatically converted into Full Bright (not part of the new lighting but a checkbox under the Texture tab in the editing tools) and Glass material. This means they'll be illuminated in the darkness, but not glow. You can certainly give your old lights a Second Life of their own by updating them!
• Lights in motion are dynamic and follow their source prim. For example, carry a lantern in your hand and find your way in the darkness. Or use light prims in a vehicle, perfect for adding that film noir touch to a skittering airplane. Physical objects can also be lit: roll a big glowing red ball down a hill and giggle with glee!
• Common sense: the darker it is around you, the more lights will stand out. If it's high noon, you'll see nary a light, but as dusk approaches, the glows will increase.
• Like other special effects in Second Life, use lights wisely. Please don't light everything, for the reason that this not only diminishes the highlights and contrast that a few finely-placed lights can add, but it also slows down performance for yourself and fellow Residents too.
• Why six real-time lights, as mentioned above? Because the OpenGL specification which SL uses allows for eight lights in a scene. Specifically in this case: six lights, one for the sun/moon, and one for the backlight representing reflected light. Static (non-moving) lights will be "baked" so you can still see the effect they have on the area. For this and more behind-the-curtain details, please see the related technical document.



Super Technical Lighting Tips
For the more technically inclined, I offer more technical tips to tickle your fancy. Warning: what follows is highly technical - proceed at your own risk!

1. Light Falloff
The following function is used to calcluate light falloff:
Intensity = (1.0 - (distance / light radius)) ^ Falloff
(minimum actual falloff is .001)

2. Slight Delay
There may be an inital delay before the effects of non moving lights become visible (the software lighting is done as a background task).

3. Maximum Radius
The maximum radius is set to 20 meters
* For static lighting it is better for performance to have many small lights.
* For dynamic lighting it is better to have a few large lights.
* 20 meters seemd to be a good comprimise.

4. Lighting Calculations
With the 'All Lights' setting, Lighting is divided into two parts:
1. The sun, moon, and moving lights are calculated in hardware
2. Static lights are calculated in software for non moving objects only.

Further Calculation Details:
* When an object stops moving, its static lighting is recalculated.
* Only non moving, non flexible, unattached primitives are staticly lit.

5. Light Priority
For hardware lighting only 6 lights are supported. The shaders support 8 lights, but 1 is reserved for the sun or moon, and 1 for a 'backlight' which approximates reflected light from the sun or moon. The list of lights used is determined as follows:
1. A list of nearby lights is generated.
2 This list is calculated once per frame.
3. Six lights are chosen from the list. Priority is based on the effective intensity of each light at the viewer's Avatar. Dynamic lights are given slightly higher priority.
4. For each object:
* With the 'Nearby Lights' setting, all lights are always used.