Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Sampling positions of the sculpt map

LindaB Helendale
Registered User
Join date: 4 Jun 2008
Posts: 3
01-30-2010 12:17
According to Wiki (http://wiki.secondlife.com/wiki/Sculpted_Prim_Explanation) the 33 x 33 vertices of a plane sculptie are sampled from a 64 x 64 texture in the following way:

"When we refer to the texture in terms of how the viewer code sees it, the first row (00 - F0) is the top row of your texture. For the columns they are left to right."
... and...
"The plane requires a 33x33 grid, which it samples at pixel positions 0, 2, 4, ..., 60, 62, 63 in each direction. "

I had trouble getting the right vertices showing in a sculptie, so i checked this, and it seems that along the columns the sampled rows are
0, 1, 3, .... , 59, 61, 63
where the shorter sampling interval is the first interval, instead of the last one as in sampling the columns.

Below is a pic demonstrating the effect. I made 64 x 64 sculptie maps with simple x and y gradients and random noise in [0,50] in those locations that should not be sampled.



In the right sculptie z-values of 128 are set in all those pixels that are sampled according to wiki (rows and columns 0,2,4,....60,62,63), giving a flat sculptie if the sampling is from those points. On the flat background there is ridge, with vertices 2 and 30 eleveted to value 250 along rows and columns, corresponding to rows and columns 4 and 60 in the texture. The resulting sculptie has only the edges correctly sampled, with all the interior points sampled from the random noise background.

In the left sculptie the flat background pixels are set to rows 0,1,3,.., 59,91,63, and respectively the ridge is in the rows 3 and 59 in the texture. The resulting sculptie is sampled exactly with the desired values.

The sculptie maps are here:
Wiki locations:
My suggestion:

The conclusion is that either SL counts the rows starting from the bottom of the texture or the column and row directions are not sampled in the same way, and when using any standard image processing software to prepare the texture, the sampled rows are 0,1,3,...,59,61,63.

If anyone could repeat the experiment with any indepedent test, I think this should be added in the wiki also.

--
LindaB
Domino Marama
Domino Designs
Join date: 22 Sep 2006
Posts: 1,126
01-30-2010 13:25
I've always understood it to be bottom Left is 0,0 and top right is 63, 63

The origin position is configurable in the .tga format, so it may be the top left option also works if the sculpt map is laid out correctly for that style of .tga - that's what the wiki is describing.

I've never bothered testing whether this is honoured by the Second Life upload system though as the default bottom left always worked for me.

The Gimp gives you the option of which origin to use, Blender doesn't and I don't know how other software handles it. So if you wanted to test it out, I can only recommend using The Gimp to set the option on the saved .tga
_____________________
Visit http://dominodesigns.info for the latest Primstar info
LindaB Helendale
Registered User
Join date: 4 Jun 2008
Posts: 3
01-31-2010 03:22
Thank you for the info Domino :)

The Wiki page says specifically that the origin is top left :(

I havn't use Blender, but if you save in TGA with the default origin in bottom left and it works, it appears to reverse the sculptie row counting order then. I could not get that work by editing the PNG sculptie map with Gimp and saving in TGA with bottom left origin, the result was the same as with the PNG texture.

At least for those using other tools than Blender the wiki page gives misleading information. (I make the sculpties directly with matlab according to the wiki technical specs, and since matlab does not support writing tga, i have used png, and hit my head to the sampling issue.)

I think it would be worthwhile for someone with Blender to check whether the sculptie maps actually sample rows 0,2,4... or 0,1,3... on 64 x 64 sculptie map.
Domino Marama
Domino Designs
Join date: 22 Sep 2006
Posts: 1,126
02-02-2010 02:14
From: LindaB Helendale
I could not get that work by editing the PNG sculptie map with Gimp and saving in TGA with bottom left origin, the result was the same as with the PNG texture.


I'd expect that. png has bottom left origin (the 0,0 point for counting) as well. If you've counted from top left when designing your sculpt map, then tga with that as origin might work. I've never tested it, but I'd assume whoever did the wiki did or they would have described a bottom left origin instead.

I'd recommend ignoring the wiki and just using a bottom left origin and designing your sculpt map rows from that point. That way it won't matter what image format you use and you won't have unusual sculpt maps. I've never seen one with a top left origin to be honest.

As far as Blender goes it uses a bottom left origin and 0, 2, 4 etc counting from the origin. There's thousands of sculpt maps made with my Primstar scripts for Blender that way and no complaints ;)
_____________________
Visit http://dominodesigns.info for the latest Primstar info