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!