Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Sculptie Foundation Tutorial

Abu Nasu
Code Monkey
Join date: 17 Jun 2006
Posts: 476
05-05-2008 01:42
I've been working on sculptie tutorials for awhile. I'm talking about really basic nitty-gritty nuts-n-bolts type stuff. I could have churned out a ton of sculptie tutorials since they appeared, but there where a few things that I wasn't comfortable with. But it looks like it's time to start writing. Unleash the beast!

I still don't have access to my wiki or any other space, so I'm dumping here in this manner. It sucks, but it's all I got right now.

Why in Texturing instead of Building? Because I will be focusing on using Photoshop for these tutorials. I'll be getting into blending modes, adjustment layers, and a bunch of other junk. There is even a trick for colour correction in Lab that I use that is good for sculptie manipulation. Nothing like the good ol' LL Curves technique. Wo0t!

--------

Ah, sculpties. They can be a beautiful thing.

What are they? What can they do? What are the limitations? Good questions, but they kind of jump the gun a bit. Asking higher level questions is one of the mistakes that I was making when it comes to understanding sculpties. I can understand sculpties at the higher levels, but things would go wrong when I got down to the nitty-gritty. This meant that there was something fundamental about sculptie implementation that I wasn't understanding. Not good.

Time to start over with some basics.

XYZ is a space as is RGB. The two can be mixed. There is an old tutorial called Raytracing in Photoshop that did some very cool things with this idea. RGB and XYZ are interchangable? Wow. That really set me down the path. Thinking in one space is one thing, but thinking in several spaces together is a whole new dimension. Heh.

That is the basic idea behind sculpties. Take an RGB value and convert it to XYZ.

One of the first limitations we run into is that an RGB document is 2D. That is, RGB is 3D, but the document itself is a 2D plane using just XY.

That means that the sculptie has to start as a plane with just XY. Much like UV mapping. A sculptie is nothing more than a UV plane waiting to be textured, so to speak.

So you start with a plane. I've simplified it a bit for visual purposes. For this, going to start with a 4x4 plane with proper UV coords. Something like this:

sa01_5x5.jpg

Now, the 4x4 part is a bit of a misnomer. The 4x4 actually refers to the quads. But a sculptie manipulates verts - not quads. It is the vertices that we are after. The sculptie plane that I am showing is actually 5x5 vertices. Very important.

Because of that misunderstanding, the first production mistake is usually to go with a mosaic pattern for the sculptie map. Check this out:

sa02_faces.jpg

The colours are supposed to be the XYZ values for the vertices. They are, but they would be better off categorized as face colours. Take a look at the verts that are in the middle. What RGB colour value do they take for XYZ position? Because of rounding errors and rounding fixes, could be any of the bordering RGB colours. Using such a mosaic pattern, you could very well be left getting frustrated.

How do you maximize vertex placement with certainty? By thinking more in terms of UVs.

Check this out:

sa03_verts.jpg

See how each vert is dead center of the RGB colour chunks? Very nice. Pretty much nothing left to chance, including rounding errors.

Well, the dead center part is mostly true. The colour chunks around the edges are only partial chunks when compared to the chunks in the middle. However, they follow the pattern.

This mosaic pattern is consistant with how UVs work, and I'm fairly positive this is how sculpties sample maps. I don't know with absolute certainty, but this pattern has held up against other pattern hacks when it comes to stitching and seams. When it comes to stitching, there can be anomolies, but the pattern I'm presenting here came through with predicable results every time. Using this pattern, no need for hacks when using other patterns.

Big Note: I'm not really sure if anti-aliasing is a concern when sampling the edges of a sculptie map. But I have yet to see any noticable anomolies that could be attributed to anti-aliasing.

A sculptie plane is 33x33 vertices. Because of that and powers of two, a sculptie map that is 64x64 is what is needed.

However, an array of sdata[0-32][0-32] is all that is really needed. As a matter of fact, I've been giving much thought to my own internal sculptie file format. This would make it so much easier to develop a variety of sculptie tools in various environments without having to worry about pattern matching and loss of rounded data across apps and tools. Such a file format in binary would barely be over 1k. Damn fine file size for portability and losslessness.

