Sculpted Prims: Technical Explanation

From Second Life Wiki
Revision as of 18:07, 5 May 2007 by Al Sonic (talk | contribs) (→‎Introduction: Linkage, with minor rewording for consistencies)
Jump to navigation Jump to search

Introduction

Sculpted prims are three dimensional meshes created from textures. Each texture is a spherical mapping of vertex positions, where at full resolution each pixel would be one vertex (this is almost never the case, see Sampling). Each row of pixels (vertices) links back to itself, and for every block of four pixels two triangles are formed (total number of triangles is more because of the wrapped edges and the poles).

Sculpted-prim-explanation.png

Pixel Format

The alpha channel (if any) in position maps is currently unused, so we have 24 bits per pixel giving us 8 bits per color channel, or values from 0-255. Each color channel represents an axis in 3D space, where red green and blue map to X, Y, and Z respectively. The color values map to an offset from the origin of the object <0,0,0>, with values less than 127 being negative offsets and values greater than 127 being positive offsets. An image that was entirely <127,127,127> pixels (flat gray) would represent a single dot in space at the origin, although it's unclear how Second Life will handle zero-volume sculpted prims like this. A sculpted prim intrinsically has a size of one meter, so the color values from 0-255 map to offsets from -0.5 to 0.5 meters. Combined with the scale vector that all prims in Second Life possess, sculpted prims have the same maximum dimensions as regular procedural prims (10 meter diameter).


Texture Mapping

The position map of a sculpted prim also doubles as the UV map, describing how a texture will wrap around the mesh. The image is already an explanation of what vertices correlate to what pixel, which is used to generate UV coordinates for vertices as they are created. This presents a big advantage for texture mapping over procedural prims created in Second Life because you can do all of your texturing in a 3D modeling program such as Maya, and when you export the position map you know the UV coordinates will be exactly preserved in Second Life.


Sampling

64x64 textures are common for position maps, but in practice the highest level of detail for sculpted prims in Second Life is a grid of 32x32 vertices, and the lower level of detail uses 16x16 vertices. It is unclear at this point whether Second Life is sampling individual pixels but fewer of them total, or averaging blocks of pixels together (for example, a bicubic resizing of the image to a lower resolution first). Either way it is recommended to use 64x64 images (twice the maximum level of detail) to make sure lower resolutions don't result in unexpected sampling problems.


Examples

A pack of sculpture maps available for download: sculpt-tests.zip


An apple sculpt shown in the sculptedpreview program Sculpted-preview-03.png


An S-shaped sculpture shown in the latest version of sculptedpreview, with the sculpture map also applied as the texture map Sculpted-preview-04.png