Showing posts with label building. Show all posts
Showing posts with label building. Show all posts

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, 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!

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!

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.)

Thursday, December 28, 2006

Yet Another Cheapside Hoard Necklace

Well, I finally hit the ceiling on complex jewelry. I made another reproduction of a Cheapside Hoard piece — this time, a chain made of alternating square-cut gems and little enameled flowers — but when I'd made a whole necklace out of them, it weighed in at over 500 prims. Way too many to link!

So I started cutting out links, working from the center back forwards, until I was far enough under 256 that I could use some simpler links for the back. I used the same links that I made for my first Cheapside Hoard necklace, but even that was too much; I had to take out the tiny prims which joined the larger ones, and stretch the large ones until they abutted.


I was hoping I could make a two-strand chain, but at a staggering 246 prims for just one half-strand, I guess that's as good as it's going to get. I'm going back and forth on whether or not to just use a simple prim with a texture mapped onto it for the complex bits. I mean, sure, there's a feeling of accomplishment at doing it without "cheating", but who really looks that closely at jewelry in Second Life? (Apart from other jewelers, I suppose). Would segments this tiny really suffer that much?

Wednesday, December 27, 2006

Quite enough holiday cheer

I feel like a slug for not creating anything in SL or posting here in what seems like forever, but alas, the holidays intruded.

Just getting back into the swing of things (and undertaking my first paying SL job, refurbishing some scripts for someone to cut down on lag and permit multiple instances of the object to coexist), so not really much to show from recent times.

However, I did make this necklace today:



