Archive for March, 2010

Second Life Prim Lights – 2

Wednesday, March 24th, 2010

After the previous introduction to prim lights, let’s look at some technical (but not too technical!) background, and a few things about the lighting system which are not immediately obvious:

The graphics system which Second Life uses (OpenGL if you are interested) only allows 6 lights to be visible at any time. If a new light becomes visible, one of the other lights will be disabled, so you should avoid having too many lights too close together.

(As an aside, this is one of the reasons why some people complain about facelights, and especially about facelights which make use of multiple lights — every one of those lights uses up one of the available lights.)

A light has no visible appearance. When you turn a prim into a light by ticking the ‘Light’ checkbox on the Features tab, the prim itself doesn’t change in any other way, it simply has an invisible light-source attached to it. This light source will move with the prim, but is otherwise completely unaffected by anything that you do to the prim, apart from changes to the actual light parameters.

This means that the size and the shape of the prim have absolutely no effect on the light, because the light source is always a single point at the centre of the prim. This might not be what you expect. For example, if you turn on light for a prim cube, then stretch the prim out into a long rectangle, you won’t get an elongated light-source, you will still get a sphere of light originating at the centre of the prim (well … not exactly a sphere — see this previous post if you want to know more about that).

Light example

The light is not blocked by prims. Ok, it isn’t quite as simple as that…

Lights won’t illumine prim faces which are facing away from the light-source. This sometimes makes it look as if the light is blocked by prims. Suppose there is a wall in-between you and the light source. You won’t see any light on your side of the wall, because it is facing away from the light, and it looks as if the wall is blocking the light. However, if the light is low  enough, you will see light on the ground outside the wall.

This is easier to show than explain, so here is an example. The small cube on the right-hand side of the wall is the light-source. You can see that it lights up the floor on both sides of the wall, but doesn’t light up the side of the wall which faces away from it (the wall is standing directly on the floor):

Blocked light example

Another effect of this is that the prim itself is not illumined, because all the visible sides of the prim are facing away from the light. To make it actually look like a light-source you can turn on full-bright for it, and perhaps apply a small amount of glow (a setting of 0.02 is usually sufficient).

Finally, prim lights don’t cast shadows (except as an experimental feature in some third party viewers). If you want to provide a shadow effect, the usual way to do this is by texturing the surface that you want the shadow to appear on, or by creating a thin ‘shadow’ prim with a semi-transparent shadow texture.

Second Life Prim Lights – 1

Thursday, March 18th, 2010

In Second Life constructions few things are more misused and misunderstood than lights, full-bright, and glow. In this post, I’ll start looking at lights (!), and I will cover full-bright and glow in subsequent posts.

To begin with, let’s create a simple light. Start by rezzing a sphere, which will act as the light source. On the third tab of the Build dialog (Features) you will see the light options in the lower half. Tick the ‘Light’ checkbox, and the sphere will start to cast light (you might want to set your environment to midnight to see this to best effect).

Features tab on the Build dialog

You’ll notice that the sphere doesn’t light up in any way — it still looks like a plain plywood sphere. I’ll talk more about this in the next post, but in the meantime you can make it more realistic by going to the texture tab, setting the texture to blank, turning on Full-bright, and setting the Glow value to something like 0.02. You could also set the transparency (try a value of 25.0).

There are four basic parameters for lights, as you can see on the build dialog. The first is the colour. Clicking the colour square will bring up the standard colour selector.

The Intensity value is simply how bright the light is, and can take values from 0 (where the light is effectively off) to 1.0, at which point the light is at its brightest.

Well…”brightest” is perhaps misleading. You’ll notice that even at maximum intensity the light isn’t really very bright. It’s possible to create an even brighter light by putting a second light source right next to the first one. The light from both will combine where they overlap, and become even brighter.

The only problem with this is that you are using up another of your very limited number of lights (more on that in the next post).

The Radius value is, predictably, the size of the area that the light will be cast over. This isn’t a precise value, because there is a certain ‘fuzziness’ at the edges. It can range from 0.0 to 20.0.

The Falloff value describes how quickly the light ‘fades’ as it approaches the radius limit. In theory, a Falloff of 0.0 will stay at full intensity right to the edge, whereas a Falloff of 2.0 (yes, it goes to 2.0, don’t ask me why!) will fade away very quickly.

In practice, the Falloff is a much more subtle effect, and combines with the Radius value (which also has a rather subtle impact). Experimenting with them is the only way to really understand what their final effect is.

And that’s your basic light. More next time…