Join us in Outworldz at www.outworldz.com:9000 or follow us:

Making your own 3-D moving water in Second Life

This article will show you how to easily and simply change the shape of a prim dynamically with a script to make water move up and down in Second Life.

Here is a video of what it looks like in action:

We'll use two free tools to make sculpts : Animation Shop Pro and SL_Prim_Emboss. You can download a copy of the Animation Shop program from download page or from this link. You will need to install it. SL_Prim_Emboss is a stand alone executable program, with no needs to be installed. Grab it at the download page.

We are going to need a texture of water actually moving. A quick search with Google images brings up a nice GIF. ( It helps if you add 'filetype:gif' to your search for animated water)

water ripple GIF file

Obviously there are an unlimited number of ways to make water ripple. I picked this one because it is tileable, and you can make arbitrarily large areas with it, on a web page, or in Second Life

We'll need to make this Gif into separate images. The tool I use is Animation Shop 2 which is a part of Paint Shop Pro. This is a extremely useful tool for making GIF files.

After you install Paint Shop Pro, open the water.gif in Animation Shop 2. You will see the GIF laid out as separate frames:

Anaimtion Shop Menu

In this case, we are just going to grab the frames out and poke them into SL Prim Emboss.

Go ahead and start up SL Prim Emboss in another window:

Once SL Prim Emboss is open, all you need to do is click each frame in Animation Shop, press Ctrl-C, then click the Paste Image button in SL Prim Emboss and your first frame is ready!

It's just too simple! The first time I tried this I went to the trouble of extracting all the frames, loading them into a Paint program, and then copying and pasting. It's just too simple to click, Ctrl-C, and click!

Now click Generate 256X256 and then click save. The program will put the sculpt map into whatever directory you saved it into. In my case, I saved it on my desktop, so the sculpt map appeared on my desktop. You don't get to pick a destination.

Generate Image

Repeat for reach frame in your GIF image until you have all three images saved:

These are the frames converted to sculpts by SL-Prim-Emboss.

pic 1 pic 2 pic3

Upload all three images to Second life.

Make a simple, cube prim, and select the Content Tab.

Drag and drop all three images inside the Content tab.

Click New Script, double thick the New script that appears and copy and paste this script inside:
By the way, the the best place to get this script is from the download link in my Script Repository. HTML sometimes creeps in when you scrape scripts off the web page.

//Author Ferd Frederix
// Open Source, Creative Commons with Attribution.  Please leave the headers intact

integer nItems=0;
integer currentItem = 0;

default
{
	state_entry()
	{
		llSetTimerEvent(.10);
		nItems =llGetInventoryNumber(INVENTORY_TEXTURE); // When we wake up, count the 
			//number of sculpts to play
	}

	timer()
	{
		string name = llGetInventoryName(INVENTORY_TEXTURE,currentItem); 
			// get the name of the current sculpt
		if (++currentItem >= nItems)	// wrap at end
			currentItem = 0;


		llSetPrimitiveParams([PRIM_TYPE,PRIM_TYPE_SCULPT,name,PRIM_SCULPT_TYPE_PLANE]); 
			// put the sculpt map on the prim
	}
	// If they drag a new texture in, start over
	changed(integer type)
	{
		if (type & CHANGED_INVENTORY)
			llResetScript();
	}
}



edit water texture You can also color your water. I used one of the original frames from the Gif, and colored it blue. This is what it will look like if you make it a bit transparent and stretch it out :

Water stream

You can also add my Water 2.0 script to this prim and make it splash when you poke your finger. errr, mouse in it. Just make another script, and copy and paste the code from the download link. You can touch the water with your mouse using Viewer 2, and stir it!

Back to the Best Free Tools in Second Life and OpenSim.