Before the holidays, I also got around to trying to make some movies from within SL, and (once I'd found a codec that actually wrote something to disk!) made a clip showing one of my earlier accessories in motion and uploaded it to YouTube. And I'm just now getting around to putting it on the blog.

My first day in SL, I raided the freebie store on Help Island for everything they had, and among them were some prim wings. "I wonder if I can make wings which flap?" I asked myself. The answer was "yes, but not very well". I'll skip the boring explanations of why my first two versions didn't work, and skip straight to Johanna's Bat Wings, Mark III.



They're flexi prims, scripted to flap in a way which will resynchronize them within a few seconds if they get out of synch, and they appear and disappear based on whether or not the avatar is flying. These were kind of tricky; flexi prims get really weird when you rotate them via a script. When you turn on flexi, the "handles" move from the center of the prim to one edge. You can rotate it manually with the handles — and it rotates from the edge, like you'd expect — but if you try to rotate it from the script, it'll still rotate from the center. But if you cut the prim in half, like you do to make a swinging door open along one edge, it doesn't react the way you'd expect. So I ended up having to do both a rotation and a translation in order to keep their edges "anchored" on the shoulder blades.

And, hey, comments on my other entries! Time to go answer those...

Monday, December 18, 2006

Another "oops" moment

Day 36

If you're on a platform hundreds of meters up in the air, don't make a prim and then turn on the "Phantom" and "Physical" checkboxes just to see what will happen.

What will happen is: as soon as you don't have your phantom physical prim selected for editing anymore, the "Physical" setting will cause it to drop straight down, and the "Phantom" setting will let it go right through the floor. And then all the way down to the ground, passing through every platform and building in the way. And then, when it hits the ground, it'll bounce and roll away. And then it may try to go into a zone where somebody's put up a "no entry" barrier, and bounce away from that.

But of course since you were hundreds of meters up and it caught you by surprise, by the time you get down to the ground, it's had a huge head start and you have no idea where it's gone. And the next thing you know, you're dredging the river looking for your prim. Which is where I finally found mine.

Sunday, December 17, 2006

Oops!

Day 35

I tortured a torus into a spindly, curvy shape and made a simple rotation script in it — really nothing more than llTargetOmega( <0,0,1>, 10, 0.1 ) — and just for the heck of it, turned on the "Physical" checkbox to see what it would do.

It hit the ground, fell over, and started rolling away — and it was so spindly, I couldn't select it to turn off the script! I chased after it, madly right-clicking all the way, and it hit the edge of the sim and disappeared. A few minutes later, I was notified that it had been returned to my Lost and Found folder because it had dropped off the world, two sims away. (I wonder if there are any Wild West sims that could use some tumbleweeds?)

Next time I decide to play around with physical objects, I'm building a corral for them first — and minimizing the script window after I save instead of closing it, so I can uncheck the "running" box if something goes horribly, horribly wrong.

On a side note, I see that I've used exclamation points in just about every post title so far. I'm going to have to watch that, or I'll run out of them.

Earrings! And neuroses!

Day 35

Last night (and into the wee hours of this morning), I made a set of earrings from the Cheapside Hoard (actually, I think it may have been a pendant — I stupidly forgot to get a picture of the card saying exactly what it was, or include anything in the picture to give a sense of scale — but I think it looks great as an earring). When I make (or break down and buy) a decent skin, I'll have to take a picture with them on.


The little tiny rings linking the parts together are toruses, of size <0.020,0.020,0.020>, hollow 95, hole size X=0.25,Y=0.49, profile cut B=0.74,0.76, and a twist of B=180,E=180. It's the twist that lets them get so tiny — the profile cut leaves just the smallest sliver around the outside edge of the torus, and the twist rotates it around the minor axis until it's the inner edge.

Once I'd finished the earrings, I had to buy hair that showed my ears! On the other hand, I didn't have to upload a new set of textures for these, so I suppose I came out ahead.

It's funny that I'm obsessing about how much L$ I spend in Second Life; in real life I'm a total spendthrift. "I can't be overdrawn, I still have checks left!" Maybe I could do better at balancing my RL checkbook if I had a real-time display of my available funds in the upper right corner of my field of vision... I'm sure in fifty years, or whenever they finally develop brain-interface computers, people will be able to do that! And I'm stuck here using Excel like a savage!

Speaking of obsessing, I'm really starting to worry about the cross necklace; I don't see much religious symbolism at all in Second Life. Does it make me come across as a religious fanatic? Or am I just neurotic for even worrying about it?

Saturday, December 16, 2006

Much better! (And, goals and obstacles)

Day 34

This morning, I optimized the Necklace Generator — since the necklace should be symmetrical, it's stilly to start in the front and work all the way around. So now I start halfway through (in the center back), and each time I calculate the position for one link, I just have to flip it across the X axis by negating the Y value, and I have the position for its opposite link in the chain! That cut the calculation time in half (though it still seems like it takes forever).


That's a new, nicer chain. I kept the basic link shape (it's a torus, size <0.026,0.010,0.010>, profile cut B=0.15,E=0.35, hollow 95), but instead of those flattened disc things I had linking them, I used a tiny little "cord" in between them (actually it's the same thing as the main link, but just brought down to 0.010 in the X size, and the profile cut range was reduced to B=0.20,E=0.30). You can just see them if you click on the above image for the larger version.

What are my goals?

I feel like a constant newbie, because I don't have a lot of things. And I don't have a lot of things because I vowed not to spend any real-world money on Second Life. It would be so easy to just plunk down $20 for some Linden Dollars (L$5279 at the current exchange rate, quite a bit more than I've been able to amass in over a month of camping chairs, dance pads, Scramble, and the occasional contest prize or gift). But I'm not fishing for handouts here — if I manage to turn my building and scripting skills into a profitable SL business, there'll be a bit more satisfaction in knowing I started from nothing.

I didn't get into the game with the intent of starting a business — I just thought it sounded like a neat playground for someone who enjoyed programming and 3D modeling (and besides, my boyfriend is in grad school and I have to find some way to occupy my time while he's got his nose stuck in a book). But I saw some of the things people were selling, and I thought, "Hey, I could do that! Why not give it a try?"

Obstacles

Now, building is free (though I've been told that it used to cost L$ just to rez a prim). Texturing, on the other hand... if you want to really customize your prim, you have to make the texture yourself. Each texture costs L$10 to upload, and I create each of my gemstone textures in sets of 9 (amethyst, blue topaz, citrine, diamond, emerald, garnet, ruby, sapphire and topaz). The rectangular ones need 18 (one set for vertical orientation, one set for horizontal), so that's L$90 or L$180 per set.

The best place I've found for dancing overnight (and the fact that there are usually open dance pads is part of why it's "best") only pays L$2 per 17 minutes of dancing, so every hour and 25 minutes gives me enough to upload one texture. One nine-color gem texture set requires over fourteen hours of dancing (assuming the sim doesn't get restarted and lose me all the dancing money I've accrued)! Fortunately there are other things, like Scramble games, which pay more, but you have to actually participate; you can't just sit there.

Technical User Interfacing offers a Career Course in jewelry, which includes information on how to set up a business (something I really need). I've talked to a few students who have taken or are taking it, and they all seem to believe it's well worth the L$3000 it costs to take the course. The last time it was offered, I had only a fraction of the cash to take the course. I can afford it now, just barely, but my inner skinflint is apoplectic at the thought of spending that much money all at once! Sigh.

Success!

Day 33

Well, Johanna's Necklace Generator is almost finished! After two days of fruitless script-bashing, I swallowed my pride and asked for help on the Scripters of Second Life group. A very polite young man (from Canada, which explains the politeness) spent about an hour and a half with me, ripping out my Euler rotations and replacing them with quaternion math, and then bashing on those until they finally started doing what I needed.

The Necklace Generator is pretty simple, really — to use, at least! It's a script which you put into a cylinder, along with an object representing the chain link you want to use. Edit the script and tell it the name of the link object, how long the link is (which will usually be a little less than the actual length, assuming the links go through each other), whether or not you want it to rotate every other link 90 degrees, how far down you want the chain to come in back, and a couple of other things.

Then you edit your cylinder and stretch it to the dimensions you want. The dimension along the X axis of the cylinder controls how wide the necklace is from front to back (I know, that should be the Y axis, but that would add a whole new layer of math to everything... no thanks!), the Y dimension controls how wide the necklace is from side to side, and the height of the cylinder controls how far down it comes in front. (If you set its Z dimension to 0.010, it suppresses the drop entirely.) How far down it comes in back is controlled by a variable, as mentioned above; it's pretty much a percentage of how far down it comes in front.

Then you just touch the cylinder, and it thinks for a LONG time, and...


...several months later, you have a necklace chain wrapped around the cylinder! (Well, as long as you leave the cylinder with rotation <0,0,0> — it'll ignore the cylinder's rotation and act like it's unrotated regardless.) That slice cut out of the cylinder is to remind me which way is "front". I suppose I'll eventually make a special cylinder texture for the Necklace Generator.


After seeing it, I'm not really sure I like the style of that link — the rings are so thin they disappear when seen edge-on — but you get the idea. And from further away, it doesn't look too bad on the Cheapside Horde cross. As you can see below, the rotations aren't perfect, but it's close enough that only a couple minutes' tweaking are enough to bring everything in line, which is still much better than having to build the whole chain by hand!


The only thing I have left to do is add an option to make it automatically come to a point in front, for pendants and the like.

Also, I'm trying out some new textures for gems. I loaded a test pattern texture (I think it was from Robin Wood's in-world texture tutorial) onto a cylinder tortured into a gemstone shape to see how the faces were actually patterned. After doing a little unrotating, I came up with this texture:



Basically, it's a straight-on view of the gemstone's table and crown, taking up the top 80% of the image (I pasted shrunken copies underneath it as a "bleed" area), with the bottom 20% being the crown "unwrapped" with The GIMP's Polar Coords filter (Filters -> Distorts -> Polar Coords, with "To Polar" unchecked), cropped to the area beneath the points of the table and above the curves of the girdle, and then resized vertically to take up the bottom 20%.

When uploaded to Second Life, and applied to the gemstone, a little massaging the repeats and offsets just a touch, it resulted in this:


It looks a little blurry, because I made the texture at too small a size. But that doesn't matter for this particular gem, because unless people are looking really closely, they probably won't notice.


This is the gem on top of a cube sized to <0.010,0.010,0.010> — the smallest you can make a prim in Second Life without resorting to prim torture:

The gem's prim is actually <0.020,0.020,0.010>, so it's twice as big around as it could be! (I needed to make it bigger to get the proper slope for the crown.) It's a sphere, set to dimple B=0.95, E=1.00, converted into a cylinder, tapered to X=0.95, Y=0.95, and then resized to <0.020,0.020,0.010>.

If you care to try it, feel free to grab the gemstone texture and put it on the prim! The table (the flat part on top) should have its horizontal and vertical repeats per face set to 0.400, the rotation to -90.00 degrees, and the vertical offset at 0.1. The crown (the sloped edges) should be set with a horizontal repeat per face of 1.000, flipped; vertical repeat per face of 4.000, rotation of 0 degrees, a horizontal offset of 0.000, and a vertical offset of 0.300.

(Edit: For some reason, when I followed my original instructions just to make sure I had them right, they didn't produce the results I expected! Above are the corrected instructions.)

Thursday, December 14, 2006

Jewelry

Day 32

So here are some pictures of the jewelry I've made so far. I'm still not finished with the necklace chain generator, but I'm getting closer (I now have placement on the perimeter of the cylinder and one rotation; I just need two more all three rotations).



Above is the first really intricate piece I made, it's an attempt to reproduce my grandmother's locket in-world. The necklace chain was made by hand, and took almost as long as the locket itself. As with all my jewelry, it's scripted: you can change the color of the metal and the gemstone textures, turn bling on and off, and a couple of other minor things. It's "actual size", the locket itself is about 5cm tall and 4cm wide.


This is a matching circlet, bracelet and armband; I was playing around with torturing a torus and the design suggested itself to me. Like with the locket, you can change the colors — either individually or all pieces at once.



This is a pretty simple brooch. I mainly made it to showcase a set of gemstone textures I made. The problem with the usual gemstone textures is that they don't look good when wrapped around a sphere, spheres need to be textured with a Mercator-like projection for minimal distortion. I rendered a spherical faceted gem in POV-Ray with an orthographic camera, then used The GIMP to perform a reverse polar mapping on it. That gave me the top hemisphere, so I just cloned the layer, rotated it 180 degrees and moved it down so that its top edge was touching the bottom edge of the original layer. Flatten, save and upload, et voilà! A spherical gem texture that looks good on a sphere! I also made it in multiple colors:


I made nine gem colors in all: amethyst, blue topaz, citrine, diamond, emerald, garnet, ruby, sapphire and topaz.

This cross, which hopefully will have a necklace chain sometime before the end of the century, is a reproduction of a piece from the Cheapside Hoard, a treasure trove of jewelry from around 1600, dug up in the early 1900s. There are plenty of things I want to make from the Hoard. Above is a rectangular-cut amethyst texture I made; below are garnet and blue topaz (shown with the metal set to gold and silver, respectively). Actually, I created two textures for each color: one for the gem oriented horizontally, and one for vertical orientation. Alas, the distortion caused by tapering the box robbed a lot of the detail from the sides of the gems, but it's still not too bad. There's no bling on this piece, because I found it was just so tiny the bling particles overwhelmed it. But sometimes subtle is much nicer than flashy.

The little finial gemstones are almost too small, as I mentioned in my previous post; I lost quite a few attempts while making them. Create a sphere and set its dimple to B=0.98 and E=1.00, then change it to a cylinder. Taper it to x=0.95 and y=0.95, and then set the size to x=0.010, y=0.010, z=0.010, and you have an incredibly tiny conical frustum. The rectangular and diamond-shaped pieces were made small (or excessively tiny!) in a similar fashion; dimple a sphere (I think I used B=0.75,E=1), change it into a box, then taper and resize to taste.



Just for a little sense of scale, here's a table showing the different pieces of jewelry I've made so far. The sword isn't really jewelry, but I'm proud of it too. Most nights, the Technical User Interfacing (or TUi) school holds challenge build competitions: you show up, and when the competition starts, they tell you what the topic is. You have 45 minutes to create it entirely from scratch (you can use textures and scripts from your inventory, but that's it — all the prims in your build have to be created, textured, and positioned right there). The topic for that night, obviously, was "swords". I decided I wanted something ladylike — no point in making something I couldn't use! — so I Googled for images of swords and found a beautiful swept-hilt rapier.


I was working right up to the time limit. I didn't win (well, I thought mine looked the best!) but it was fun, and challenging, and I made something I probably wouldn't have otherwise. Unfortunately, those contests are usually held at 10PM Pacific time, so if I participate on a work night I only get about four hours' sleep.

Wednesday, December 13, 2006

Math is hard, let's go shopping!

Day 31

I find building jewelry in Second Life to be relaxing, rewarding and aggravating. "Relaxing" because there's a regularity to it; it's precision work, and I can just let the world fade away as I concentrate on moving little tiny prims around. It's what I imagine Zen is like, complete focus on a single thing, where time and the physical world are meaningless.

It's rewarding because there's always the challenge to slice up the prims just a teeny bit smaller than they're supposed to go, without getting them so tiny that the client won't render them anymore and they vanish, invisible and unselectable, not to be seen again until the sandbox returns your them because they've been there too long.

But it's aggravating because if you want to do things perfectly, sometimes you have to do math. And I hate math. I'm not good at it, I look at pages like this and want to run away. (And that was the least technical (and condescending!) answer in the thread!)

See, I was trying to build a better mousetrap. Necklace chains are an enormous pain to do by hand (Zen relaxation is great, but there's only so much of it I can stand). And there are a few scripts out there which will automate building necklaces, but I haven't found any which do quite what I wanted:

  1. Let the user create a cylinder and stretch it to the desired dimensions, so that the x dimension represents the width of the neck, the y dimension represents the front-to-back measurement (including the amount the chain comes forward to lie properly on the chest), and the z dimension represents the vertical curve of the chain (coming around the neck, over the shoulders and down the chest).
  2. Keep the spacing of the links constant, with no clustering or gapping if the path is elliptical.
  3. Calculate the proper number of links necessary, based on the length of the links and the distance traveled around the path.
  4. Rotate every other link 90 degrees around the axis of travel, if desired.
Doesn't sound too hard, right?

Ha! For starters, there's not even a definitive formula for finding the perimeter of an ellipse — just approximations with varying degrees of accuracy! I bashed my head against a wall for about eight hours last night and this morning, trying to get the formula in the above-linked page to work, before I finally gave up and resorted to a brute-force approach. It's not pretty, it's slow as molasses, but at least it works.

Well, what I've got written so far works — they took the grid down for updates before I was able to write the code which rotates the individual links into the proper orientation.

Once I get some decent chains made, I can put up some pictures of my jewelry!


Oh, also, a public service announcement: don't try to play Primtionary (like Pictionary, only with prims) if you've had a drink or two. The results aren't pretty.