Wednesday, August 15, 2007

More Fun with Media

The release notes for the recent update to the Second Life client said, much to my delight, that streaming video was now available in the Linux client. Well, a number of us have had trouble getting it to work, even though we've got all the dependencies installed.

Someone posted, in one of the video troubleshooting threads, that he thought we were all trying to view videos with too high a bitrate, and suggested we go by his store to try out his TVs. In plugging them, he said that they:

can coexist with land media, this allows private landowners to still use their 'pay per view' media to run in their skyboxes and private theatres, without interferring with all their tennants at ground level having their own TV channels, even in the same parcel.
Well, this sounded interesting, especially given my video vendor project, so I dug into the LSL Wiki and saw an option for llParcelMediaCommandList() which I hadn't noticed before: PARCEL_MEDIA_COMMAND_AGENT.

When you pass this option in, followed by an avatar's UUID, it doesn't change the media settings for the parcel, like it normally would - it changes the settings just for the specified avatar.

So if you wanted someone to see a random video when he or she touches a prim, but not affect anyone else, you might do something like this:

key theVideoTexture = "12345678-9abc-def0-1234-56789abcdef0";
string VideoBaseUrl = "http://www.myserver.com/videos/";
list RandomVideos = [ "video1.mov", "video2.mov",
"video3.mov", "video4.mov" ];

PlayVideo( key theAvatar ) {
integer VideoCount = llGetListLength( RandomVideos );
integer theVideo = (integer) llFrand( VideoCount );
string VideoName = llList2String( RandomVideos, theVideo );  
llParcelMediaCommandList([
PARCEL_MEDIA_COMMAND_AGENT, theAvatar,
PARCEL_MEDIA_COMMAND_TEXTURE, theVideoTexture,
PARCEL_MEDIA_COMMAND_URL, VideoBaseUrl+VideoName,
PARCEL_MEDIA_COMMAND_LOOP
]);
}

default {

touch_start( integer numTouchers ) {
integer i;
for (i = 0; i < numTouchers; ++i) {
PlayVideo( llDetectedKey( i ));
}
}

}

Even though the object is affecting an avatar, and not the parcel, it still follows the parcel media permissions rules. If you don't own the land the object's on, the object must be deeded to the land's group - so it's a good idea to include some way for the object to delete itself when you want it to. The video texture should be the UUID of a texture on the prim that will be replaced by the video.

Yesterday, I wrote a video vendor kiosk, similar in operation to some of the JEVN vendors (a main static display button/pay receiver, four smaller buttons for changing the product on the main button, and Previous/Next buttons), with the addition of a large video screen which will show a movie of whatever product is on the main static display.

Because it uses the PARCEL_MEDIA_COMMAND_AGENT option, it works without affecting video for any other residents in the parcel, so it doesn't require the parcel to be subdivided to the shop or booth the vendor is in. :)

Configuration is via notecard, but with all the functionality I put into it, it quickly runs out of space - with only twelve products in the vendor (including landmark, vendor textures, info notecards, and sometimes multiple items per product), available script memory is down to less than 2K. I guess the next step would be a networked vendor which communicates with a Web server, rather than keeping the lists of product names, prices, descriptions, textures, video URLs, and so forth in the script memory.

Monday, August 13, 2007

Voice on Linux - partway there

Somebody on the Linux Client Users group mentioned a wrapper script to run the Windows voice client in WINE, providing limited functionality of the voice client under Linux. I found the script attached to an issue in JIRA, then downloaded the Windows client, extracted SLVoice.exe and the libraries it depends on, and copied them into my secondlife directory.

It works... kind of. It takes forever to get connected to voice, and it disconnects after a very short time - but I did manage to hear somebody say part of a sentence!

Sunday, August 5, 2007

HUD Fever

A couple of days ago, someone posted a comment on one of my entries, saying that she'd seen the emotion buttons running down the side of some of my screen shots, and asking what HUD lets me do it.

As a matter of fact, it's a HUD I wrote a few months ago (and which, quite coincidentally, I had put up for sale in my store only a couple of hours before she posted her comment). I love HUDs, and if you design them properly, they can actually be really simple. The example HUD I made for LSL205 (a jump assistance HUD, shown at the right, which lets you select from five different jump strengths) consisted of six prims, one texture, a main script of 19 lines (not including comments and blank lines), and a 28-line script that goes into each of the five buttons.

I've made quite a few HUDs, come to think of it. There's the class schedule HUD I blogged about a little while ago (which is actually pretty complex, admittedly); the aforementioned emotion HUD; a HUD I made for landscaping (I loathe the built-in "Edit Land" tool, I always end up making things look worse than when they started); a favorite-places teleporter HUD; a "PowerPoint" controller HUD...

Students seemed to have so much fun with the jump assist HUD that I'm planning to teach a workshop just on designing and making HUDs - the one in LSL205 was really only a demonstration of link messages, and I didn't really get into the planning, texturing or physical construction of the HUD.

Now I just need to decide what the example HUD for the workshop should do. Time to hit the LSL Wiki and look at function names until an idea germinates, I guess.

Saturday, August 4, 2007

Video Vendors

One of the problems I've found with trying to sell jewelry is that, especially for the finely-detailed pieces, a static image on a vendor doesn't really do it justice. You want to give the customer the ability to see it from all angles, and close up. Even worse - if you're selling a scripted object, how do you show it in action?

