You are currently browsing the category archive for the ‘Textures’ category.

As with all my script posts, I am assuming here that you already know the basics of how to create and edit prims and scripts.

I’ve already covered the rotation option for animating textures, in my post about creating a simple rippling water texture. In this post, however, I want to look at the other animation options, and give some examples. The only one I’m not going to cover is the scaling option, which works in a similar way to the rotation option, but which I have never found a real use for.

Let’s start with what most people think of in terms of texture animations, which is where the animation displays a series of ‘frames’. As a simple example, here is an alternative way of creating a rippling water effect, this time using an animation. To see this in action, rez a cube, and create a new script for it. Replace the contents of the script with the following:

  llSetTexture("349b2fec-0f7e-bd5f-5bcc-7090d27ae0fb", ALL_SIDES);
  llSetTextureAnim(ANIM_ON | LOOP, ALL_SIDES, 3, 3, 1, 9, 12.0);

As with all the examples in this post, I am taking the textures from the asset server using their UUID, so they should be available to anyone. Of course, you don’t have to do it this way – you can apply animated textures to the prim in the normal way if you want (in which case you can remove the llSetTexture call in the above example).

The texture in this example is 128 x 128, and has the frames laid out in a 3 x 3 grid (the texture was created using the Gimp drawing package). It is actually rather smaller than is necessary, and hence not very high quality. A 256 x 256 version of the texture would be better quality, and would still load reasonably quickly.

Let’s look at each of the parameters of the llSetTextureAnim function.

The first parameter is a set of flags which are combined together using an OR (the ‘|’ symbol). In my example, only two options are included: ANIM_ON, which switches the animation on (no surprise there!) and the LOOP option, which tells the animation to return to the beginning and start again once it has reached the last frame. The alternative to LOOP is PING-PONG, which still keeps the animation running continuously, but when it reaches the last frame it then plays the frames in reverse until it gets back to the first frame, and so on.

If you don’t specify one or other of LOOP or PING-PONG the animation will play through just once and then stop (it will redisplay the first frame, though). We’ll see a possible use for this later.

The other possible flags for this parameter are SCALE, ROTATE, REVERSE, and SMOOTH. As I said above, I won’t be going in to SCALE and ROTATE in this post. REVERSE simply plays the animation backwards. I’ll come back to the SMOOTH option later.

The next two parameters tell the function how the frames are laid out in the texture. In my example, they are laid out in a 3 x 3 grid, so we set both values to 3. A common alternative would be to have the frames laid out horizontally in a long strip. If this sample texture had been done that way we would have had a strip 9 frames long, so these parameters would be 1, 9.

The next two parameters tell the function which frames to display, from the first frame to the last frame. You can use this if you only want to display part of the animation (possibly you might want to display different parts at different times). In this case we want to use all the frames.

The last parameter is the speed of the animation — the higher the number, the faster the animation. It is approximately (very approximately!) in frames per second, and values between 5 and 15 are usually appropriate, though of course this depends on your animation.

Now, what about that SMOOTH option? Well, this works in a rather different way. Instead of displaying individual frame, the SMOOTH option basically scrolls the entire texture sideways. Because of this, it is possible to use this to scroll a texture which isn’t animated (in other words, a texture which isn’t actually a series of frames).

As an example, let’s create a slowly drifting starfield. Rez a cube, and size it so that it is about 4 m wide and 2 m tall. Create a new script in it, and replace the script contents with the following:

  llSetTexture("43019701-cf5c-d484-3b35-3fb59fe895b4", ALL_SIDES);
  llSetTextureAnim(ANIM_ON | LOOP | SMOOTH, ALL_SIDES, 1, 2, 1, 1, 0.02);

Notice that although the texture is not animated, we have specified a Y frame count of 2. This might seem rather odd, and needs some explanation. As soon as you apply llSetTextureAnim, the script will override whatever X and Y repeat values that you have specified, and instead will size the texture to match the X and Y frame count that you have specified, stretching it as necessary.