Um... yeah.

edit:

"This article was originally written waaaaaay back, before the advent of Photoshop 3.0."

http://www.vgd.co.uk/pages/notebook/Raytracing%20in%20Photoshop/RayPS.html

edit2:

imma noob

sdata[0-32][0-32][0-2]
33x33x3=3267
Abu Nasu
Code Monkey
Join date: 17 Jun 2006
Posts: 476
05-05-2008 05:34
First thing, Sculpty Space by Sculpty Carver. Absolutely fantasic. I really gotta show Sculpty Carver some love one of these days.

http://sculptyspace.com/

I have yet to see Scupty Space not match what is seen in-world. I have no reason to believe that Sculpty Space's preview is inaccurate. It might sample differently; but, if it does, it hasn't caused a problem for me.

Second thing: channels in Photoshop.

Channels can be an excessively huge subject. If you want to do sculptie work in Photoshop, then you will have to be familiar with working with seperate R, G, and B channels. Not just the Channels palette, but how some of the tools can work on the seperate channels. Do you know how to colour balance using the gamma sliders in Levels? Things like that.

I really don't want to cover every little thing when it comes to channels. However, I will try to show just enough for those that aren't familiar. Let's hope I can find some decent balance between Advanced vs. Beginner.

For this, I'm not going to bother with mosaic patterns or anything. Just gonna lay down some stuff and let the verts fall where they may. My working sculptie map is 128x128.

A sculptie starts out as a plane. When you add stitching, it can be other things. But it always starts as a plane. So a plane is where we are going to start.

This is what our basic sculptie plane looks like:

bz01_channels.jpg

We have the composite of what it looks like in RGB, and what the seperate channels look like. I laid the gradients down in the seperate R and G channels in the Channels palette. And then B filled with pure black. R is X position of the given vert, G is Y position, and B is the Z position. This will give a plane that is flat on the XY plane with no height.

Notice that GY has white along the top and black along the bottom. This is actually more of a Cartesian system as opposed to screen. Not realizing this is what caused me to have flipped normals way back when. Heh.

With that saved out, gonna load it up into Sculpty Space as the sculptie map. The default type is sphere with stitching and pinching in full effect. Don't want that. Want plane. In Sculpty Space, SculptMap > Resample Source > Resample Plane.

bz02.jpg

All is well for our purposes here. Even tossed on sculpty_uv_map3.jpg as the texture map, which I believe is also by Sculpty Carver (show some love).

Back in Photoshop, gonna do some junk to the sculptie map in the Layers palette. I started a new layer and filled with pure black. Then on to Blending Option > Advanced Blending to turn off the R and G channels. You can get to Blending Option by double-clicking the layer or right-clicking and choosing Blending Options. Something like that.

bz03.jpg

What did we just do? We set it up so anything on the BZ layer will show up *only* in the Blue channel. Anything in the BZ > B channel will show up, but anything in BZ > RG will not show up.

Just for giggles, I painted some white on the BZ channel and blurred it around with impunity. The white that I painted on the BZ layer will only have an affect (effect?) in B.

Ummm... yeah.

When doing something like this, it can be kind of hard to see in the Layers palette. It might be a good idea to add Channel Mixer as an Adjustment Layer, check Monochrome, R=0%, G=0%, and B=100%. Good stuff.

After some crappy painting and blurring, I end up with this:

bz04_finalcomp.jpg

Save it out and load it up in Sculpty Space.

Ugh.

bz05_preview.jpg

Like I said, I don't really want to show every little thing when it comes to channels. Hopefully you can see the correlations.

This channel trick is good for doing terrain stuff. I've seen it used in-world quite a bit. The funny thing I've noticed about some of these sculptie is that some folks don't change the type to plane. They still have the stitch and pinching that sphere type use. No big deal, just one of those little things.

Slap gradients in the R and G channels. Toss a height map on top (photo, painting, whatever) and turn off R and G for the height map layer. Tada.

Lovely.

Oh, notice the funny artifact colours in the preview. This is due to wrap-around sampling of the texture. I haven't seen this cause a problem with the sculptie map.