Thursday, March 03, 2016

« NWN Survey: Is a Virtually Happy Life a Happy Life, Period? UPDATE: John Carmack Retweets Survey | Main | R2D2 Creator Tony Dyson Dies -- Was a Longtime Second Life Community Member in Recent Years »

SL Building Tutorial: Seven Lighting Tips for Stunning Results (NWN Guest Post)


Despite appearances, this Second Life room uses only two light sources

Brookston Holiday has been building in Second Life for 10 years. You can view his work on the SL Marketplace here and at his ProMaterials brand listing.   

Lighting can be the difference between a good build and a great build. It can also be a resource hogging nuisance that brings lesser systems to their knees. The good news is that with a basic understanding of Second Life's lights, and some texture trickery, you can have your builds looking like a Stanley Kubrick film.   

In the past, the Second Life viewer was limited to rendering six lights within a scene. Today, with advanced lighting enabled, there is no limit. This means that what works on your system, with its screaming fast video card, may lag another user’s system. For this reason it’s important to use only as many lights as is necessary. For instance, the bathroom depicted above and below is using only two lights:



How did I create this lighting? Here’s the seven steps I recommend:

Emissive Masks - alpha mask’s rarely-used cousin

My first trick to achieve this style of lighting is using an emissive mask. Textures in Second Life can contain up to 4 channels. The first three channels control red, green, and blue; the fourth channel is a wild card. If the fourth channel controls transparency, it’s called an alpha mask. If it controls brightness, it’s called an emissive mask.

Ordinarily, how bright a surface appears is based on how much light is hitting it; an emissive mask comes first in the render pipeline, and tells the viewer to set the brightness based on how white the emissive mask is. Completely white areas on the emissive mask appear to be 100% bright, while black areas are lit in the normal way. In addition, only white areas on the emissive mask are affected by any glow applied to the surface.


This is what the emissive mask for the ceiling looks like. You can see the three different sets of lights as white circles. In photoshop, I’ll open the texture I’ve created for the bathroom ceiling, add a fourth channel and paste this into it. Within second life I’ll apply the texture, set the alpha mode to emissive mask, and set glow to something like 0.3. Now those areas of the ceiling appear to be brightly glowing lights. I save a bunch on land impact by not modeling the actual bulbs, and I save the viewer having to render all of the polygons. In other words, circles are expensive to model, it’s cheaper to paint them on.

Unfortunately, these fake lights aren’t emitting any light into the room. They’re fake. For the actual light we’ll have to create prim lights, which in Second life come in two different flavors: point lights and projectors.

Projectors - the king of lights

A point light is similar to an incandescent bulb, emitting light equally in all directions. A projector is more like a flashlight, you can point the light in any direction you want. In addition, like a film projector, it can cast pictures onto surfaces. But unlike in health class, this projector won’t be showing a filmstrip about the dangers of gonorrhea. Instead, it will be projecting this:


This represents the recessed lights in the center of the room, above the shower. I made the texture in Illustrator by duplicating white circles and then applying a blur to them, but it could be made in Photoshop or GIMP just as easily.


You can create a light by selecting a prim, going to the features tab, and checking the light box. In order to change it from a point light into a projector, you simply apply a texture. I then move the projector above the ceiling lights, adjust it to roughly match their size, and hide it by setting its texture transparent.


Notice that the ceiling is transparent from the top down; if it wasn’t, I would simply place the projector slightly below the ceiling.

Scene Gamma - or, How to kill the sun

Once the light is in place, the texture is being projected onto the walls and floor, but all of the ambient daylight makes it hard to see. Luckily, we can turn off the sun and the moon with a simple trick. Make a new sky preset, go to the lighting tab, and set the scene gamma to 0. Using this preset will mean that the projector will be the only source of lighting, so you can really see the effect of changing any of the projector’s settings.


Field of View - the importance of shadows

Like a flashlight, you can make the beam coming out of the projector wider and narrower. This is called field of view, labeled FOV in the viewer. I want to create visual interest by making sure there are variations in tone and brightness across the walls and floor, and changing the FOV allows me to do it.


Intensity and Fall off - a slow (or fast) fade to black

Once the light is hitting the room in a pleasing way, you can adjust its intensity and falloff. Intensity is how bright the bulb is, and falloff is how quickly the light fades to black. Setting falloff to 2.0 is similar to how light behaves in the real world (if you’re into that whole reality thing).

I did the same thing to simulate the other nine lights in the room. It has a different projector texture, corresponding to the placement of the other lights. Keep in mind, the entire room could have been lit with a single projector to save even more resources. I split it into two because I wanted to tilt the center lights towards the shower wall, and the outer lights towards the tub.

Lighting Temperature - adding warmth

It is also a good idea to add some warmth to our lights. Pure white light tends to look harsh and clinical, like a doctor's office or my wife’s ever judging eyes. Select the light’s color and add just a hint of orange/yellow to it. This makes the atmosphere more hospitable and inviting.


Real Time Lighting - to bake or not to bake

An advantage to adding lights to a room is that normal and specular maps look their best when they are lit properly. Still, some may argue that because many systems can only run Second Life on its lowest graphics settings, it’s better to bake lighting directly into textures, rather than depending on in-world lighting. I would point out that the two methods can be combined.  

This room has lighting baked onto the walls and ceiling, while the spot lights on the couch and table are projectors. Users on low settings still get a nice looking room, while those with ultra settings are treated to a little extra.


Using these tricks gives some dramatic lighting effects, even within Second Life’s aging render pipeline; and by using emissive masks and projectors you can save slower systems from painful lag. If you’d like to see the lighting in-world, follow this SLURL.

BrookstonHolidayAvatarBrookston Holiday (@ProMaterials on Twitter) has been building in Second Life for over a decade. In his first life, he is a freelance 3d Artist.

His work has never been featured in a triple A game title, but he thinks it would be “really neat” if it was.

Please share this post:



Feed You can follow this conversation by subscribing to the comment feed for this post.

Dartagan Shepherd

Great work and tutorial.

Brookston Holiday


pussycat catnap

In that first screenshot... as someone who used to do a lot of 3D art I will just say that it is BECAUSE that first image only uses 2 light sources that it looks so good.

Really though, the ideal scene uses exactly 3 light sources.

Two from different angles with different colors and strengths aimed at your subject, and a third of varying color and strength as a backlight behind your subject aimed somewhat at it to enhance the contrast outlining it.

Everything about mood and effect then becomes all about what colors, angles, and strength of lighting you go for.

(and if SL gave us better light tools, things like the spread of cones and how sharply they fall off on their edges would also matter a lot, as well as how they fall through atmospheric filters like smoke, fog, rain, and so on.

Connie Arida

A great tutorial and thank you.
Too many times i have seen very promising builds ruined by insensitive lights.It's about time people really stopped using overly bright, overly big and unrealistic point lighting. Projectors are the only way to go.

Brookston Holiday



Thanks -- I have not been clear on how emissive masks are used.

sirhc deSantis

Thanks :) Especially for the tips to cover varying graphics settings.

Post a comment

If you have a TypeKey or TypePad account, please Sign In.