In order to make the texture fill the X direction without stretching, the Y frame-count has been specified as 2, making the script treat the texture as a two-frame animation. Because the start and end frames are both 1, it only displays one frame, which in this case works out as the top half of the texture, with the result that the texture is scaled correctly for us. This is not really an efficient way of doing things! Really, an animated texture needs to have the same X:Y ratio as the prim face that you are going to use it on.

Next, something more useful. Let’s see how to use texture animation with Second Life’s waterfall textures, and create a simple waterfall.

Start by rezzing a cube, and size it so that it is 2 m wide, 4 m tall, and 0.2 m deep. On the Texture tab, set the rotation to 90.0. This is because animations which use SMOOTH, as we are going to do, always slide along the X axis, so we need to rotate the texture to make our water flow vertically.

Create a new script in it, and replace the script contents with the following:

  llSetTexture("af8c86bd-c377-c331-7476-58abeb7af8fc", ALL_SIDES);
  llSetTextureAnim(ANIM_ON | LOOP | SMOOTH, ALL_SIDES, 1, 2, 1, 1, 0.5);

By itself, this should look reasonably effective. We can make it better, though. Take a copy of this prim, shifting it so that it is a little bit in front of the original prim. Edit the script in this copy, and replace it with the following:

  llSetTexture("49649c94-f720-6d0f-2246-49cc1835284f", ALL_SIDES);
  llSetTextureAnim(ANIM_ON | LOOP | SMOOTH, ALL_SIDES, 1, 2, 1, 1, 0.25);

This now gives us two waterfall animations, running at different speeds. The result is very effective.

Near the start of this post I mentioned that if you had neither LOOP nor PING-PONG in the animation flags the animation would run through just once. Here is an example of this. It is a ‘LOCKED’ sign which flashes once when somebody touches it.

Rez a new cube, and size it to be 1 m wide, 0.5 m tall, and 0.5 m deep. Create a new script in it, and replace the script contents with the following:

  llSetTexture("7392be5b-ce2f-eb64-6a45-a4544ec539a9", ALL_SIDES);
  llSetTextureAnim(ANIM_ON, ALL_SIDES, 1, 2, 1, 2, 5.0);
 touch_start(integer total_number)
  // Curiously, we have to switch the animation off first.
  llSetTextureAnim(0, ALL_SIDES, 1, 2, 1, 2, 0.0);
  // Now run the animation once.
  llSetTextureAnim(ANIM_ON, ALL_SIDES, 1, 2, 1, 2, 5.0);

Finally, some useful (I hope!) notes:

Finding the prim face: You’ll notice that in the above scripts I have specified ALL_SIDES as the side to apply the texture and animation. A lot of the time you will want to put the texture and animation on one side only. The easiest way to find out the side number of a prim face is to use the Advanced (or Debug) menu.

To active or deactivate the menu, hold down CTRL+ALT+d on your keyboard. The Advanced menu should appear on the main Second Life menu.

Once this menu is showing, edit the prim you want to investigate. Click the ‘Select Texture’ option, and select the face you want to check. Then hold down CTRL+SHIFT+ALT+t on your keyboard. Details of the texture will appear in the bottom-left of your screen, including the face number.

Switching off animations: If you want to switch off the animation on a texture, simply pass zero as the flag. The other parameters are irrelevant:

llSetTextureAnim(0, ALL_SIDES, 1, 1, 1, 1, 0.0);

Texture Size: remember that a texture with multiple frames can easily be very large indeed, and Second Life still has to load the entire texture (no, it doesn’t load it frame by frame!). Creating an effective animation using a minimum number of frames is a skill in its own right.

The LSL Wiki has additional useful information:

Note: I’ve edited this post to remove the remarks about No Mod, No Copy, No Transfer and Mod, No Copy, No Transfer, when it was pointed out by a couple of commenters that these combinations are actually impossible.

