Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

sculpties -explanation for map wanted

Abraxes Binder
Registered User
Join date: 23 May 2008
Posts: 205
05-28-2009 04:52
Hi, does anuone know a page where the theori behind sculptmap is explained in programmers termonology. I would like to build a lathe extruder application for the purpose of sculpties, but i have not been able to find any explanation about how the rgb system is connected to the ponts in the <xyz> world.
-and as a follow up: What is the industry correct 'name' for 'sculptie-map'

tyia
_____________________
BR ab
Abu Nasu
Code Monkey
Join date: 17 Jun 2006
Posts: 476
05-28-2009 05:07
Sculpty in programming terms is rather easy.

XYZ = RGB

If you want a vertex at XYZ=(10,20,128), then RGB=(10,20,128).

I'm out the door in a few. If you give me a bit, I'll hack together some pseudo-code.
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
05-28-2009 07:06
From: Abraxes Binder
i have not been able to find any explanation about how the rgb system is connected to the ponts in the <xyz> world.


I can't put it in programmer terms, since I'm not a programmer, but I can certainly put it in layman's terms, if that helps. As you probably know, a standard RGB image is comprised of three 8-bit channels, and each pixel within each channel has 256 possible values. If we assume each specific pixel in a channel represents a specific vertex on a surface, and we further assume that each channel represents a specific axis, this gives us 256 mappable positions per vertex per axis. Include three channels in a map image, to represent the three axes of 3D space, and you can create or record a (limited precision) description of any 3D shape you want.

That's the basic concept, which I'm assuming you probably already understood, but I figured I should cover anyway, just in case. Beyond that, here's are a few specifics you'll need to know:

1. The axis-channel ordering follows the standard sequences, XYZ and RGB, respectively. In other words, X corresponds with R, Y with G, and Z with B.

2. On each axis, a value of zero (black) represents the center point of the mapped object, and a value of 256 (white) represents the furthest possible distance from the center, in accordance with the absolute size of the object.

3. Each (non-oblong) sculpty is comprised of 32x32 quads, which means 33x33 vertices. SL requires images be sized in powers of two, so the smallest possible image that can represent all vertices is 64x64.

I'll leave the programmatic how-to's to better suited people, like Abu, but that's the basic explanation of how it works. I hope you find it helpful.


From: Abraxes Binder
-and as a follow up: What is the industry correct 'name' for 'sculptie-map'


The closest thing would be "vertex displacement map".
_____________________
.

Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.
Abu Nasu
Code Monkey
Join date: 17 Jun 2006
Posts: 476
05-28-2009 10:24
Off the top of my head

The image dimensions are 256x256 (0-255)
Input range is 0 to 127
OutputRGB vals are 0 to 255

pi=3.14159
pi2=pi*2

for i=0 to 255
// input range = 0 to 127
inF(i)=somefunction
next i

for y=0 to 255
for x=0 to 255

// convert x to radians
theta=x/pi2 - pi

// output
outputR=cos(theta)*inF(y) + 127
outputG=sin(theta)*inF(y) + 127
outputB=y

next x
next y
Robin Sojourner
Registered User
Join date: 16 Sep 2004
Posts: 1,080
05-28-2009 11:47
You might be able to find the information you want at http://wiki.secondlife.com/wiki/Sculpted_Prims:_Technical_Explanation
_____________________
Robin (Sojourner) Wood
www.robinwood.com

"Second Life ... is an Internet-based virtual world ... and a libertarian anarchy..." Wikipedia
Abraxes Binder
Registered User
Join date: 23 May 2008
Posts: 205
Thanks!
05-29-2009 03:05
Brilliant, just what i was looking for! Thank you to you all for the explanations and the very usefull link!

BR
ab
_____________________
BR ab