Thursday, December 20, 2007

Sculpt mapping

Sculpty UVs map 4 different ways in SL. Each have uses and pitfalls. To change your mapping mode, you have to insert a script defining the llSetPrimitiveParams:


default
{
state_entry()
{
llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_SCULPT, "YOUR UUID HERE", PRIM_SCULPT_TYPE_SPHERE]);
}
}


Where PRIM_SCULPT_TYPE_SPHERE is changed to the type you need, and YOUR UUID HERE has been replaced with the UUID of your sculpt map (left click on the texture in inventory, Copy Asset UUID, Paste in script). After it's compiled, you can, and probably should, delete the script from the object's inventory.

PRIM_SCULPT_TYPE_PLANE maps as a plane. The edges do not connect in any way, it's one face and invisible from the back side. Your sculpt is a one sided piece of paper you've done your crumpling or origami to.

PRIM_SCULPT_TYPE_CYLINDER makes the UV map a tube. The sides wrap around and connect to each other. This is the first evidence of why it is 100% necessary to not end up with a sculpt map that's 90 degrees off, although it will screw you in all modes but plane. In cylinder, the top and bottom are open and do not connect to each other in any way, leaving an open hole on either end, through which you can look in and see that there is no inside to your prim, because of the way 3d faces only face one side.

PRIM_SCULPT_TYPE_SPHERE is the default mode. You take your cylinder, and now the ends have stretchy bits that cover them. These pieces do not technically exist in your UV map, so in your texture...they also do not exist. They are beyond the bounds of the texturing you've done in Blender, and wrap from the other side of the texture. Add more data at the top and bottom of your sculpt map if you need these things to have something else! They also wrap sort of oddly, pulling all to one point, which is why generally it is a good idea to keep all the vertices on the poles clustered up into tiny little circles and manipulate the group as if they were single points, to minimize this distortion. Select a sculpty in edit mode in world, and in 90% of the cases you can see exactly how it's pulling the ends with a cluster of lines.

PRIM_SCULPT_TYPE_TORUS also started with the cylinder mapping, sides go to sides. Additionally, top edge goes straight down to meet bottom edge. There is less distortion here, as one vertex matches up with one vertex. However, the texturing rules still apply! Anything in between the vertices at the top and bottom is "dead" space to the way the texture is mapped, so either start out with a torus when you're sculpting and do the extra seaming, or keep this in mind!

No comments: