Sunday, May 13, 2007

LinkRez, a little progress

(two 12 millimeter links, precisely positioned on the sizing board)

Some people have been asking about LinkRez, my forthcoming necklace chain link-rezzing tool. There hasn't been a huge amount of progress (Peronaut Sim has been keeping me busy), but things are moving along.

Here's a quick update, one on a critically important LinkRez support utility (the "Sizing board"), and another is another rezzing option added, so that Virrginia Tombola might have better luck getting lace collars to come out of it.

LinkRez Sizing Board

One challenge with tiny, tortured prims, is that very often the "center" of the prim, as stored in SL, is NOT the "center" of the prim visually. Sometimes, that's a good thing, like when you cut a rectangular prim so that the "center" is on an edge, and then rotations make it look like you are rotating about a hinge there.

But, when you are trying to manipulate a micro prim, and the "center" is far outside the prim, it's much more of a pain to work with. The same problem exists with a rezzing script, because the position where the script rezzes the object is based on where SL thinks the center is. And, worse yet, all the rotations that scripts like LoopRez and LinkRez perform, also act about that "SL center point," so the prim gets moved all over the place, when you're simply trying to rotate the prim.

Since so many necklaces will depend on using micro-prims, it was absolutely critical to have LinkRez support tortured, weirdly centered and rotated prims. The "Sizing Board" utility is used to collect information about the desired "center" and "flat rotation" of a given prim / linked object, as well as determining the "length" of the necklace element. LinkRez then uses this information (in the form of a length, a rotation offset, and a position offset), to know the proper position and rotation to rez the prim.

The following shows how the sizing board is used:

  • a 12 mm link has been precisely positioned
    • placed "flat", on the Sizing Board
    • centered on all 3 axes
  • notice that the link is selected and that SL thinks that the "center" of the link is quite a bit below the visual center of the link

  • using shift-drag along the world X-axis, a copy of the link has been made, positioned exactly the distance apart I want two adjacent links to be placed in LinkRez
  • this allows LinkRez to determine the "length" of each link

  • activating the Sizing Board:
    • senses the two perfectly positioned links
    • determines its name
    • calculates the desired "length" of the link
    • the rotational offset between what SL calls the "zero rotation" and what we are defining as "flat"
    • the positional offset between what SL calls the "center" and what we want the center to be
  • the output line needs to be copied into the LinkRez notecard program

As I've said before, LinkRez will not be a "plug and play" tool, because of this required level of complexity.

Symmetry, mirrors, and requests

Long ago, my friend Virrginia Tombola asked about using a script to help place lace collars on her very complex Victorian ballgowns. Honestly, I don't know whether LinkRez is going to help at all with that, but when she reminded me in a comment on this blog, I realized that LinkRez, as previously written, would fail utterly at her purpose.

Given a particular necklace element, LinkRez originally placed the "left" side of the necklace, and then did a sort of "mirroring" of each link to the "right" side (it isn't really mirrored, but rotated so that the "path" of the links goes up the right side). This worked fine, if the left and right sides of the link were identical; i.e., symmetric about the L-R axis, along the path of a necklace

  • if you look closely, notice that the red arrows denoting the "path" axis of the links point in opposite directions
  • therefore, the green arrow, pointing to the "left" of the red arrow, point in OPPOSITE directions on the left and right of the necklace
  • this would play havoc with trying to place "collars" around the neck

However, a lace collar would typically have the lace on one "side" and nothing on the other side. And, if you "mirrored" the links, all the collars would be correct on one side of the neck, and flipped upwards on the other side.

So, I had to rewrite LinkRez to include an option -- instead of "mirroring" a link from one side to the other, with the paths of the links going from front to back of the neck, on both the left and right sides, with a new option, to keep the path orientation of ALL the links pointing in one direction ("counterclockwise" around the neck).

  • this time, notice that the "path axis" red arrows all point the same direction around the necklace, and so all the "left" sides of the beads point in the same direction.
  • if the "right" side of the bead contained lace trim, this MIGHT be useful for placing collars. Or, it might still look awful.
I could see situations where one "path" would be desired, and other times when the other path would be wanted. And, I could see where what is truly wanted is NOT something SL supports, which is truly mirroring a prim or multi-prim object, so I won't be able to do much about that.

All this required more struggles with rotations, but I think I've bludgeoned it into submission. But, I still don't know whether this will be of any utility for placing lace collars. I suspect not, because the back of the neck will likely be placed very oddly. Maybe I need to write "CollarRez"... Sorry, I think not...