10-18-2004 17:00
Birth of an industry.

The TV business has been good to me. It has been a learning experience, a creative experience, and most importantly a profitable experience.
After selling various forms of TV and Video content to SL residents for a year and a half I am retiring from the business I developed and pushing an industry into being.
Here, today, I will give you all the info you could need to create and sell your own TV's and Video. Good luck and I hope some of you are successful in pushing the limits of the medium to ever greater heights. Without further words, lets get to it.

What you need.

1. You need a callable script that will play animated textures of various length and speed. This script is provided.

2. You need a program that will automatically allign images into a grid otherwise it will take alot of time to lay out your animated texture in photoshop. I use ImageMagick. I think you can download it here - http://imagemagick.sourceforge.net/

3. You need an image converter. I use photoshop.

4. For video conversion I use flash, although it's not required to make animated textures, I'll be using it in the following example.

5. You need two prims. 1 to act as the TV and display your video and the 2nd to act as the button that tells the 1st prim what to display.

The animated texture.

Animated textures are what you need to display video in the world of SL. Animated textures are a grid of smaller images that when played quickly on a prim appear to be video. You can make animated textures out of almost any type of modern computer video format including mpeg, mpg, avi, wmv, etc. Animated textures work best in SL if the image grid consists of even numbers. 2x2, 2x4, 2x8, 4x4, 8x8, and 8x16 are all good examples. Currently the fewer number of individual image frames you have the better. SL suffers a performance hit when large data size animated textures are running nearby, so think of your neighbors when making your animated textures.

How to make an animated texture from video.

Create a file folder in your main directory. Example - c:\video

Once you have your video clip selected I recomend using macromedia flash MX or newer to edit your video. First, open flash and import your video by choosing FILE - IMPORT - IMPORT TO STAGE. Once you have your video in flash you can adjust you flash document to match the size of video you have or the desired video output you want to display. Next select FILE - EXPORT - EXPORT MOVIE. Export the movie to your c:\video file as "test.jpg". Now close your current work in Flash. Now open a new Flash document and size it to the size of the video you just exported. Now, select FILE - IMPORT - IMPORT TO STAGE and select the file c:\video. When you open that file in your Flash Import window you will see a series of images in that window all named test001.jpg, test002.jpg, test003.jpg, test004.jpg, etc depending on how long your clip is. Now select the first test001.jpg. Flash will ask you if you want to import the entire series. Click "YES" and the images will be layed out in your workspace one after another. At this point you can now more accurately delete frames to get the exact number you want. You could also add bars, titles, etc at this point. When you have an even number of frames and are satisfied with the edit you have then you are ready to export again. Select FILE - EXPORT - EXPORT MOVIE and name this movie "final.jpg". Now in your file named "c:\video" you will hopefully have an even number of images named final001.jpg, final002.jpg, final003.jpg, final004.jpg, etc. Now you can move on to the next part of creating your animated texture.

How to make an animated texture from still images.

If you use the previous example of making an animated texture from video you will already have a file named c:\video. If not, please create one now and place the even number of images you want to use in your animated texture within this file. Now for XP users you need to open a command prompt. Go to START - RUN. You will get an open window with a prompt for a command. Type "cmd", and click "ok". You will now get a command prompt, at this prompt type "cd\" and hit enter. Then type "cd\video" and hit enter. At this point you should have already installed ImageMagick, if so type at the command prompt "montage".

Now you are ready to convert your images into a grid or animated texture. ImageMagick is capable of doing alot of things but for our needs here we will only use one basic command. This is an example - "montage -geometry 640x480 -tile 4x8 video*.* video.jpg"

The 640x480 is telling the program the size of the images being used. This can be changed to work with your project.

The 4x8 is telling the program how many frames across and down you want your animated texture. In this case we have 4 across by 8 down for a total of 32 frames. This can be changed to fit your project.

video is the name of the image series you want to convert. As long as your series is numbered like the example above then the program will select your images for conversion.

video.jpg is the name of the output image that you will get after conversion.

After you have the command set for your need, enter it at the prompt and press enter. After ImageMagick coverts your image just look in your c:\video file and you will find it there. You now have an animated texture. With a little practice you will be able to convert your clips to animation in no time. I recomend loading your animated texture image into a program like photoshop and sizing it down and optimizing it, but thats entirely up to you.

How to display callable animated textures in SL.

After you are happy with your animated texture image log onto SL. Upload the image like you would any other and it will now be in your inventory.

Now create a prim in SL that matches the dimensions of your original animated texture images. Name it for this example "r1". This prim will be your TV.
In the TV drop the following script:

CODE

