Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Getting sculpties to touch where you want them to touch

Lorne Harlequin
Registered User
Join date: 14 Jun 2007
Posts: 8
11-22-2009 06:01
There is an anomaly in the scale of sculpted primitives not explained by any documentation I've found for them thus far, at least insofar as I have understood them.

At the beginning of the clarification page in the wiki, https://wiki.secondlife.com/wiki/Sculpted_Prims:Clarification_Page , it is first said that:

"To clarify, the 0-255 range of a given color channel value (R, G or B) is converted to the -0.5 - +0.5 range of a given axis (X, Y or Z, respectively), representing an offset from the position vector of the prim, which is then multiplied by the prim's overall Scale value for that axis."

This is soon after revised:

"Additional info: I experimented a bit and I think I have the answer. It appears that 0v = -0.5m precisely, 128v = 0.0m precisely, and 255v = 0.496m approximately."

and that revision is supported in the technical explanation page in the wiki, https://wiki.secondlife.com/wiki/Sculpted_Prims:_Technical_Explanation , where it says:

"On a sculpted prim that has a size of one meter, the color values from 0-255 map to offsets from -0.5 to 0.496 meters from the center. Combined with the scale vector that all prims in Second Life possess, sculpted prims have the nearly same maximum dimensions as regular procedural prims (9.961 meter diameter). The last 39mm is lost due to the fact that the maximum color value is 255, whereas 256 would be required to generate a positive offset of exactly 0.5. "

Accepting this 9.961 maximum scale, consider two identical sculpted prims, both set to 10x10x10 meters in scale, their centers placed exactly 10 meters apart along which ever axis. Even if the sculpties in question were sculpted cubes, according to the descriptions I cited, these two prims should not be touching. According to the descriptions I cited, there should be a 39 millimeter gap seperating the two prims.

This is not the case. In the attached image, Anomaly Demonstration 001.jpg, two truncated octahedra, using the same sculpt map, are pictured with a full-bright white backdrop. They are scaled to 10x10x10 both, one placed 10 meters above the other. There is no gap.

I find there is also no gap if one of the sculpties is substituted with a 10x10x10 cube, non-sculpted.

If that were all, it would be great. I could do all the stuff I've been wanting to just fine, and the world would become a steadily more amazing place. There's more however. I made the truncated octahedron to be a regular truncated octahedron, which is a shape that fits together perfectly to fill space completely, leaving no gaps between shapes (tesselation). The square faces of mine are the only faces that fit up perfectly though. The rest of the faces make it look like some edges start to far this way, and other edges start too low, and blah blah blah.

There's something I'm not quite getting, but I believe that it's just a matter of something I'm failing to apply in the math, or such. This regular truncated octahedron's square face diagnol lengths are suppose to be half the width of it, and 255 doesn't divide that well with 2.

What I'm wondering, though, is what accounts for the discrepancy between the technical description, which say the RGB values in a sculpt map can displace a vertex -128/256ths, or 127/256ths, and the fact there is no 1/256th gap apparent when you stick them together. Any ideas?

Is the dislacement center itself offset from the prim's geometric center, maybe?
Domino Marama
Domino Designs
Join date: 22 Sep 2006
Posts: 1,126
11-22-2009 07:01
The revision is wrong. It's still 0-255 = -0.5 to 0.5

Your other problem is due to aliasing problems. I'll use a 2D example to illustrate. If you have a one pixel step in X, from 0 to 1, then in Y, from 0 to 0 gives _ from 0 to 1 gives / (45 degrees). Those are the only angles available. With 2 steps, X from 0 to 2, Y 0 to 1 is now 22.5 degrees, and y 0 to 2 is 45 degrees.

So the smaller the faces, the fewer angles are available. And unless every vertex on a line exactly aligns with the grid steps, you'll get jaggies and non aligning faces. So a 3 vertex line from 0,0 to 1, 3 isn't going to work. The middle vertex can't be at 0.5, 1.5 so you get something like 0,0; 0,1; 1,3 for the baked RGB and what used to be a straight line now looks a mess.

The only way around this is to allow for it in the modelling and only use stuff like 0,0 to 2,4 for this 3 vertex example. That way the middle is at 1,2 and all 3 form a nice 22.5 degree line.
_____________________
Visit http://dominodesigns.info for the latest Primstar info
Lorne Harlequin
Registered User
Join date: 14 Jun 2007
Posts: 8
Aliasing, or False Premise?
11-22-2009 22:57
Oh, hey--I know that name. You made, and develop the scripts that make my burgeoning love of blender more than just a might-have-been. Good on ya, Domino. Impresses the hell out of me, and makes for many hours of giddy giggling, hopping up and down, and pointing at my pretties.