I was originally going to write a brief article about the technical details of putting items up for sale, and I will still do that at some point, but as I was writing it I found that I had a lot to say about permissions. As permissions are something you have to give serious thought to if you want to sell things, I’ve decided to devote an entire post to it. I’ll assume that you already know how to set permissions (if you don’t, they are on the General tab of the Build dialog).

Permissions are a thorny subject, with wildly differing views. What I am going to do is to examine the ramifications of each option and (more importantly) of each combination of options. I’ll also give my own opinion on each of various options, but you should realise that there are plenty of merchants out there who will have quite different ideas. Be prepared to give the whole subject some very careful consideration!

First, let’s look at the individual permissions.

Mod means that the purchaser can freely change the object, using the Build tools. No Mod means that the purchaser cannot modify the object in any way other than simply moving or rotating it. They can’t scale it, they can’t change the textures, they can’t break it up (assuming it consists of more than one prim).

For most objects, No Mod is a sensible option. However, if you are selling clothing attachments (for example, hats), you might want to allow modification so that the purchaser can adjust the size of the object to fit their avatar (regrettably there is no way to restrict the types of modification that are allowed — it is all or nothing). In fact, some people might be reluctant to buy such items if they are not moddable.

Copy means that the purchaser can create multiple copies of the item (but only for themselves — they cannot pass these copies on to anyone else). This has some less than obvious effects. When a Copy object is rezzed, the original remains in the Inventory. If the owner deletes the rezzed object, they still have the original. If they mod the object (assuming it is moddable), the original is unchanged, and if they wish they can take a copy of the amended object back into their Inventory — they will then have two copies, both the original and the altered copy.

No Copy means that the purchaser cannot create multiple copies of the item. They will not be able to Copy and Paste the object within their Inventory (although they can move it around in the Inventory), and when they rez the object it will vanish from their Inventory.

Many merchants specify No Copy. Unfortunately, many purchasers (myself amongst them) are reluctant to buy No Copy items. The main reason is Second Life’s notorious flakiness. I have had experience myself of rezzing a No Copy object, seeing it vanish from my inventory, but failing to rez. If you are lucky, it might be returned eventually, sometimes to the Lost and Found folder. More often than not it is gone for good. Or rather, for bad.

The other reason for Copy applies to clothes. I have separate folders for each costume that I wear. In many cases these costumes are customised — I have built them by combining clothes from different merchants. Often I have an item that I want to use in more than one outfit, so I want to create copies in several different folders. From my point of view, it is a convenience for me — with No Copy items I would have to go to different folders in order to put together a specific costume. From the merchant’s point of view, I can only ever wear one copy at a time, so they are not losing out (and I’m not going to buy multiple copies just for convenience).

Nowadays I hardly ever buy clothing that is No Copy.

No Transfer means that the purchaser cannot give or sell the item to someone else. This is a very common option, but there is a catch when the purchaser wants to buy the item as a gift for someone else — this option stops them from doing that. A good solution is to create a special ‘gift’ version of the item, specifying Transfer and No Copy. With this option the purchaser can give the item to someone else, and it will be removed from the purchaser’s inventory. Of course, this goes against what I have said above about No Copy items, but there really isn’t a lot of choice in this case. You probably just need to be prepared to deal with the occasional loss of such gifts, when Second Life fails at the crucial moment of transfer!

But this is starting to get us into combinations of permissions, so let’s take a look at the other possible combinations, and what the implications are. I’ll begin with the probable no-nos:

Mod, Copy, Transfer, and the closely related No Mod, Copy, Transfer. Probably fatal, unless this is a freebie that you don’t mind being copied and given or sold on to any number of other people. For items that you want to make a profit out of, this is a very unlikely combination!

Ok, now for the more useful combinations.

No Mod, No Copy, Transfer. As I mentioned above, you can use this for items which are to be sold as gifts, but be prepared to deal with the occasional fall-out. Only use this combination if you are also selling a version with Copy and No Transfer options.