list args;
string cmd;
string obj;
integer x=1;
integer y=1;
integer tag=0;
default
{
state_entry()
{
llWhisper(, "");
llListen(000000,"","","");
}

touch_start(integer total_number)
{
llWhisper(, "");
}
listen(integer channel, string name, key id, string message)
{
args=llParseString2List(message, [" "],[":"]);
obj=llList2String(args,0);
cmd=llList2String(args,1);
args=llDeleteSubList(args,0,1);
if (obj==llGetObjectName() || obj=="P0" || obj=="A")
{
if(cmd=="lock")
{
tag=0;
}
if(cmd=="unlock")
{
tag=1;
}
if (tag==0)
{
if (llList2Key(args,0) != llGetOwner())
{
cmd="do nothing";
}
else
{
args=llDeleteSubList(args,0,0);
}
}

if(cmd=="trans")
{
llSetTexture("",4);
}
if(cmd=="logo")
{
x=1;
y=1;
llSetTexture("",ALL_SIDES);
llScaleTexture(1,1,-1);
llOffsetTexture(1,1,-1);

}
if(cmd=="offset")
{
integer face=llList2Integer(args,2);
if (face==0)
{
face=4;
}
llOffsetTexture(llList2Float(args,0),llList2Float(args,1),face);
}
if(cmd=="scale")
{
integer face=llList2Integer(args,2);
if(face == 0)
{
face=4;
}

llScaleTexture(llList2Float(args,0),llList2Float(args,1),face);
}
if(cmd=="tex")
{
integer face=llList2Integer(args,3);
if (face==0)
{
face=4;
}
x=llList2Integer(args,1);
y=llList2Integer(args,2);
if (x==0 || y==0)
{
x=1;
y=1;
}
llSetTexture(llList2String(args,0),face);
llScaleTexture(1 / (float)x,1 / (float)y,face);
}
if (cmd=="font")
{
x=40;
y=8;
llSetTexture("",4);
llScaleTexture(1 / (float)x,1 / (float)y,4);
}
if (cmd=="color")
{
float r=llList2Float(args,0);
float g=llList2Float(args,1);
float b=llList2Float(args,2);
integer face=llList2Integer(args,3);
if (face==0)
{
face=4;
}
llSay(0,(string)<r,g,b>);
llSetColor(<r,g,b>,face);
}
if (cmd=="reset")
{
llResetScript();
llSetTextureAnim(FALSE,4,40,8,0,1,1);
}
if (cmd=="frame")
{
float f=llList2Float(args,0);
llSetTextureAnim(ANIM_ON,4,40,8,f,1,1);
}
if (cmd=="anim")
{
float start=llList2Float(args,0);
float length=llList2Float(args,1);
float fps=llList2Float(args,2);
integer loop=llList2Integer(args,3);
integer face=llList2Integer(args,4);
if (face==0)
{
face=4;
}
if (llList2Integer(args,3) ==1)
{
llSetTextureAnim(ANIM_ON|LOOP,face,x,y,start,length,fps);
}
else
{
llSetTextureAnim(ANIM_ON,face,x,y,start,length,fps);
}
}


}
}
}

The above script can be modified in various ways to do many different things. As it is it will display whatever texture it is told to on the prim it is in. It will listen for the channel you set. Be sure to set your own channel towards the top of the script where it says llListen(0000000,"","","";);

Now you need to make your playback button. This button will speak the command to play your animated texture on the TV. Start by creating a prim. In that prim put the following script:
CODE
key owner;
default
{
state_entry()
{
owner=llGetOwner();
}
on_rez(integer i)
{
owner=llGetOwner();
}
touch_start(integer total_number)
{
llWhisper(000000, "r1 tex "+(string)owner+" 339e5236-4ef4-0ee7-a4ba-a9d7215cd9e0 8 8 -1");
llWhisper(000000, "r1 anim "+(string)owner+" 1 64 8 1 -1");
}
}



The above script will tell the TV what to play, how to play, and how fast. The first thing you need to edit it this line:
llWhisper(000000, "R1 tex "+(string)owner+" 64960f0a-3fde-854d-a37f-cb2ee103f599 8 8 -1";);
You need to edit this long number "339e5236-4ef4-0ee7-a4ba-a9d7215cd9e0". That number is a UUID. Every texture in SL is assigned a UUID. By entering a UUID there, the TV will know to play that texture when this object is clicked. To get the UUID of your texture simply find it in your inventory and right click on it. Select COPY UUID. Then paste the number in place of the example UUID. Make sure you leave the intended space after you paste in the UUID, otherwise your TV may not function correctly.

Next you need to edit this line:
llWhisper(000000, "r1 anim "+(string)owner+" 1 64 8 1 -1";);
This part of the line needs to be edited: owner+" 1 64 8 1 -1";);
The first 1 tells us that we are going to play frame 1. The 64 tells us we are going to play 64 frames on this particular texture. 8 tells us the texture will play at about 8 frames per second. The next 1 will tell the TV to loop the animated texture, a 0 instead of a 1 will tell the TV play the texture only one time through. The -1 tells the TV to play the texture on all sides of the object.

If you are patient and follow the instructions and have some previous scripting experience you should be up and running in no time. I expect to see a whole new industry come alive here in SL and I can't wait. I'm sure many of you will upgrade this concept and develop many additions that we will all love. I can't wait. Till then I am glad to retire from this SL "job" and move onto other adventures. Good luck in your creations and enjoy yourselves.

My store, Video Emporium will be up and running for a few days more and after that it will be a memory. If you need a place to get ideas on how to implement your scripts please feel free to stop by and check out the TV's and vids in the store. Everything is still for sale and will be till close. Close will mark the end of thousands of vids sold to SL residents and I expect that number will be surpased many times now that you all know the way. Finally!
_____________________
Did this post appear in a BD thread or qoute BD?
Cue libelous meltdown.