Making an Animated Texture for Second Life

 Animated Textures for Second Life

Animated textures in Second Life work differently than animated gifs. Now there are scripts and software out there that will let you convert animated gifs into images that will work in Second Life, but if you make them yourself you will have much more control over the outcome.

All animated textures in Second Life work by adding a script into the object the texture is on. There are two general categories for animated textures, ones that move around one from, and ones that change frames.  The ones that move around a single frame are the easiest, because to animate them you just need a script to slide, rotate, or zoom in and out of the texture. The ones that change frames require you to set up an image with multiple frames; these are the ones this tutorial will cover. For examples of the lines of script you would need to animate your texture please visit http://wiki.secondlife.com/wiki/LlSetTextureAnim .

On the image you have to divide it up into frames. Each frame will be an image shown on the face of the prim. The script will dictate the older in which the frames are played, on which frame the animation will stop and start, and how fast it will be played.

When creating the texture for the animation, there are a few things you must take into account:
- The size of the object you are putting the animated texture on. The larger the object, the more stretched out the texture will be. Large textures should be used sparingly in order to avoid lag, but if the animation is too blurry then you should increase the image size. Keep in mind that Second Life has an image limit of 1024x1024, and anything bigger than that will automatically be reduced to 1024x1024.
- How long the animation will be. The longer the animation, the more frames you will need. The more frames you try to put on an image, the smaller the frames will have to be in order to fit them all on the texture. That will also cause the animation to be blurry. The size of the image and the size and number of frames, this method of creating animations is extremely limited, and so it is difficult to get clear results.

Once you have decided on all of the fore mentioned attributes then you can start to make up your texture.  The most common programs used to do this are Photoshop, Gimp, and Genetica.

https://www.adobe.com/products/photoshop.html
https://www.gimp.org/
http://spiralgraphics.biz/genetica.htm

This tutorial will focus on using Adobe Photoshop CC 2018.
For this example the image size will be 1024x1024 for clarity. Since this tutorial came by request of the user, the steps will cater to their needs, but please note, many of the steps are not required. In general, when creating the texture you just need to scale the images down to the size of the frames and put them in order from left to right, top to bottom.  But as per the request, the rest of the tutorial will be looking to how to take an animated gif and turn it into a repeating animated texture for Second Life.


Take the animated gif and open it in Photoshop.  That should automatically activate the timeline at the bottom of the screen. You can use the timeline to scrub through the animation. You can go through the gif and copy still images and paste them into a new 1024x1024 image. Those pasted images will be the frames. The next step is to select all the images and resize all of them that you pasted. Control + T is the short cut. You resize all of them at the same time so that they are the same size. Make sure that you have snapping on. It should be on automatically. Then move the images in order from left to right, top to bottom.  That will make an animation that will run through but will have a glitch at the end. In order to make it seamless you need to make the first frame/image flow into the last. That can be done a number of ways, the easiest is just pasting the first over the last and change the opacity to 50%.  For a better final image you would need to cut and paste certain parts to make it flow better.
When you are finished editing it, you can output it as a png. Then upload it into Second life.
Apply the texture to the object you wish to put it on then add a script, with the following line:

llSetTextureAnim( ANIM_ON | LOOP, ALL_SIDES, frames_across, frames_vertical, starting_frame, total_number_of_frames, speed_of_animation );

Above is a small example with the description of what each number should be. Below is the type for each number.

Function: llSetTextureAnim( integer mode, integer face, integer sizex, integer sizey, float start, float length, float rate );

Example:
This divides a texture into 64 "cells", 8 across, and 8 down, and flips through them, left to right, top to bottom. This is useful for cell animation.

llSetTextureAnim( ANIM_ON | LOOP, ALL_SIDES, 8, 8, 0.0, 64.0, 6.4 );

Comments

Popular posts from this blog

Curves and Nurbs in Maya

Open Collar Themes