You could feasibly have Mod, No Copy, Transfer to allow moddable gifts (for the clothing attachments I’ve already mentioned). This is workable, but again be prepared to deal with problems. If the receiver of the gift mods it and breaks it, how generous are you going to be to them when they ask for a replacement?

No Mod, Copy, No Transfer. My favoured set of permissions, both for selling and for buying (except for clothing attachments, where I look for Mod as well).

Oh, while I’m at it, some merchants sell items with different permissions for different prices. Usually this means a No Copy version and a more expensive Copy version. Personally, I think this is a good compromise — I’m certainly prepared to pay a little more (but not too much!) for a Copy version, and I understand and empathise with the motives behind it.


When it comes to permissions, textures are an oddity. They are only usable by the purchaser if they come with full permissions – Mod, Copy, Transfer. This means that once you have sold the textures, the purchaser can do absolutely anything with them, including passing them on to other people. If you think about it, you can probably see why this is the case — if a texture is used on an object which is going to be sold, the texture has to be transferred along with the rest of the object. In a similar fashion, the texture has to have Copy, otherwise the purchaser could only make and sell one single item with that texture.

Does this mean there is no point in selling textures? Maybe. Personally, I have sold (and still sell) packages of textures, and make a good profit from them, in spite of my inability to restrict the usage of them. You might prefer not to take the risk.

You can, of course, accompany your textures with dire warnings about copyright, and threaten people with DCMAs. It might work, I’ve never tried it. It’s your call.

If you want to make textures your central product (and some people, such as Lauren Fox, seem to have done this successfully) you need to decide how much you are going to worry about people copying your work. If the answer is “a lot”, you might want to reconsider.

One final point. When you are selling your items, make sure that the permissions for them are clearly visible (either in a nearby advert, or on the box, if the items are boxed).

Brief, Opinionated Summary

  • Mod, Copy, Transfer – give-aways/freebies only!
  • Mod, Copy, No Transfer – good for clothing attachments
  • Mod, No Copy, Transfer – for moddable gifts
  • No Mod, Copy, Transfer – give-aways/freebies only!
  • No Mod, Copy, No Transfer – my favoured default
  • No Mod, No Copy, Transfer – for gift

This is a simple but effective way to create a ‘draped cloth’ effect that can be used as the base texture of (for example) capes or curtains. I’m afraid that this one is specific to the Gimp graphics program, although possibly other programs will have similar features.

Start with an empty picture, at a large size such as 512 x 512, or even 1024 x 1024. I do this with all my textures. Starting large and scaling down usually works well, and sometimes actually improves things by removing or hiding small glitches, whereas it is well-nigh impossible to get good results by starting small and scaling up.

Find the Solid Noise option, under the Filters/Render/Clouds menu.

Set the options so that the X size is set to the maximum, or somewhere near it, and the Y size is set to the minimum, 0.0. You can try experimenting with different values, but you need to be aware that setting the Y size to anything other than the minimum can make it more difficult to create a seamless texture.

You should already see the drape effect.

If you want to increase or decrease the ‘depth’ of the effect, use the Brightness and Contrast — lowering the Contrast will make the effect shallower, increasing the depth (especially in conjunction with decreasing the Brightness) will make the effect deeper.

I would now colorise the texture. Select the Colorise option. Adjust the Hue slider to get the colour you want. Play with the other two sliders to tweak the result.

At this point, the drape will tile horizontally, but probably not vertically. There is a fairly easy way to fix this.

Start by selecting the top half of the image (you don’t have to be exact, but make sure that the top edge is at 0). Feather this fairly drastically, possibly to something like 50 pixels, then copy it. Paste it back in, flip it vertically, then move it down to the bottom, being careful not to move it horizontally.

If you find that the texture does not tile horizontally, you can apply a similar technique to the left and right sides of the texture.

The end result should be tileable. This technique of copying and pasting the top/bottom (and equally the left/right) halves of an image can often be used to make an image tileable if it has right/left or top/bottom symmetry.

Here is an example of the final result:

Drape texture