Archive for the ‘MV-SL-Tutorials’ Category

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…

Not An Introduction to Second Life Prim Lights

Tuesday, December 1st, 2009

This is dedicated to those knowledgeable and helpful folk over on the SL Universe forums, without whom this post might never have been written.

This is not the post I was going to write.

I was going to give an introduction to using Second Life prim lights. Because I needed some illustrative snapshots, I created a simple prim, activated the light feature, and started taking pictures.

At which point I realised that after five years in Second Life there are still things that I don’t know, one of them being that lights don’t quite work how I expected.

As an example, here’s a cube which has been turned into a light-source. You can see it lighting up the floor, as expected:

Well…maybe not quite as expected. Why does the light have such a peculiarly elongated and patterned appearance?

What’s happening is that the light is revealing some of the underlying structure in the Second Life world. Turning on wireframe (this is in the Advanced menu, if you want to try it yourself) gives an indication of what is going on. I won’t post a picture, because a static picture of the wireframe view is just a confusing mass of lines. If you try it yourself, though, you will notice that the lines and intersections (technically known as vertices) match the pattern of the light. When a light shines on a prim, the appearance is changed at the nearest vertex.

Let’s move the cube so that it is ‘between’ vertices:

The light fades. It doesn’t vanish altogether, but it is certainly less visible.

If the cube is moved again, over the next vertex, the full light returns:

If the light follows the vertices, what happens if the prim that the light is shining on is resized? Given what we’ve just seen, it’s perhaps unsurprising that resizing the prim will change the appearance of the light:

This has the odd result that resizing the light prim has no effect on the light that it casts, whereas resizing the prim that the light falls on does have an effect!

So, when you are trying to set up lights in Second Life, you have more to think about than you might have imagined. The position of the lights in relation to the prims that they are illuminating, and the size and shape of the prims that the light falls on, all have an impact on the final appearance of the lights.

In the next article in this series I will go back and write the post I originally intended, and give more of a basic introduction to lights.

Textures – A Few Quick Tips

Friday, November 20th, 2009

Some hints and tips that might make working with textures quicker and more efficient.

1. Instantly apply a texture

…without even opening the Build dialog! Simply drag a texture from your inventory onto the surface that you want to texture. The texture will instantly be applied to that face. Obviously this will only work on prims that you have modify permissions for.

2. Applying a texture to multiple faces

In the Build menu, tick ‘Select Texture’ as usual, and select the first face. Then hold down the Shift key and click on any other faces that you want to texture, even on completely different prims. Then apply the texture that you want, via the Texture tab. The texture will be applied to all the selected faces.

The only catch to this is that sometimes Second Life is a bit flaky about actually texturing all the selected faces, so don’t unselect straight away, and simply re-apply the texture if it doesn’t ‘take’ to all the faces.

3. Using the dropper

On the Texture tab, click the texture image to bring up the texture selection dialog. There is a small ‘dropper’ icon at the bottom of this. Click this icon, then click on any other prim face, and the texture from that face will be selected for the current face. This will only work to pick up textures that you have copy permissions for.

4. Choose between the texture selection dialog or your inventory

There are two ways to directly get a texture onto the texture tab (and hence on to the selected prim or face), either by dragging a texture from your inventory onto the texture image, or by clicking the texture image to call up the texture selection dialog.

Both have their pros and cons.

The Texture Selection dialog will search through your Inventory, and will only show you the textures or snapshots that you can apply as a texture. It will hide everything else, including textures that you cannot use (probably because you don’t have copy permissions for them). This is useful, but if you have an
inventory of any size it can take some time for the list of textures to fill up.

If you use your inventory instead, you don’t have this delay, but of course you will be shown everything, including textures/snapshots that you cannot actually use. If you try to drag these onto the texture image, the cursor will change to a ‘stop’ icon to show that you cannot use them.

5. Use the Library

Down at the bottom of your inventory is a folder called Library, which contains a default collection of stuff that Linden supplies to every avatar (they sometimes add to this collection, so it’s a good idea to take an occasional look here for new things). It includes a useful and varied collection of textures. Before you spend your hard-earned Linden Dollars buying a new texture, look here first, to see if there is already something which suits your needs.


6. Use the Library’s default transparent and media textures.

If you need a fully transparent texture, or a texture to display videos on (a subject which is beyond the scope of this blog entry), the Library has default textures for these (they are at the top of the Library ‘tree’, not in the Textures folder). The advantage to using these is that they are very likely to already be in the viewer’s cache, and hence won’t need to be downloaded, which means that they will rez much faster.

8. Use the bumpmaps and colors

I’ve mentioned this in a previous post, but it’s worth repeating: experiment with the bumpmaps option on the Texture tab. Using bumpmaps, and applying colors, can create good textures without making use of a texture image at all (simply change the default ‘plywood’ texture to ‘blank’), or can create useful variations of existing textures.

Also worth repeating is the example to illustrate this technique: