From: Laurie Stilman
Doing this isn't as straight forward as it might seem. I have working code for Modo which creates correctly placed and oriented cubes for each prim in a build, and obviously using more appropriate mesh primitives according to the SL prim type would take that implementation closer to being a usable solution. But it's when you start thinking about how to translate path cuts, hollows, skews, twists, etc. into the meshes that it gets tricky...
If you know how to read the various scripting languages that are in use, you might find these helpful:
Adrian Linden's Maya ---> SL:
http://www.purplestatic.com/MEL_SL/Jeffrey Gomez's Prims.Blender:
/8/64/110607/1.htmlShack Dougall's Prim Composer for 3DS Max:
http://liferain.com/downloads/primcomposer/From: Laurie Stilman
So far I've had little luck finding information on things like the number of segments/slices SL uses to render each prim at any given scale, so that would be useful information if you know where I can find it.
If you want to know exactly how many polys are in each prim, the answer is easy to find. Simply go into wireframe mode (ctrl-shift-R), and start counting. Here's what I came up with when I did it:
Prism (default): 4 sides x 1 tri per side = 4 tris
Prism (untapered): 8 sections x 8 tris per section = 64 tris
Cube: 6 sides x 18 tris per side = 108 tris
Cylinder: 24 sections x 8 tris per section = 192 tris
Ring: 24 sections x 9 tris per section = 216 tris
Sphere: 24 sections x 22 tris per section = 528 tris
Tube: 24 sections x 24 tris per section = 576 tris
Torus: 24 sections x 48 tris per section = 1152 tris
Sculpty: 2048 tris
I didn't look into every possible cut, twist, and hollow permutation because that would take forever, but those are the basic counts.
All of the above said, the better answer is none of it matters. You really don't need to have the exact right numbers of polys in order to make a replica of a prim for texturing purposes. Think in terms of faces rather than prims, and you'll have a much easier time. That's how we go about it when applying textures inside SL, and it's certainly the mindset we're in when we're creating textures in 2D in Photoshop. It follows that it should also be the same approach we take when we're creating textures for SL in a 3D modeling app.
Keeping in mind that no multi-sided prim in SL has a single UV map that encompasses the whole object, we have to question whether we should be UV'ing on a per-prim basis or on a per-surface basis with each object in each build. Further, since in SL, every side has its own individual UV space, and it's always perfectly uniform, is there any point even in keeping surfaces grouped together as prims at all? After all, for texturing, what is important are the actual surfaces you're working with, not which collections of them happen to be neighbors on any particular prim in-world.
Here are a few things to consider when thinking about how best to reconstruct an SL build in any 3D modeling program:
First, is replicating exact poly counts a worthwhile endeavor? I would submit that in nearly all cases, it's not. For example, why on earth would I want to build a cube out of nine quads per side like SL does it, when one single quad will work just fine? It's not like my good renderer is going to be using SL's primitive vertex lighting when I bake my textures. The whole point of baking in the first place is to use GOOD lighting, and good lighting works just as well on a one-quad plane as it does on a nine-quad or a nine-million quad plane. All things being equal, I don't want my poly count to be any higher than it needs to be. One quad per side will do me just fine.
Second, does my cube even need to be polygonal in the first place? If it's poly, I need to spend time re-UV'ing it, lest I waste a ton of pixels in my textures, since default mapping for a cube in most programs is going to be a crucifix, not a practical layout for SL. In many cases, I'd much rather just click one button to create a NURBS cube, and call it a day. That way, it'll be set up exactly the way I need it, right from the start, as six individual planes.
And it doesn't stop with cubes. How about spheres? If I create a polygonal sphere, I may need to do a couple things with it before I can start texturing. If its normals aren't already smooth, I'll probably need to fix that, or else I'll end up with a texture that looks faceted instead of round (unless faceted is what I want, which sometimes it is). I'm also probably going to need to do a little repair work on the UV map, since not every modeling program maps a sphere by default the same way SL does it. But if I just make a NURBS sphere, I don't have to worry about any of that. It will already be smooth, and it will already be mapped correctly.
Torus, same deal, already smooth, already mapped correctly. The list goes on and on. In many cases, simple NURBS surfaces make far better analogs for how SL prims behave than polys do, for texturing purposes.
Third, adding twists, cuts, and hollows, doesn't change anything. The mapping stays exactly the same. When you cut a prim, you just add a couple more sides. That's all. Same with a hollow. And when you twist, you're not changing anything at all from a texturing standpoint except for the way in which light is going to fall on the surfaces that are being bent.
When you've created textures for SL in Photoshop, have you ever at any time needed to be aware of how many polygons got added to a twisted torus with each new degree of twist? Absolutely not. So why should you need to be any more aware of that when creating the same kind of texture in 3D instead of 2D? There's no compelling reason I can think of. As long as you've got a close enough approximation of the prim shape that light falls across it in the right way, your bake will look correct. The exact poly count, while arguably nice to have if you're a purist, really doesn't make much difference.
Fourth, are whole prims even needed? Let's say I've got an interior wall in SL that is 40M long. It's probably going to be made out of four cubes. If I'm baking a texture for that wall in my 3D modeling app, do I really need all four distinct objects to be there just to bake the one texture that's going to be spread across all of them? No way. All I need is a simple plane 40 units long. That's it.
Here's my usual technique for recreating most builds. I'll trace the key outlines of each structure with simple curves, and then I'll loft NURBS surfaces in between them. It's super fast, just like making a line drawing, only in 3D. I don't have to waste any time UV'ing, or smoothing normals, or messing with any of the other features of polygonal modeling that can often get in the way in this particular context.
Now, to be as efficient as is humanly possible with pixel counts, it does make sense to use polygonal objects here and there, and to UV them proportionally to their actual scale, with long sides occupying the largest parts of a single canvas, and short sides occupying smaller areas of the same image. Then use the repeat/offset settings inside SL to put the right part of the texture on each side.
This kind of thoughtful UV'ing is a great thing to do when and where you can, to cut down on texture induced lag in-world. However, from a practical standpoint, it's not always possible to have time to put that much thought into every prim on every project. Unless you're a real whiz with AI scripting, you can't automate this. It's a human decision-making process that takes a lot of time.
If you just want to keep things as simple and fast as possible, a few curves and a few lofts go a very, very long way for quickly creating a good model on which to bake textures.