*AHEM*So, anyhow, pardon me while I think outloud a while...

That explains a lot of what's gone wrong with several many shapes I've tried to make then. I had been designing things under the premise that the positive side of the center couldn't quite reach as far as the negative side. I wonder why I end up trying to figure these things out when important representatives from my brain's geometric-relationship/spacial-intelligence department have gone to sleep, and the on-call guy is all terse and grouchy.

A relationship between vertices and faces/edges that somehow manages never to solidify in my mind is the fact odd number of vertices in a path = even number of edges/faces. A path of nine vertices is 8 edges long. Since RGB values translate to vertex offset coordinates, the same idea applies.

Even though you start counting at 0, 0-255 means 256 possible values. Even number of end-points = odd number of edges, and in this description edges = where you can't tell avertexto be. Unless there's something I'm missing, this means that neither <127,127,127>, nor <128,128,128> equate to the exact center of the sculpty.

I am going to make a cluster of boxes with side lengths of one color increment, slap it on a 255x255x255 mega prim, and see how the center-most box looks...lessee...corners...
{ <127,127,127>, <127,127,128>, <127,128,127>, <127,128,128>, <128,127,127>, <128,127,128>, <128,128,127>, <128,128,128> }

I'll post the results in this thread, in case it's helpful to anyone else.
Lorne Harlequin
Registered User
Join date: 14 Jun 2007
Posts: 8
Confirmed
11-23-2009 05:25
Several websites, and at least one tutorial suggest that <128,128,128> equates to the prim's <0,0,0>, and/or that a non-megaprim sculpted prim can't get any larger than 9.961 meter diameter. I don't know that I'm not just misunderstanding what they are referring to. It has been my understanding of what they were explaining though, and the misconception has framed all my efforts to figure out why various sculpties I made refused to turn out the way my understanding led me to expect after upload.

Artifacts of the aliasing issue Domino mentioned seem to have a synergy with the misconception that sculpted prims can't quite fill their scale 100%. This is despite wondering several times to myself why, if however many millimeters are lost off three of the sides, why, if they can't quite touch, why oh why are they touching? The question got lost in finding it more exciting to figure out some clever way of fitting this shape or that to another by some twist on approximation.

I was defeated each time, I would say on reflection, by the fact I always imagined any given sculpty as bisected three ways by three imaginary planes, and that somehow went together with thinking these planes needed to be reachable by actual vertices. I've been wrong there, though. You can't put a vertex precisely in a sculpty's center, nor can you put any vertices on any of a sculpty's three cardinal mid-planes. <127,127,127> grey will generate a vertex 1/2 of 1/255th step back, right, and bellow the center, while <128,128,128>will generate a vertex forward, left, and above.

In the attached image is pictured a part of a sculpted prim, I made from a 255x255x255 meter megaprim. The sculpty is the diagonal row of boxes rising from the gridded platform. I placed a white, 1 cubic meter box prim, the regular prim type of that name, 2 meters to the left of the box that is at the exact center of the 255x255x255 meter sculpty.

The snapshot attached to this post also captures the interface, and so you can see the move-tool's arrows. If <128,128,128> was the center of the prim, as described by the pixel format section of http://wiki.secondlife.com/wiki/Sculpted_Prims:_Technical_Explanation, the arrows of the move tool would intersect where the lowest, and second-lowest boxes in the diagonal row touch. If <127,127,127> was the center of the prim, the arrows of the move tool would intersect the corner opposite of the aforementioned on the lower of the aforementioned two boxes. The arrows of the move tool intersect in the middle of that box instead, where you can not put a vertex.

Spose I ought have been able to grasp these things just by thinking about them, but for some reason their rough bits got snagged in my brain fuzz this time, and I needed this experiment to bring it all in focus...suuuu...

~If visualized as several descriptions suggest--that RGB values in a sculpt map describe offsets from it's center--then 128 equates to 0.5/255ths, 127 equates to -0.5/255ths, and counting up, or down from there adds or subtracts 1/255th. This way, once you get to 255 you have 127.5/255ths, which reduces to 1/2 the prim's scale away from the prim's center.

Maybe it works out to instead imagine a sculpty as a cube made out of 255x255x255 smaller cubes, each of which can be cleaved only along planes that are common between some set of vertices...I suppose sculpties have that in common with solid state physics.

ANYHOW! It be so far past my bed time now I've passed into directionless rambling, so...uh...say hi to...you know: whoever, for me,
love,
Lorne's labors lost

P.S. ex-oh-ex-oh-zee-zee-zee-zee-zee