So today I wrote a simple "video vendor" system for my store - individual vendor boxes which, when touched, communicate with a video screen. The screen sets the parcel's video media URL, resets the texture repeat and offsets on the main face to match the video's dimensions (so that "Auto scale content" doesn't need to be enabled), and starts the video in looped mode.

Maybe one day I'll even get to see it in action. The 1.18.1(2) release of the viewer purportedly added streaming video support for Linux users, but many of us can't get it to work.

(Next, multi-vendors and networked vendors! Muah ha ha ha ha!)

Thursday, July 26, 2007

Shameless Vote Whoring

Now that the Mozilla library has been incorporated into the Second Life viewer, it strikes me that it might be possible for the non-working llSetPrimURL() and llRefreshPrimURL() functions — which were intended to display a Web page on a prim, but which (to my knowledge) have never actually worked — could be made to trigger a client-side retrieval of the specified Web page, which would then be rendered to a (local) texture and displayed on the prim, in much the same way that media textures are.

And since the page retrieval would be done client-side, it wouldn't cause any appreciable lag on the Second Life servers.

I've created a JIRA feature request about this. If you think it would be nifty too, please vote for it! Tell your friends! Tell all your alts!

Wednesday, July 25, 2007

Why was I not told this?

You can put a script into a prim without having it automatically start running, by holding down the CTRL key as you drag it from your inventory.

Monday, July 23, 2007

Yet More Schedule Stuff

In between working on classes (I'm up to five now; the latest one will debut Thursday evening, and will cover dialogs, link messages, HTTP and XML-RPC communication), I've been back at work on more schedule stuff.

My latest device is a HUD for students, showing the next five classes scheduled to be taught at Rockcliffe:


Unfortunately, for the text to be readable, it does have to take up a hefty amount of screen space, so the Rockcliffe logo serves as a minimize/restore button:


Features include:

  • "Class Info" buttons cause it to tell its owner more information about the selected class (full class name, date and time, teacher's name, location, duration, etc.)
  • "Teleport!" buttons bring up the Map screen, with the classroom location selected
  • The green "?" button delivers a notecard with usage information
  • The "Preferences" button brings up a dialog with several options:
    • Alarms On - causes the HUD to play a sound and pop up a dialog indicating that one or more classes will be starting in ten to fifteen minutes (and identifying which classes)
    • Alarms Off - suppresses the class notification
    • TP to RUSLC - brings up the Map screen, with Rockcliffe's reception area selected
    • RU Website - Loads the Rockcliffe University Web site into the user's browser
    • Schedule - Loads the Rockcliffe class schedule into the user's browser
But the stuff that was the most fun to do is all behind the scenes:
  • Checks the schedule about once every five minutes
  • If a new version is released, the HUD is automatically updated the next time the user visits the Rockcliffe sim
  • All the hardcoded URLs (the location the script the HUD communicates with to download the schedule, the Rockcliffe Web site, and the schedule Web page) can be changed by the server-side script without requiring a full update, in case of a site move, page relocation, etc.
  • When downloading the schedule, it passes version information to the server-side script, so that new features may be implemented without breaking older versions of the HUD
One of these days, I will actually finish building my house and make more jewelry...

Monday, June 25, 2007

Fun fun fun!

In between business trips and sickness, I've had precious little SL time lately. And what time I've had has been spent on Rockcliffe University.

First, I've been developing and teaching classes in scripting (three have been completed, and I'm nearly done with the fourth). It's shocking how much time it takes to come up with one class; even though I've already got the first twelve classes outlined, there's lecture text to write (and proofread, and verify to make sure every sentence is accurate), examples to script and test, "Powerpoint" slides to create. And then go through the lecture a couple of times and try to anticipate students' questions, then rework the text to preemptively answer them...

But since I can't really play in Second Life while I'm on a trip (I tried once, and my laptop overheated and killed the master boot record of the hard drive, so I won't be doing that again!), I've been working on the class scheduling application, which has been a lot of fun to do.



We're getting a dedicated server set up, which will run a whole bunch of off-the-shelf software (Moodle, forums, etc.), but I developed a customized scheduling database in MySQL, with a PHP frontend. This will display the upcoming schedule in several formats (the simple list as shown here, a calendar view, an RSS feed, etc.), and permits the teachers to post and modify their own classes. But where it really shines is in its communication with Second Life.



First, it automatically updates an in-world schedule board. Classes will disappear from the board fifteen minutes after they've started, and as new classes are added to the database, they appear on the schedule board. Unless explicitly overridden, each class displays in an alternating color to make it easier to read the board. After a week or so of testing, I'll be able to replace the current version in the reception area with the new auto-update board. Another improvement is in primmage: the new board has 33% more characters (80x24, as opposed to 72x20), while still reducing the number of prims by about 20%.

Another component which I'm working on now is a smaller board which displays the names of the classes currently in progress, with a "Teleport!" button to take a student directly to the classroom. Other components will include classroom detectors which send the list of students to the database, to keep track of attendance; and tip jars which record the amounts given during a specific class (for sharing the tips between the university and the individual teachers).

All this is accomplished with the HTTP and XML-RPC functions of the Linden Scripting Language (which will be the subject of one of the classes in my scripting course).

Maybe one of these days, I'll have enough free time to actually build a house on the land I'm renting!

Wednesday, June 13, 2007

Hate Voice?

Switch to Linux!

Not only is there no Linux voice-enabled client, but the Lindens steadfastly ignore anyone who comments on the official blog to ask about when we'll get one.

Thursday, May 24, 2007

...Sculpted jewelry!

A really simple set to start out with, while I design more complex things.


The necklace and the earrings, following my tradition, are scripted so the gem and metal colors can be independently changed. The sculpted heart has my usual nine colors: amethyst, blue topaz, citrine, diamond, emerald, garnet, ruby, sapphire and topaz.


And I finally have a better store location, on Flotsam Beach. Part of what makes it better is that I can actually make landmarks and SLURLs which teleport directly there. Also it's bigger, it's not stuck in the back corner of a mall with little foot traffic, and it's in a beautiful new themed sim (an Atlantic beach resort).

I have to design up a nice floor plan, but until that's done I've just stuck vendor boxes on the walls.

Thursday, May 10, 2007

More sculpted gemstones

...and I get back to my Linux machine to discover that they still don't have voice chat in Linux!

Oh well, at least I can play with the sculpted prims on a decent machine for now. I know gemstones are a trivial example of what's possible with sculpted prims, but I'm excited by the thought of more interesting varieties of stones to make jewelry with.

Last night I started all my computers (even the ancient ones) working on churning out textures. This is going to take a looong time - my fastest computer is managing about one texture every hour and forty minutes, and I've got a total of 765 textures to go through (85 gem shapes, and 9 colors for each). So far I've managed to do 62 of them; at this rate, I might have the complete collection finished by the time sculpted prims debut on the main grid. What I've got so far (click to enlarge):


Those are at the default prim size; obviously they can get much smaller. I'll need to redo the sculpting textures, though - if you bring it all the way to its boundaries, a sculpted prim is about twice the size of an unsculpted one. These are all spaced one meter apart; even though they're set to 0.5m in each direction, you can see that they're almost touching each other.

Sculpted prims can't be cut, twisted, dimpled, skewed or otherwise tortured - so the only way to make something smaller is to change the sculpting texture. For example, rather than making the color range 0-255 in each channel, you can cut the size in half by making the range 64-191. Of course, reducing the color range also means reducing the accuracy of your model. There's also a bug at the moment, where color values that get too close to each other turn the sculptures into plain spheres if you get the camera close to them.

It's odd, but I think the back sides are even prettier than the fronts (click to enlarge):

Sunday, May 6, 2007

Sculpted Prims... with POV-Ray?

Wouldn't you know, they debuted sculpted prims and the Linux voice client on the beta grid while I'm stuck on a business trip with an ancient Dell laptop that barely runs SL, and no 3D software installed? So I downloaded a copy of POV-Ray and set to work on the sculpted prims.

Now, POV-Ray is nowhere near the best choice for this sort of thing. It's just a renderer - you have to do all your modeling in another application, or by describing in plain text the mathematical shapes which make up the model. There's really no good way to accurately turn a CSG model into a texture suitable for sculpted prims. But I like a challenge, so I faked it as best I could.

First I made a texture which, when applied to a model, would give it a color based on its position along each of the three axes. The red component went from 0 where X was -0.5, through 255 where X was +0.5. Green went from 0 to 255 along the Z axis, again bounded from -0.5 to +0.5 (Y and Z are swapped in POV-Ray from the way they are in Second Life). And blue went from 0-255 along the Y axis.

But then the problem was: how to convert this into a texture which could be applied to a sculpted prim in Second Life?

Because the sculpted prim is mapped like a sphere, the first thing which occurred to me was to put a "spherical" camera in the center of the model, set the model to show up in reflections but be invisible to camera, and then surround the model with a 100% reflective sphere. This is far from perfect - as I discovered, most "undercuts" in the model don't work properly. But as long as the model is mostly convex, it works pretty well. For example, here's a simple bottle I made:



It's just a 2D Bézier spline rotated around an axis. Here's the POV-Ray code for it:


#declare t_sculpty = texture {
pigment {
average
pigment_map {
[1 gradient x color_map {[0 rgb 0][1 rgb <1,0,0>]}]
[1 gradient y color_map {[0 rgb 0][1 rgb <0,0,1>]}]
[1 gradient z color_map {[0 rgb 0][1 rgb <0,1,0>]}]
}
translate -0.5
}
finish { ambient 3 diffuse 0 }
}

lathe { bezier_spline 24,
<0.000,0.005>, <0.000,0.005>, <0.102,0.005>, <0.102,0.005>,
<0.102,0.005>, <0.102,0.102>, <0.060,0.154>, <0.214,0.212>,
<0.214,0.212>, <0.370,0.270>, <0.450,0.307>, <0.450,0.410>,
<0.450,0.410>, <0.450,0.511>, <0.450,0.957>, <0.450,0.974>,
<0.450,0.974>, <0.450,0.990>, <0.371,0.997>, <0.352,0.990>,
<0.352,0.990>, <0.332,0.985>, <0.175,0.975>, <0.000,0.975>
sturm
translate y*-0.5
scale <1,-1,1>
texture { t_sculpty }
}

sphere { 0, 1.001 inverse
finish { ambient 0 diffuse 0 reflection 1 }
}

camera { spherical location 0 look_at z*-1 }

(I got the points for the spline by drawing a curve in The GIMP, then hovering the mouse over all the control points and handles in sequence.) If you render that out to a 64x64 image (using the highest antialiasing you can!), you get this:


If you then bring that image into Second Life and use it for the sculpted prim, it'll be a really fat bottle. (The closer you can get the model to the boundaries of ±0.5 meters, the better the model will ultimately look.) So I made the bottle as fat as possible in POV-Ray, and then scaled down the prim's X and Y size in Second Life.

So that was amusing, but not very challenging - time to try something else! Admittedly, I'm not a great POV-Ray modeler; fortunately, one of my Gmail accounts had a nifty model I'd gotten from another POV-Ray user, and after a little bit of work, I got bits of it into Second Life:


It's untextured yet, but I think it's still pretty recognizable. Only the primary and secondary hulls are sculpted; the engine nacelles, pylons, "deflector dish" and top/bottom "sensor domes" are regular prims.


Because the sculpted prims use a grid of 32x32 points, some of the fine details get lost. You can see the details at the front of the secondary hull aren't very crisp; neither is the shuttlecraft bay at the back:


Still, it's an awesome addition to the SL modeler's arsenal (and this is only version one of the sculpted prims; Qarl Linden is busy at work on version two). But it looks like I need to try fighting my way through Blender's bizarre interface again if I want to do this right, as I doubt there'll be an exporter for Animation:Master anytime soon...

Addendum: And now a heart-shaped gemstone, textured appropriately!

Friday, April 20, 2007

Better Mousetrap

The schedule board at Rockcliffe University, while it looked nice, I'm told it was quite horrible to actually use. It required all sorts of strange configuration via notecards, making the weekly schedule change a nightmare.

I thought there had to be a better way. So I made a similar board - by tapering a box and then mashing it flat, three different letters could be put on a single prim. But instead of arcane configuration, I set it up so you could simply drop a notecard on it, and the text of the notecard would be displayed on the schedule board. Not too bad!

But it was kind of hard to read, and I thought it might be nice if you could change the colors for each line (or groups of lines by day), and added in a #color command which wouldn't be printed, but would set every subsequent line to the specified color, until it was overridden by another #color command. (Shown to the right; click image for a larger view. Classes which had already taken place appear in dim characters.)

And yet I still wasn't satisfied. I was already planning a Web-based schedule database, so the teachers could go in and schedule their classes, which would then appear on the Web site's calendar - so why not also automatically update the board whenever the schedule changed, or a class was over?

This required delving into the XML-RPC functions - which was an interesting learning experience in its own right. But while I was doing that, someone on the Scripters of Second Life group mentioned offhandedly that you could get five letters onto a prim. Well, that sounded like a fun challenge - not to mention cutting the number of prims by 40% - so I set about trying to do so.

Here's a graphic showing the stages of making a 5-letter text segment:


First, we start with a prism. This is the fourth icon on the "Create" pane, between the pyramid and the cylinder. I've colored the front faces red and black just for reference.

Second, set the Taper X and Taper Y both to zero, to get rid of the point on the top and make the edges straight.

Third, set the Path Cut to B=0.2, E=0.8. This cuts a wedge out of the front of the prism, giving us the faces which I've colored green and white. Those particular values leave the red and black faces each taking up one-fifth of the prim's width.

Fourth, set the Hollow to 65. This cuts into the green and white faces, showing us the interior between them (colored blue.

Fifth, set the X size all the way down to 0.010, which flattens out the prim as much as possible.

And sixth, scale the prim so that it gives us a good height-to-width ratio for text. I scaled it to <0.010,0.964,0.250> so that the letter faces were the same size as the ones on my previous version.

Next came setting the texture offsets. If you just tried to put a texture on the faces, they'd look okay on the second and fourth faces, but stretched out somewhat on the first and fifth faces, and REALLY stretched (and backwards!) on the middle face.

So if we were just going to apply a texture with a single letter to each, we'd have to change the texture repeats and offsets. From left to right:

  1. Repeat 2.5 horizontal, 1 vertical; offset -0.25 horizontal, 0 vertical.
  2. Leave at the defaults (repeat 1 horizontal, 1 vertical; offset 0 horizontal, 0 vertical).
  3. Repeat 15.4 horizontal (flipped), 1 vertical; offset -0.2 horizontal, 0 vertical.
  4. Leave at the defaults.
  5. Repeat 2.5 horizontal, 1 vertical; offset 0.25 horizontal, 0 vertical.
With those settings, you would just need to swap the textures for each face in order to display a different letter. (I did it somewhat differently, though - I made a texture with the lower 128 ASCII characters arranged in a grid, which requires a bit more computation every time the letters change.)

I'm still writing the database portion of the system, but to test the XML-RPC communication, I wrote a quick script on my Web site to contact the board in-world, display the version and time, and then include the output of the Linux fortune program, adding #color commands as appropriate:


Now I just need to add in sequence numbers so that if the Web server doesn't receive a response to its communication, it can resend it, and the schedule board won't duplicate the information if it already received it but its response was lost. And then finish writing the database front-end, of course. But still, not bad for a couple days' work!

Wednesday, April 4, 2007

Fantastic Inspiration

In Spaceport Bravo is the most amazing build I've seen in Second Life so far: a detailed reproduction of the Apollo Lunar Excursion Module. I thought I was obsessive about detail, but the scope of this build just awed me.

Lora Chadbourne, the creator of "Snowflake" (as she calls it) tells me it comprises 2370 prims and took her a month to build. And it shows, from the bracing on the inside of the hatch right down to the prim bolt heads.

A view of the exterior, compared with a picture I took of the real thing at the Kennedy Space Center:


Looking in through the front hatch:


And the control panels at which the astronauts stood (again compared with the real thing):

Utterly amazing, humbling and inspiring.

Monday, April 2, 2007

In the Webcomics

Sore Thumbs seems to have some familiarity with Second Life.

Thursday, March 8, 2007

Easily Amused

I like to stay logged into SL while I'm at work. (Addicted? Me?) With friends in different time zones, it's nice to have the option of hearing the IM chime if they want to talk to me. But of course while I'm working in RL, my avatar just sits there doing nothing.

So I made a stone pillar with the "birth-of-venus" animation in it, made a set of skins with the same texture as the pillar, and park myself on it in the Rockcliffe University arts center when I know I'm going to be away for a while. Of course I still breathe and blink, and my name still shows up above my head, so it's obvious that I'm an avatar and not a true work of art like you can find at Second Louvre — but it's a more amusing (and decorative) way to go AFK than just standing there slumped forward.

On a completely unrelated topic, while the main grid was having asset-related issues yesterday, I logged in to the test grid and explored the sewers and tunnels of Nexus Prime. I don't know whether or not it's under active development as a game-within-Second-Life, but what I found there reminded me quite a bit of Deus Ex (which is still my favorite computer game, even all these years after its release). But with so many twisty dark passages, all alike, I'm sure I haven't seen the whole thing. Even the "always turn right" method doesn't work when you've got passages going up and down as well.

Tuesday, March 6, 2007

Were they snakes, they would have bitten me.

I actually looked at the Tools menu today, and saw two items which had previously escaped my notice:


I save my changes frequently while I'm working, not only because I'm paranoid, but because all too often I'll have been tweaking something only to find out that I've been half-disconnected and all my changes have been lost. So I'll take a copy of what I'm working on, after deleting the old version from my inventory so that I don't have dozens of duplicate entries in the Objects folder.

With "Save Object Back to My Inventory", it updates the copy in the inventory so that it's identical to the in-world instance that you're working on. So much easier!

But the really beautiful one is "Save Object Back to Object Contents". Whenever I've been working on something contained in another object's inventory, I've had to drag it into my main inventory, delete the copy out of the containing object, and then drag the contained object from my main inventory to the containing object's Content tab. But this tool updates the version in the containing object's content; no need to delete anything or use main inventory as an intermediary.

I feel like a dork for never having noticed these options before.

Also, I love Class 5 sims and First Look:


48 users in the sim, and the sim wasn't lagged at all! LL claims a Class 5 sim will support up to 60 avatars before things start to bog down. They must put the hamsters on serious steroids to get that kind of performance.

And thanks to First Look, I was still pulling a respectable 18fps even when 35 of those users were directly in my field of vision. I hear rumors that, despite what the official blog says about no new viewer download, some of the First Look enhancements will be released into the main viewer tomorrow.

Saturday, March 3, 2007

We're gonna have a party, yeah...

Tomorrow (Sunday), to celebrate the opening of our new sim, Rockcliffe University is throwing a party. Live music! Classes! A DJ! Dancing! Uh... more classes!

Stop by if you feel like it, check out the place, listen to some music, say hello if you'd like.

11:00 AM - Live music: Mel Cheeky
12:00 Noon - Live music: Flaming Moe
1:00 PM - Live Music: kaklick martin
2:00 PM - DJ Doubledown Tantino
Classes will probably be running throughout the day, but I haven't seen a schedule yet.

Wednesday, February 28, 2007

Pros and Cons

The brouhaha developing over the integrated voice chat is really interesting to me. I missed all the previous "ZOMG THIS IS THE END OF SL" changes — land fee changes, free accounts, and so forth — so this is my first experience with the wide spectrum of reactions.

Unlike some of the posters, I can see both sides of the argument. Speaking as an SL "educator", I think this will be a wonderful tool for teaching classes. I hate having to cut-and-paste due to the time constraints of disseminating large amounts of information in a fairly short time. If the students had to wait for me to type everything — and go back and correct typos, because I obsess about that — my hour-long classes would take at least a couple of hours each. Being able to actually speak it — and to let students actually ask their questions at speaking speed, instead of having to wait (sometimes interminably) for them to finish typing them, would be wonderful.

On the other hand, as I have a friend with profound hearing loss, and another with a bad speech impediment, I can understand the horror that some might feel at this development. My friend who stutters loves online forums because he can communicate as freely as everyone else; if he played Second Life, I can just imagine how this would affect him. And then of course there are the gender changers; this will pretty much spell the end of their SL identities.

I'm personally ambivalent about it; I really look forward to using it as a tool in teaching, but it'll make me feel really self-conscious because I hate the way I sound in recordings. (Why does it sound so different from the way I sound to myself when I'm speaking?) And I get stage-fright on conference calls. But maybe speaking more in SL will help me get over that. So I don't know. I'll have to wait and see.


And at the risk of sounding crabby, I'm getting really tired of the SL blog commenters who always complain about Linden Lab addressing anything but the commenters' pet-peeve bugs. "How can you waste time on X when you haven't fixed Y?" It's like saying "Why are you doctors and scientists trying to cure diabetes, blindness and Alzheimers when you haven't cured cancer yet?"

Monday, February 19, 2007

A Week's Work

Wow, has it already been a week since the last time I posted?

The head of Rockcliffe University, where I teach building (and am writing a scripting course, which hopefully will debut before the end of the month), went and bought an entire sim. Which means all new classrooms!

One thing which I thought the old space lacked was actual lecture halls. So I decided to build one . Once I got through the inevitable round of "could you change this and this and this?" (never build things "on spec" if you're trying to realize your own vision!), I ended up with this layout:



Sure, it'll get the job done, but it's not all that exciting visually. So I took a couple of days, and wrote the set of scripts I've been planning to write for ages.

One script, which I dropped into every prim in the build (except the chairs), just sat there until I uttered a command. Once I did, each prim announced all of its parameters: location, size, rotation, type, hollow, cuts, and so forth. I copied all that information out of my chat history and pasted it into a text file on my computer.

Then I ran that text file through a PHP script which I wrote to convert each prim's data into a POV-Ray object. POV-Ray is a freeware 3D renderer, which does shadows and other things very nicely. The great thing about it is that its scene description language uses plain text statements which describe graphics primitives very similar to what's used in Second Life: boxes, cylinders, spheres, tori, and so on! So my PHP script converted the build into a POV-Ray scene file, which (when rendered out) looked like this:


Not terribly exciting when everything's grey, so I started adding textures to everything. It's not really easy to add image textures to different surfaces of POV-Ray objects, like it is with Second Life prims, but POV-Ray has some very versatile texturing capabilities in its own right. After another day or so of writing texture statements, it rendered out like this:


I then rendered out orthographic views of pretty much every surface, which gave me image maps I could then upload and apply to the build in Second Life. This was what took the longest, as I had to calculate the repeats and offsets for pretty much every face. But in the end, I think it was worth it, as here's what the final result looks like in Second Life:



The chairs are kind of lame, unfortunately. I had made much better textures for them, with rounded backs and seats which appear to curve down in front, but they'll have to wait until the alpha-texture sorting bug is fixed before they make their appearance.

But regardless of textures, the chairs themselves are very low-prim; each bank of four chairs consists of seven prims, whereas the five-chair banks are only eight prims each. Through the judicious use of alpha textures, I was able to make them look more complex than they actually are. They don't stand up to close scrutiny, but they manage to seat 52 people at a cost of only 88 prims (the entire build is 186 prims).

And here's a view looking from the side of the stage out towards the back of the hall:


Oh, foo, I just noticed I forgot to make the doors more interesting, with a crash bar and a narrow pane of safety glass and one of those things up in the corner to make it close slowly.

And no emergency exits! I hope there aren't any fire code inspectors in Second Life!

Monday, February 12, 2007

Textures and Generators

In one of recent posts, Ged Larsen talks about wrapping a texture around a skirt built by his fantastic LoopRez script. He sums up his experiment by saying:

I don't think this script could ever be useful as a releasable tool, though. Essentially, I think for every project, the script would have to be re-coded, which would probably not be worth it.
Of course, to me that sounded like a challenge! I've been meaning to get back to my own necklace generator and finish up the features I want to have in it, so I pulled it out and started to work.

But the first thing I needed to do was make mine faster. Because calculating equal placement on the circumference of an ellipse is extremely complex math, which to be honest I don't understand well enough to translate into LSL. So I did it the ugly, lazy way.

In essence, I started from a particular point on the ellipse and gradually increased the angle, bit by bit, until the position represented by that angle was at the distance I wanted it to be, within a certain amount of tolerance. The lower the tolerance, the longer the process took. For tiny prim jewelry, that required a really low tolerance.

So I ripped out all that code and replaced it with something much faster, based on a binary search algorithm. Basically, it takes two angles: at first, the back of the necklace and the front of the necklace. Then it picks an angle halfway between the two. If the angle is too large, it then recalculates between the starting point and the halfway point and tests again. If the angle is too small, it recalculates between the ending point and the halfway point, repeating until it's gotten within a certain amount of tolerance from the position we actually want. Then it moves on to the next piece, using the previous piece's location as the starting point to calculate from, and so on until it reaches the front of the necklace. (The other side is just a mirror image of the first, which is trivial to calculate.)

It sounds like more work, but even with a narrow tolerance, it's at least four times faster than the old version with a wide tolerance.

As to the image wrapping: while I can place the image on the prims in the proper location, it doesn't quite look right with the usual tapered cylinders that dresses are made out of; the narrow tops have too much image on them, and the wide bottoms too little. That problem will take a little thinking about. Perhaps it won't be as noticeable with a fabric pattern as it is with a snapshot.

Ged asks to see what progress I've made on it; here's a snapshot showing two different "waist sizes", with the same texture wrapped around the "skirt":


(The image I used was a snapshot of me with my friend Rhetorica and some of her schoolmates.) The problem I mentioned above is more visible on the smaller "skirt", up at the top. There's no "poof" to them because I haven't put in code to do so yet.

The process required that I create a skirt panel and drop in a script, then put the panel into my generator's inventory. Then, for each panel, the generator calculated the placement, texture offset and texture repeat values. It then rezzed out all the panels, and then sent the texture information to the script in each one.

It still has quite a ways to go, and I think I'm going to fork off a skirt generator from my necklace generator, just to make the latter faster yet (the fewer calculations it has to do, the better for speed's sake).

Wednesday, February 7, 2007

Conundrum!

I noticed the other day that some of my scripts were able to execute on no-script land.

Through the process of elimination, I was able to narrow it down to exactly what combination of factors permitted this to occur, and now I can reproduce it at will — for example, I modified the "Sexy Walk" attachment so it now continues to function in no-script territory; no more monkey walk for me!

My first thought was, "I should probably report this as a bug."

My second thought was, "But I could make a mint selling AOs that keep working!"

My third thought was, "I wonder if this is an exploit. Do they still offer a bounty on exploits? And if I don't report it, but sell objects which make use of it, would I get banned?"

Further research is needed.

Tuesday, February 6, 2007

Nifty Find

Sometimes I'll just look around on the map to see what interesting-sounding sims are nearby. While doing benchmarks for the First Look viewer, I saw some interesting — but unfortunately inaccessible — sims with names like TextureTest, Bug Island, Island for Misfit Toys and Danger! Danger!

Looking to the west of First Look Isle, I saw a block of six sims with German names, one of which looked like it had a fort on a promontory of land.

I had to check it out — and I'm glad I did! Sitting atop a large hill, surrounded by a lush trees, was a haunting ruined castle, like one of King Ludwig the Mad's notorious projects fallen into disrepair.



As I walked upon the broken stones, avoiding the sporadic rubble, I espied some familiar objects. Glowing hands atop pedestals. A parrot. An eye-chart. In a courtyard at the bottom of the castle, a sign read Willkommen in der Orientierungs Burg, which even my pathetically rusty German could recognize: Welcome to Orientation Castle.


I've heard mention of a new Orientation Island; I wonder if this is what they will look like. It's certainly a lot more compact than the existing ones, taking up maybe a sixth of the sim. And the beach ball has been replaced with a well, into which (I think) the notecard says you're supposed to drop a large rock. There is a "physical" rock on a nearby staircase landing, but it's locked; I can't move it.

I've been looking around for a similarly upgraded Help Island, but so far haven't found one. There is a cluster of German-language, standard Orientation Islands just to the south of Frisch, though. I wonder how many other languages have their own Orientation Islands?

In sadder news, the Dynamic Reflections option has been removed from the Client->Rendering menu of the most recent First Look build. :( I can still enable it through the Client->Debug Settings dialog, but it crashes the viewer on my Windows machine immediately. (It still works on my Linux box, but that's not as powerful.)

It looks like most of the rendering improvements will be put into the official viewer soon! :) Get ready for smoother motion!

Friday, February 2, 2007

Oh. My. God.

I tried out the First Look viewer yesterday. I'd put it off, because in the comments about it in the official SL blog, I've read all sorts of wailing and gnashing of teeth about how unstable it is, but I was bored and wanted to see these "render pipeline improvements" for myself.

It was quite a bit faster (I haven't got exact numbers, but everything was much smoother), until I started playing around with the debug options and found the one to turn on reflections.

It's not just an image map of the sky sphere overlaid on the texture of shiny objects, the way the current "Shininess" texture setting works — my guess is that every so often (especially when you change position), the viewer renders a 360-degree panoramic image of your point of view, and then overlays that image onto shiny objects.

It's not perfect (for example, in order to see yourself in shiny objects, your point of view has to actually be in front of your avatar; and if you're in mouselook mode, you're either invisible or headless depending on whether or not you've got "Show Avatar in Mouselook" checked in your Graphics Preferences.

But still, it's phenomenal, and the frame rate with reflections turned on seems pretty comparable to the existing (non-First Look) viewer. And it didn't crash once while I was using it, though I noticed flexi prims aren't nearly as flexible as they are in the existing viewer, and HUDs tend to flicker madly from time to time.

While walking around and looking at reflective things, I took a trip to the Design Center in Idea City. It has some nifty tutorials on shadows (using a different technique than baking them right into your textures), and a nice display on microprims.

One thing that I hadn't managed to figure out with microprims was to make a complete sphere smaller than 0.01 in all dimensions. In my jewelry, I'd been faking it by stretching a sphere and then dimpling away all but the very tip, and using that as a mostly hemispherical bit, but it was far from perfect. The Design Center display gave some really good advice: use Hollow, and then apply a transparent texture to the outer skin of the sphere.

This was great, but the shadows are reversed in the hollow -- at noon, for example, the top of the microsphere would be shadowed while the bottom would be lit.

I found that by setting the twist on the sphere to -180 for both the begin and end, it will turn the shadows "right side up" and look much better.

And, oh, how tiny you can get them! In the image below, the moon on the left is 0.01 in all directions, the smallest SL will let you make it. To its right is another one, hollowed, twisted and textured, with the hollow set at 10 — a millimeter in diameter. And to its right, the dark grey dot, is one with the hollow set to 1, a tenth of a millimeter wide. It's almost too small; nobody would ever look closely enough to actually see it.



Now to make some jewelry with tiny little spherical gems!

Tuesday, January 23, 2007

The Lost Art of Communication

I was in an empty classroom, working on some visual aids for a class on texturing, when a shirtless, tattooed man walked in. The conversation was pretty bizarre.

Him: hi
Me: Hello.
Him: your the teacher?
Me: I am one of the teachers here at Rockcliffe, yes. :)
Him: make me a star

Now, I assumed that he was demanding that I produce for him a five-pointed star object. I have no problem helping people learn how to build objects, but being brusquely commanded to work for them, without even so much as a please, makes me ornery. So, with the old joke about "How do I get to Carnegie Hall?" leaping forth from my memory, I deliberately misinterpreted him.

Me: What instruments do you play?
Him: giuttar at real live
Me: Well, the first step would be to start playing at clubs which have "open mic nights" in order to get exposure.
Him: and than??
Me: Well, assuming people like what you play, you'll eventually gain a following, and perhaps become a star.
Him: i think you teach me?
Me: I'm afraid I'm not really the person to speak to about that; I'm not a musician and have no experience with performing in SL.
Me: All the "stars" I see in SL have basically performed until they've gained a following.

Well, I thought I'd been deliberately misinterpreting him! But I decided to make sure what he really meant.

Me: Or was that not the kind of star you were talking about?
Him: where can i find the crime lorde here??
Him: i mean mafia ORE SO
Me: I have no idea whom you might mean. This is a university, not a Mafia stronghold.
Him: (teleports away)

Huh?

Sunday, January 21, 2007

Open for Business

Johanna Hyacinth Designs is now open. I still haven't rerendered the textures to match the new positions, but I'll get around to it once I muster the enthusiasm. (I hate having to redo projects, and if I put off opening the store until I get around to it, I might never open!)

Alas, the parcel's landing zone makes it more difficult to find my store (my old store's location was great: walk up the ramp right in front of you, last store on the left).

So now there are two ways to get there:

  1. When you materialize, walk all the way to the end of the hall, fly out the door, turn left, fly until you come to a similar door on your left, fly in, and I'm the first store there on the far wall (and if you come in this way, alas, all you'll see is a whole wall full of blank vendors which I haven't filled up yet).
  2. When you materialize, turn around, walk out the door, turn right, walk until you come to a similar door on your right, walk all the way down the hall, and I'm the last store on the left. But at least coming from this direction, most of the vendors hung on the window actually have products for sale.
However, I did IM the proprietor of the mall, and she promises to move the landing point to a spot between the two hallway entrances, so hopefully soon it'll just be "go in the door on the left and all the way down the hallway, I'm the last shop on the left."

I guess I'm going to have to work like mad if I'm going to fill up all those vendors... I'd put my PDA up for sale (it appears when you start typing, and you hold it in one hand and tap on it with the other), but I made it for me, and I'm a lefty -- so you hold it in the right hand and tap with the left. Which, since the default "wear" location (and most animations that involve hand-held objects) is the right hand, means that any time you wear most objects (like mugs and glasses, weapons, walking sticks, etc.), the PDA gets detached and you have to wear it again once you drop or detach the other object. (Even in Second Life, the rest of the dextrocentric world tries to keep us down!) Maybe I'll make a righty version of the animation, and let the script choose which one to play depending on what hand it's held in...

Friday, January 19, 2007

I'm not dead yet!

Okay, so I suck at blogging, apparently.

Actually I've had to cut way down on my SL time, darn it. So, what's been going on in the past ten days?

  1. I had my store almost completely set up and ready to go, when the owner of the mall it was in decided to renovate. Now, the purpose was to increase traffic for those of us on the second floor, since people rarely went up there (which I certainly can't complain about), and she did let us keep our same relative positions (well, moving closer to the front might have been nice). But unfortunately, the proportions and features of the new location are different, so I have to re-render all my textures. Fooey!
  2. I've started teaching classes at Rockcliffe University. It's a fledgling school (it just started up at the beginning of this month), and so far the curriculum is limited, but I like the founder's ideas and I would like to see it succeed. Right now we have four building classes (with a fifth hopefully debuting this weekend), but instead of the follow-a-recipe-by-the-numbers, here's-what-to-do-but-not-why kind of class that I've taken too many of, we're teaching what all the options in the Edit Pane do, and why and how you would want to use them. I'm also working on a series of classes to teach scripting, which has me very excited. Hopefully, we can get that course started in February.
  3. I met Ged Larsen, who (like me) found the existing necklace generator scripts a little lacking, and set to work building a better mousetrap. And what a mousetrap he's built! Whereas mine is slow and ponderous, but gets there in the end, his is snappy and full of mouth-watering bells and whistles.
  4. I downloaded the Open-Source Second Life Viewer code, but alas! it won't compile on my beautiful new 64-bit machine. Let's see, I can spend even more time out of Second Life fixing the code so that it will compile on my system, or just wait until some other enterprising Linux user modifies the code for 64-bit. Hmm, what to do, what to do?
  5. Yesterday, I finally came up with an easy way to demonstrate how Texture Offsets work, just in time to teach my first class on texturing. I'll have to take some screenshots once I get off work and put up a post on the issue.
  6. I had an awesome idea for a script this morning, which hopefully I'll find the time to write this weekend.
Okay, so I haven't really accomplished much. I'm such a slacker!

Also, on a completely random tangent: why is it that, when I'm on a dance pad and someone wanders into the casino when all the dance pads are full, I'm the person whose dance pad they sit on in hopes of bumping off? Every single time! Maybe I should make a mean-looking avatar for when I'm dancing.

Tuesday, January 9, 2007

O Happy Day!

When I arrived at my vendor-booth-in-progress to make some additions, I noticed that there was a SPACE FOR RENT sign blocking the booth next to mine. Dare I hope that the genitalia merchant next to me will be gone?

(Not that I have anything against genitalia per se, mind you — it just kind of clashed with the jewelry I want to sell.)

Complete tangent: Among the last names that exist in SL are Hartnell, Cushing, Troughton, Pertwee, Baker, Davison, McCoy, McGann, Grant, Broadbent, Lumley, Eccleston and Tennant. But not Atkinson? How on Gallifrey could they have missed him?

Monday, January 8, 2007

Geeky Joy!

I read at Second Life Insider that Linden Lab has released the source code for the viewer client. This means I can compile it to run natively on my new 64-bit Linux machine! :kermitarms:

Also, maybe I can hack it so the "Jane Doe has left this session" group messages won't open up a new IM session if that group isn't already open. That's got to be the most annoying "features" of group chat.

Sunday, January 7, 2007

A Magic Barrier

While I'm getting my little vendor stall ready for its grand opening, I put up a "Coming Soon" barrier across the entrance — I guess I'm a little shy about letting people see my works in progress before I'm happy with the way they look. (Though I got a great compliment on it from someone yesterday, which totally made my day.)

Anyway, since the parcel's "landing zone" overrides the landmark I tried to set in my store, if I wanted to get through the barrier to work on it, I had to edit the barrier, set it to phantom, walk through it, and then set it to non-phantom again. And I'm way too impatient for that (in fact, just about all the programming I do at work is to make my life easier by automating the tedious tasks I have to do). So I wrote a little script for the door to set it to phantom when I merely touch it, and then turn itself back to non-phantom after five seconds.

But I was still too impatient, so I made it do its phantom thing when I walk or fly into it too. As it demonstrates the use of states, timers, and setting prim parameters, I figured it would make a good post for part 3 of my scripting tutorials.

Wednesday, January 3, 2007

Baked Textures, attempt 1

I took the plunge and rented myself a little vendor stall. Of course, I wanted to make it look nice, and I wanted to try out some texture baking, so I've spent the past couple of days working on that.

Aimee Weber's American Apparel build changes textures at sunset, and displays a floodlit look at night. Because I don't own the building my stall is in, I couldn't do much about the exterior — but since my stall has windows on two sides, and is across an aisle from similarly windowed stalls, I decided to change the interior lighting and shadows to match the position of the sun.



Every fifteen minutes (except at "night"), it gets the sun's current position and uses that to determine which texture to display. Fortunately, Linden Lab have been kind enough to provide a function to tell us where the sun is:

vector SunDirection = llGetSunDirection();


For some reason, the sun doesn't go straight east to west; it's tilted over by about 45 degrees, and the center of its path is somewhat above the grid, so it's below the horizon only one hour out of every four.

Anyway, making the textures for the store was fairly easy, but time-consuming. I recreated the entire store, plus some of the surrounding walls, ceiling and floor, using the Persistence of Vision Raytracer (a free 3D renderer). I chose POV-Ray over the other 3D packages I have because, like SL, it works with graphics primitives rather than polygon meshes, so it was easy to exactly re-create the geometry. Also, it can be scripted, so I could just plug in the list of sun positions, and make it light the scene from a different position based on which frame number I was rendering.

I had to render everything which would receive a baked texture: the wall, the floor, the ceiling, and every visible side of the wooden "bench" which would hold three vendor boxes. Then upload and apply! (The uploading was a bit pricey, since I had foolishly chosen to make a new set of textures for every fifteen minutes except nighttime. I managed to squeeze all the "bench" textures onto a single image for each time slot, but the grand total was still L$480 for only four things to texture — ouch! Maybe just day/night textures next time after all.)