Sunday, May 27, 2007

LinkRez precision improvement and limits

Here are some pictures showing the improvements with yesterday's re-writes. "Normal" sized necklace links are rather forgiving; shifting a fraction of a millimeter just doesn't really show that much.

To test the precision of LinkRez, I instead tried using a link that is ~4.5 mm long x ~0.25 mm wide. (Just think about that: 0.25 mm...) I then rezzed two necklaces with identical settings, the one on the left with the previous version of LinkRez, and the one on the right with the re-written version. (Click on the pictures to see larger versions.)

As you can see, from a "normal" perspective and distance, there isn't that much of a difference between the two. Looks pretty good, right? But, if you zoom in a bit more:

… you can definitely see that the necklace on the left has some rotational errors. These errors were due to some bad math on my part, in the transition from the rotation from a "front" to a "back" half of the necklace, which the new version does properly.

These errors don't even show up with a "normal" necklace link, because shifting a large 10 mm wide plywood oval by a fraction of a mm just doesn't show up.

Here's another picture, which includes one selected link (~4.5 mm by ~0.25 mm):

You can see that the rotations now are accurate to sub-millimeter distances (probably ~0.1 mm or better). And, you can see with the selected link, how far off the "center" position is, which would generally make this sort of prim a real pain to position and rotate.

The accuracy and precision levels are now probably at the point that simply working in a skybox at ~600 meters might have some floating point rounding precision errors, compared to working with the necklace at "sub-sea level."

In second life, floating point numbers only have ~7 decimal digits of precision. So, because 0.1 mm is 0.0001 meters:
  • 600 and 600.0001 meters, versus
  • 0 and 0.0001 meters
…notice that 600.0001 already uses up all 7 significant digits, whereas 0.0001 uses only 4 significant digits. So, I think LinkRez has just about reached the limits of allowable precision :)