<?xml-stylesheet type="text/xsl" href="../gus_xslt.xsl"?>
<howto
    xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://starling.ws/XML/howto.xsd">&#160;        
    <head>
        <navigation ToC="Table of Contents" section="yes" topic="yes" subtopic="yes" subsubtopic="no" links="yes"/>
        <cgi img="no" img_action="../../cgi-bin/gus_web_photo.pl" img_path="../tet/gus_perl" />
        <pdfmarks body="no" section="no" topic="no" subtopic="no" subsubtopic="no"/>
        <title>Rhino in Second Life</title>
        <description>How to use Rhino 4.0 for sculpties in Second Life.</description>
        <keywords>second life, rhino, sculpty, sculpted prim, starling</keywords>
        <author>Gan Uesli Starling</author>
        <copyright>2009, Woodward Governor</copyright>
  </head>
  <body>
    <title>Designing in Rhino for Second Life</title>
    <p class="center">
    <!-- <a class="button" href="./index.xml">How-to Index Link</a> -->
    <br/>
    <br/><b>Authored by: </b>&#284;an &#364;esli Starling (<note>SL resident Aplonis Ember</note>)
    <br/><b>Last Update: </b>2009-03-14</p>
        
    <!-- SECTION DELIMITER -->
        
    <section>
      <title>Sculpties direct from Rhino 4?</title><inlink></inlink>
      <p><code>Rhino 4</code> is professional 3D CAD system. In my first life as mechanical engineer, I prefer <code>Rhino</code> to <code>SolidWorks</code> which costs nearly five times more. And for SL purposes, <code>SolidWorks</code> is totally useless...except for the fact that <code>SolidWorks</code> models can be imported into <code>Rhino</code> and thence from there into Second Life.</p>  
      
      <p>The good folks at McNeel Assoc who distribute <code>Rhino</code> have begun work on a direct export feature for Second Life sculpties. But it is early days yet and their efforts-to-date, while encouraging, are not yet commercially ready. For those of you eager to play and possibly contribute, here is what they have very graciously shared with me so far.</p>
      
      <p><b>Download: </b><a class="button" href="Rhino_Plugin_SecondLife.zip">ZIP</a> <warn>&#8212; Experimental <code>SculptedPrims.rhp</code> plugin, all the source code, etc</warn> (<note>current as of 2008-04-09</note>)</p>
      
      <p>That will get you these new <code>Rhino</code> commands (<note>experimental &#8212; don&#8217;t expect a whole lot just yet</note>). But try them out, encourage the company, and do offer to help out as much as you can. (<note>I would myself if I knew any <code>C++</code> at all. But I do not, being a <code>Perl</code> programmer instead.</note>)</p>
      
      <ul>
        <li><code>SculptedPrimSurf</code></li>
        <li><code>SculptedPrimMesh</code></li>
        <li><code>MakeSculptedPrim</code></li>
      </ul>
                
      <p>Anyone from the community of programmers in Second Life is encouraged to contribute to the further development of this open source project.</p>
      
      <p><b>Get Info: </b><a class="button" href="http://en.wiki.mcneel.com/default.aspx/McNeel/Rhino4CPlusPlusPlugIns.html">Wiki</a> &#8212; Rhino public software development kit.</p>
    
      <p><b>Related Info: </b><a class="button" href="https://jira.secondlife.com/browse/VWR-858">HTML</a> &#8212; How about importing <code>*.3dm</code> files directly into SL? <warn>Vote for this!</warn></p>
    </section>
        
    <!-- SECTION DELIMITER -->
        
    <section>
      <title>Essential reference</title><inlink></inlink>
      <p>Unless you already know Rhino a book or two will prove helpful. As happens, I do have the official McNeel <i>Rhino Training Manual</i> series which I am (<note>intermittently</note>) slogging through, one exercise at a time. These are going well enough, if slowly. I suspect that they might even be all I&#8217;d need were my most immediate goal real-world CAD design. But it isn&#8217;t. No, my present interest centers on sculpties. And those two volumes are not particularly helpful in this, however worthy otherwise. I am, as ever, impatient when there&#8217;s a goal in sight.</p>
      
      <p>A second book has proven more suited to my most immediate goals in Second Life. I recommend you it from Amazon. And when it arrives, skip ahead straight to Chapter 10: <b>Object Transformation</b>. There will be all of what you most need to know.</p>
      
      <images>
      	<img src="Inside_Rhinoceros_4.png"><p class="center"><b>Inside Rhinoceros 4</b><br/><br/>by Ron K.C. Cheng</p></img>
      </images>
      
    </section>    
    
    <!-- SECTION DELIMITER -->
        
    <section>
      <title>Sculpty theory for dummies</title><inlink>sculpt_theory</inlink>
      <p>Sculpties enjoy technical explanations aplenty on SL blogs. I cannot improve on those. Let me instead explain about sculpties by painting a picture in your mind while still using only words. Here begin my thousand words to describe a picture.</p>
      
      <topic>
        <title toc="White beads">A Net of White Beads</title>
      	<p>Let us consider the simplest shape imaginable, a sphere. Picture a blue, featureless globe of the Earth (<note>as if it were all ocean without any land</note>). Picture it having vertical longitude lines dividing the globe into grapefruit wedges and horizontal latitude lines slicing it sideways into cake layers. Picture it exactly like a flag of the United Nations. On that flag they show 36 grapefruit wedges for longitude and 18 cake layers for latitude.</p>
      	
      	<p>The grapefruit-wedges number 36 as do the lines between them because they go full circle. Following around that full circle you start and finish in the same place. The last line and first line are the same. So 36 lines between each of the 36 grapefruit wedges.</p>
      	
      	<p>Cake layers are stacked, however. So in between those cake layers are one fewer boundary divisions than there are layers. And besides, you need an odd number in order for there to be an equator. So only 17 lines may be counted between the 18 separate cake layers. Or call them 19 if you want to include the top and bottom surfaces. An odd/even boundary-versus-layer mismatch either way you look at it. Simple enough.</p>
      	
      	<p>Next imagine those 36 x 17 lines becoming black wires. Now we have a blue globe in a cage of black wires like a hair net. Now let the blue globe disappear so only the black wires remain. This leaves us with an empty cage of black wires very like the UN symbol.</p>
      	
      	<p>Let us now add some white beads. At every criss-crossing of two black wires add a white bead. Said bead centers exactly on the crossing so that the wires make their criss-cross in the very center of said white bead.</p>
      	
      	<p>Now add two more white beads, one each at the north and south poles. Before us now is a something like a hair net of white beads wrapped around an invisible globe.</p>
      	
      	<p>Lastly imagine this whole arangement floating in space. In space you cannot see the black wires. With the wires not showing we see only a spherical matrix of pure white beads floating in space..</p>
      </topic>
      
      <topic>
        <title toc="Tri-color X, Y &amp; Z">Tri-colored beads for X, Y &amp; Z</title>
      	
      	<p>While our floating ball of white beads strung on (<note>invisible</note>) black wires hangs in space next we&#8217;ll shine colored lights upon it from different directions.  From the left (<note>the X direction</note>) we shall shine red light upon it. Whichever bead lay closest to left will be very brightly red. Whichever bead lay furtest away will be only dimly red.</p>
      	
      	<p>From the top (<note>the Y direction</note>) we shall now also shine a green light. Now in addition to beads having red light they also now have varying degrees of green. Those which are are near the top will be very brightly green. Those near the bottom will be only dimly green. The red light still also shines upon them. So every bead has red and green light both upon it depending on how close each bead is to each light respectively.</p>
      	
      	<p>Now put on a miner&#8217;s hat with a blue lamp in the front. See how every bead now has also blue light upon it. Whicever bead lay closest to you will be very brightly blue. Whichever one lay furtheset away will be only dimly blue. And still both the red and green lamps shine upon all, each with brightness depending upon proximity.</p>
      	
      	<p>Now imagine that every bead absorbs the tri-color light shown upon each. Those colors get hard-baked onto the surface of each and every bead. We can turn off the lamps and still each bead retains its color. Our ball of beads now glows by itself with a whole rainbow of hues. Each tri-color bead tells you exactly where it belongs in 3D space by its combination of hues.</p>
      	
      	<p>And what if a bead should just so happen to lay in the very center, half way between all three colored lights? That bead would be middling dull red, middling dull green and middling dull blue...all at once. That works out to a kind of gray.</p>
      	
      	<p>So we&#8217;ve got this pretty ball of mostly rainbow-hued beads with maybe some grayish ones in the mix. What possible good is it? Well, knowing each bead by its color, and knowing also each bead&#8217;s position releative to its neighbors, we know all there is to know about both their collective shape and position in 3D space. We know it two ways, by color and also by arrangement. With this information we can easily make a map. Let&#8217;s do that now.</p>
      </topic>
      
      <topic>
        <title>Making a seam</title>
      	
      	<p>Looking at our ball of brightly glowing beads let us choose any one from among the 36 vertical longitude (<note>grapefruit wedge</note>) wires. All maps need to lay flat. That is the purpose of a map. To make it lay flat will require some careful surgery.</p>
      	
      	<p>First we shall need a seam. We choose any one of the vertical longitude (<note>grapefruit wedge</note>) wires. Taking scalpel in steady hand we slice that one longwise, beads and all, into halves. We start at the equator bead and cut an incision upwards, carefully spliting the back wire longwise and every bead strung upon it. We pause when we get to the north pole bead.</p>      	
				      	
      	<p>The north pole bead we don&#8217;t cut in half. We only cut halfway into the north pole bead. Now we cut southward from the equator. Similarly we stop when whe have cut half way into the south pole bead. Now our fine, rainbow hued ball of beads looks to have a zipper in it. An open one. Let us hope that nothing untoward falls out.</p>      	
      	
      	<p>So we&#8217;ve got this perfect seam and still our bead-on-wire arrangement will not lay flat. It won&#8217;t lay flat because that pair of north- and south-pole beads still hold it together at top and bottom. Let us have a look at those.</p>      	
      </topic>
      
      <topic>
        <title>Parting the poles</title>
				      	
      	<p>These two beads at the north and south poles are different from all the others. They each join not a simple criss-cross of just two wires but instead a spoked wheel of 36 pie wedges. Along whe middle of the black wire which we had chosen for our seam, each bead north and south is cut half way through as was needful to complete the seem. We only need a single seam. So the other 35 black wires we&#8217;ll leave unmolested. We still need to separate them one from the other.</p>
      	
      	<p>To separate the black wires where they join at the poles we will need to even further divide up the north- and south-pole beads. We&#8217;ll cut those beads into grapefruit sections by slicing, not through the remaining 35 wires, but in between them toward the center of each bead. This will give us 37 (<note>not 36</note>) grapefruit-wedge-shaped fragments for each pole-bead, north and south.</p>
      	
      	<p>Why 37 and not 36? Remember our first original cut...the one required to complete the seam? That cut split into halves one of the grapefruit-wedge bead fragments. So 37 pole bead fragments, with two of those each being half as thick as the others. North and south, both pole beads are divided into 35 full-width grapefruit-wedge sections and two only half-width. The half-width sections each have only half a wire, which likewise bears only half-beads along its length.</p>
      	
      	<p>Now it is undone enough so that we can lay it flat. It bunches up some at the equator because the equator wire is longer than any other of the remaining horizontal, cake-layer wires. But we&#8217;ll ignore that for the moment. Bunched up in the middle or not we&#8217;ll lay it out as flat as we can onto a black cookie sheet. We put this cookie sheet into an oven.</p>
      </topic>
      
      <topic>
        <title>Baking a sculpt map</title>
      	
      	<p>In the oven the black wires soften and slump. Those beads which had once held in a humped up position because of their wires, settle down int a perfect square pattern. The back wires disappear completely. All we can see resting on the black cookie sheet is perfect square of rainbow-hue, blobs.</p>
      	
      	<p>Looking at our square of rainbow-hue blobs lying on their black cookie sheet, we notice that all of the cut-in-half beads lay at opposite ends of the cookie sheet to left and right. All of the grapefruit-wedge, pole-bead fragements lay at opposite ends to top and bottom. At each of the four corners is a single cut-in-half, grapefruit-wedge, pole-bead fragment.</p>
      	
      	<p>That means the whole top row of rainbow-hue bead fragments each reperesent a single bead, the north pole. Similarly, the entire bottom row of of bead fragments are just the south pole. The whole left column of half-beads, represent one half of the seam. And likewise, the entire right-most column represents the other half of that same seam. This is exactly what a sculpt map represents.</p>
      	
      	<p>As the oven temperature rises, the rainbow-hue beads and bead fragments melt into equal-sized, rainbow-hue dots on the black paper. We take it out and have for ourselves a flat graphic map which represents a round globe very exactly and precisely.</p>
      </topic>
      
      <topic>
        <title toc="What&#8217;s still wrong">What&#8217;s still wrong with this picture?</title>
      	
      	<p>Remember where we took the Earth&#8217;s globe as our starting example? And because of that our scuplt map has dots arranged in a rectangle of 37 x 19? That numbering scheme is not very good for computers. Computers hate irregular combinations like that. So sculpt maps are square. They have to measure at some nicely even multiple of 32 x 32.</p>
      	
      	<p>While 32 x 32 is okay, you&#8217;ll mostly find them at 64 x 64 or even 128 x 128. Bigger is better, but not beyond 128. Anything higher than 128 is just a waste and causes unnecessary lag. You don&#8217;t get any more resolution for having doubled or quadrupled the count. All that it does is help SL deal with a little problem it has uploading colors. If you provide just 32 it will upload mostly intact. If you send it 128 then it will get there fully intact. It has to do with lossy compression algorithms which I shall not go into here.</p>
      	
      </topic>
     
     <topic>
       <title>Shape limitations</title>
      	 <p>Every sculpty for second life currently uses the sphere-like, color mapping detailed above. Imagine that you have a sphere and can beat it into almost any shape you want. One of the things you cannot do is bore holes into the surface. You can pinch and dent it inward. But you cannot bore any holes clear through it.</p>
      	 
      	 <p>Tight corners can also be tough. Bear in mind that the sculpt map only shows where grid-line criss-crosses meet and where vertical lines join like wagon spokes at each pole. The proper name for such an intersection is <i>vertex</i>, and in plural <i>vertices</i>. The actual sculpty is not these vertices alone, but them together with the surface areas stretching between. Knowing where the vertices lay suffices to know also how the surface must stretch between them. So a sculpt map need only contain positional data for vertices. The in-between suface areas are inferred. They just happen.</p>
      	 
      	 <p>Those in-between surfaces might <i>just happen</i>, but they do not always happen quite how you might expect. Turn too sharp of an inside corner and you will find that unaccounted for in-between surface stretching across an in-between void just where you do not want.</p>
      	 
      	 <p>Also take care to note as how the web of surface can even pull away from any given vertex if two or more other vertices pull it harder the other way. So you have to think of the un-accounted for surface as not super-glued to every vertex, but only strongly attracted to them. Think of the surface as a sheet of nearly invisible, stretchy rubber. Lay this sheet upon the square of rainbow-hued beads. Magnetize both, so that the sheet very much wants to stick to every bead in just the place where it now lay.</p>
      	 
      	 <p>Now when you move a bead (<note>which we should properly call a <i>vertex</i></note>) the nearly invisible rubber sheet wants to try and follow that bead. But the other beads are drawing it too. Pull that one bead too very far away from the rest and the sheet will follow only so far as it can. There, having stretched its furthest, it will hang as a bulge in the sheet questing for the unreachable bead.</p>
      	 
      	 <p>How do you overcome that? Group your vertices closer together in those regions. If you need the sculpty surface to make a sharp corner, be it an inside or outside corner, group your vertices closer there so that they may tug all together. Any place where the scuplty fabric lays fairly in a straight line, you don&#8217;t need many vertices there.</p>
     </topic>
     
     <topic>
       <title>Impenetrablility</title>
       <p>All sculpties, alas, are impenetrable. If you need to penetrate them, even if they are a bowl, they need to be phantoms. This is set in your SL create/edit mode for whatever object you sculpt-map comprises. I trust SL to fix this problem in due course. But for now that&#8217;s how it is.</p>
     </topic>
      
  </section>    
    
    <!-- SECTION DELIMITER -->
  <section>
  
	<title>Semi-automatic methods</title>
	<p>I know of no direct and easy way to obtain quality sculpt maps from <code>*.obj</code> files. Here, however, is a passable work-around. It consists of inflating proto-sculpties inside a wire-frame mesh.</p>

	<images>
	  <img src="./tn_Cow_for_SL_in_Rhino_4.png" href="./Cow_for_SL_in_Rhino_4.png">16-Sculpty Rhino 4 Model</img>
	  <img src="./tn_16-Sculpty_Bronze_Cow_Inside_SL.jpg" href="./16-Sculpty_Bronze_Cow_Inside_SL.jpg">How now bronze cow?</img>
	</images>

	<p>This cow is one I made for import into Second Life using the Rhino 4 CAD system. Each color represents a proto-sculpty, that is to say, a NURBS sphere object. This cow-shaped collection of NURBS spheres are now ready for conversion into sculpt maps. That I will do by dragging its <code>Cow_for_SL.3dm</code> file onto the <code>3dm2sculpt.exe</code> function the same as always.</p>

	<p>The really cool part is how easy it was to mold those 16 separate NURBS spheres into the desired cow-part shapes. It only took me two evenings thanks to the <code>FillMeshWithSphere.rvb</code> script very kindly provided by Pascal Golay of Robert McNeel and Associates (publishers of Rhino 4). He wrote it for me in response to a query I posted on their News portal. Thank you Pascal!</p>

	<p><warn>Pascal permits me to re-distribute this script for free on the condition that it be accepted as-is, that is to say <i>freeware</i>, with all the usual caveats and disclaimers. Pascal and his employers provide no support and are accorded full immunity even should the sun go out as a result of your using it.</warn></p>

	<p>The script works like so... Imagine that you place a spheroid balloon inside a wireframe sculpture and slowly inflate it as far as you reasonably could. Our theoretical balloon is much like its real-world counterpart in being not perfectly supple. So we can't make it to fill every cranny perfectly. Nor will it flow around corners. But even so the results are quite good. To fill any tight spaces or turn any bendy elbows we just have to use more balloons.</p>

	<p>Use it like so...</p>

	<ol>
	  <li>Unzip this file <a class="button" href="FillMeshWithSphere.zip">ZIP</a> to anywhere.
	    <ol>
	      <li>It unpacks to a pure-ASCII text file named <code>FillMeshWithSphere.rvb</code></li>
	    </ol>
	  </li>
	  <li>Drag the script into any one of the Rhino 4 windows.</li>
	  <li>Type <code>FillMeshWithSphere</code> into the Rhino 4 command widget. It will ask you to...
	    <ol>
	      <li>Select any fully closed mesh.</li>
	      <li>Select a virginal default sphere pre-placed inside said mesh.</li>
	    </ol>
	  </li>
	  <li>Wait patiently while Rhino 4 works its wonders...
	    <ul>
	      <li>The original default sphere is rebuilt to 16x32 UV dimensions.</li>
	      <li>Said sphere is next inflated step-by-step, with all control points moved radially outward.</li>
	      <li>The script exits when all points have been pushed up against the nearest mesh surface.
	        <ol>
	          <li>Which is why it won't flow around corners.</li>
	          <li>Control points can poke out through a hole, though. And this will cause an error.</li>
	        </ol>
	      </li>
	    </ul>
	  </li>
	</ol>

	<topic>
		<title>Inflating a cow</title>
		<p>It took me a few tries to get the above results. The trick is in how one divides up the mesh. This I did by splitting it with NURBS spheres and ovoid cylinders as suited the local geometry. Having experienced some minor sculpty-shrinkage phenomena previously I was careful to split not a single mesh, but paired copies. This way I could be sure of having some overlap material with each split out section. Having overlap assures no gaps in later re-assembly.</p>

		<p>Then I had to close off the holes that resulted from spliting the mesh. Usually I could do that easily with <code>FillMeshHoles</code>. When that worked then I was ready to just insert a virgin sphere and call the script.</p>

		<p>One time, however, calling <code>FillMeshHoles</code> made a big mess. It was on the front upper leg. That edge was just too raggedy. Rhino's attempt to close off that ragged hole only worked less than 100%. A bunch of tiny holes were left. If any control points get pushed out such a hole then the operation fails so that you will have waited in vain.</p>

		<p>To fix that problem I had to go back and manually trim the hole's edges and make them pretty. I did this by repeatedly calling <code>DeleteMeshFace</code> to individually remove a whole lot of ugly splinter-like facets leaving only nice clean big ones. That took a lot of trimming. So it was especially good that I'd started with plenty of overlap material. Trimming complete, I then had to maually close the hole with repeated calls to <code>PatchSingleFace</code> building a cover over the hole one triangle at a time, the bigger the better. That done, I popped a virgin sphere into the closed off shoulder and called the script.</p>

		<p>The lower feet were another problem. Being kind of skinny and not well suited to balloon inflation I found it helps to first distort their proportions using <code>Scale2D</code> by 4 for the sphere-inflation and then later calling <code>Scale2D</code> again by 0.25 to undo the swelling.</p>

		<p>The tail turned out to be impossible. It was just too twisty. So I made a tail the old fashioned way by creating a sphere. This I next stretched out long and straight, adding extra knots to make it pipe-like. Manually dragging control points got it looking poofy at the swishing end. Then I made a call to the <code>FlowAlongCurve</code> function to obtain the curvy pose.</p>
	</topic>

	<topic>
		<title>Higher resolutions</title>
		<p>The script is pure text. So it is easy to view and edit. Mostly it reads like Klingon to me. But one thing is so obvious I was tempted to experiment with it. So I changed lines 18 &amp; 19 in my copy to read like so...</p>

		<pre>
			Dim SampU: SampU = 64
			Dim SampV: SampV = 64
		</pre>

		<p>...thereby increasing the NURBS sphere resolution to UV 64x64 from 32x16. My previous experiments show that doing so sometimes helps <code>3dm2sculpt.exe</code> to make clearer sculpties even though its own output can not be higher than the sculpty limit of 32x32. I assume that Cindy Crabgrass has it doing something pretty clever in there. Setting it to 32x32 will most likely approximate the quality of what most sculpty-creation methods afford. Going higher does makes sense though. I do that to get an overall tight knot concentration to insure high UV-knot density in areas where feature density is high. Then I later reduce the knot count manually by removing knots from regions of lower feature density.</p>
		<p>On my own Dell M6300 with 3MB an effort to obtain clearer definition around the eyes of my cow-head sculpty pictured above by running 128x128 crashed from lack of memory after half an hour. My next attempt at 96x64 ran fine.</p>
	    <images>
	      <img src="./tn_Cow_Head_UV_77x100.png" href="./Cow_Head_UV_77x100.png">UV 96x64 adjusted to 77x100</img>	
	      <img src="./Cow_Head_UV_77x100_Sculptypaint.png">Smoothed in SculptyPaint</img>		
	      <img src="./sculpt_Cow_Head_UV_77x100.png">Sculpt Map</img>	
	      <img src="./tn_Cow_Heads_with_Pattern.png" href="./Cow_Heads_with_Pattern">Second Life</img>	
		</images>
	    
	    <p>Above you see the process results up to, but not including, final texturing. It problably looks like I've wasted a lot of effort to preserve features sure to be lost in the final UV 32x32 result. But who knows if in a year or two Linden Labs might start supporting higher resloution sculpted prims? All I'd need do is crank out a new map and drop it on the existing prim. But for now this is what we get. Left-to-right, they are...
		  <ol>
	        <li>Last stage in Rhino hand-weaking the knot locations.</li>
	        <li>Inside SculptPaint after smoothing.</li>
	        <li>The 128x128 sculpt map output by SculptyPaint.</li>
		    <li>Rezzed inside Second Life and with my pre-paint custom test pattern applied.
	          <ul>
	            <li>Applied is a texture of a 32x32 grid (numbered in base-32 from 00 at top-left to vv at bottom right.</li>
	            <li>Every square actually aligns with the sculpt map's UV vertices.</li>	
			    <li>So I can look at it and paint (laboriously) in 2D for a 3D wrap-around.</li>
	          </ul>		  
	        </li>
	      </ol>		
	    </p>	
	
      </topic>
    </section>
        
    <section>
      <title>Manual methods</title><inlink></inlink>
      
      <p>Until such time as SL sculpty features shall be officially embeded in <code>Rhino</code>, folks like me have to make do with workarounds. I don&#8217;t know how others may manage, but here is how I get by...</p>
      
      <topic>
        <title toc="UV resolution limts">A word about U V resolution limits</title>
        <p>Keep this as low as you can. Do that for the simplicity of your editing. The fewer control points there are in a model the simpler your editing task will be.</p>
        
        <p>Alternately, do not fear the built-in constraint of 33 x 33 UV resolution required by the SL rendering engine. The sculpt-map conversion process (<note>from <code>Rhino 4</code> to <code>3dm2sculpt</code> to <code>sculptypaint</code> to SL object</note>) will re-adjust UV resolution for you. So if you need 50, 100 or more in Rhino, that is not a barrier at all. It will pose an editing nightmare later however. So do try and keep the UV knots down to a minimum. Stay simple as a kindness to yourself, not out of fear for crashing the SL sculpty rendering engine.</p>
      </topic>
			
      <topic>
        <title>Successive approximation</title>
        <p>Currently and for at least the immediate future, SL&#8217;s sculpty rendering engine interprets all 2D sculpt-map texture files like flat-map projections from a severly distorted globe. So whatever shape you require in the end, the surest method is to morph your way to that shape by starting from a solid sphere. While conterintuitive, it turns out not to be all that hard. Proceed as follows.</p>
        <ol>
					<li>It may be that the shape you want is not at all spheroid. In which case...
            <ul> 
              <li>Create a proximate model the quick-and-easy Rhino way by lofting from curves, etc.</li>
              <li>Lock that object to serve as a phantom guide so as to mimic its shape.</li>
            </ul>
          </li>          		
          <li>The actual sculpty begins when you create an initial solid sphere.</li>
          <li>Morph said sphere incrementally until it fills the self-same space as your phantom model.</li>
					<li>Use <code>CageEdit</code> to knead said sphere by dragging on its <code>bounding box</code>.
						<ul>
							<li>The <code>bounding box</code> caging a given shape presents only limited opportunities.</li>
							<li>When you have draged on the current <code>bounding box</code> for all that it&#8217;s worth, just delete it.</li>
							<li>Make a new <code>bounding box</code> on the current shape and begin dragging anew.</li>
							<li>Repeat as needed.</li>
						</ul>
					</li>
					<li>Use <code>Bend</code>, <code>Shear</code>, <code>Taper</code> &amp; <code>Twist</code> to effect similar gradual transformations.</li>
					<li>While you are at these iterations, avoid sharp corners (<note>kinks</note>).
					  <ul>
					    <li>Except at the poles, where even needle like points are okay.</li>
					    <li>Truly necessary angles will need to be at least minimally rounded.</li>
					    <li><note>Fail to do this and the sculpty rendering engine will likely insert an unsightly artifact resembling a stretched rubber sheet.</note></li>
					  </ul>
					</li>
					<li>Where those tools do not suffice, drag on individual knots directly.
					  <ul>
					    <li>Keep all four views open any time you do this.</li>
					    <li>Drag in one view with carefully chosen <code>osnap</code> limits on while watching all the other views simultaneously. Otherwise your 3D intuiton can get very easily turned around.</li>
					  </ul>
					</li>
		    </ol>
		    <br/>
		  </topic>
      
      <topic>
      	<title>Revolved surfaces</title>
      	<p>Basically, any shape you could reasonably turn on a lathe also seem to work pretty well. So long as these conditions apply...</p>
      	<ul>
      	  <li>There should be no sharp cuts or corners (<note>kinks</note>) in the model.</li>
      	  <li>The model&#8217;s UV coordinate system should appear as if it might have begun as a sphere.</li>
      	</ul>
		    <br/>
      </topic>
      
      <topic>
      	<title>Example successes</title>
      	<p>I have made these. I do not provide the sculpt maps, though. I intend to sell them, after all.</p>
        
      	<subtopic>
      	  <title>Vampire Goblet</title>
      	  <p>This is my very first project. Really it&#8217;s just one of the exercies from the Rhino training manual plus a little bit extra.</p>
					
					<images>
						<img 
							src="./tn_SL_Goblet_Screenshot_SL.png" 
							href="./SL_Goblet_Screenshot_SL.png">As seen in SL</img> 
						<img 
							src="./tn_SL_Goblet_Screenshot_Rhino.png" 
							href="./SL_Goblet_Screenshot_Rhino.png">Rhino model</img> 
					</images>
        
					<p><b>Prim count = 2. </b>Shown in the SL screenshot but not in Rhino is the contents (<note>blood</note>) of the goblet. This I made by taking the differential of the goblet&#8217;s inside and another solid. I had to mildly fillet the edge to make the UV model more spheroid-esqe.</p>
					
        </subtopic>
      	
      	<subtopic>
      	  <title>Pagoda Roof</title>
      	  <p>My third project. This one I made to help my landlord in one of his major gardening projects.</p>
					
					<images>
						<img 
							src="./tn_SL_Pagoda_Roof_Screenshot_SL.png" 
							href="./SL_Pagoda_Roof_Screenshot_SL.png">As seen in SL</img> 
						<img 
							src="./tn_SL_Pagoda_Roof_Screenshot_Rhino_001.png" 
							href="./SL_Pagoda_Roof_Screenshot_Rhino_001.png">Rhino model</img> 
						<img 
							src="./tn_SL_Pagoda_Roof_Screenshot_Rhino_002.png" 
							href="./SL_Pagoda_Roof_Screenshot_Rhino_002.png">Rhino model</img> 
					</images>
        
					<p><b>Prim count = 1. </b>Note that the surface texture I also custom made myself using the free, vector drawing program <code>Inkscape</code>. This has three layers, merged and exported to <code>*.png</code> format, as follows...</p>

					<ol>
						<li><b>Top: </b>Hand drawn trim in dash pattern at 1% blur.
						  <ul>
						    <li>I employed a standard SL test pattern as my guide.</li>
						    <li>This I viewed of-line upon the model using <code>sculptypaint</code></li>
						    <li>This is how I knew where to draw the 3D edge trim on a 2D texture pattern.</li>
						  </ul>
						</li>
						<li><b>Middle: </b>A granular gold texture at 95% opacity.</li>
						<li><b>Bottom: </b>A black and white tile pattern at 100% opacity.</li>
					</ol>
		      <br/>
					
        </subtopic>
      	
      	<subtopic>
      	  <title>Corner Bench</title>
      	  <p>My fourth project. This one awaits my study of <code>Poser 7</code> before I can script my own poseballs.</p>
					
					<images>
						<img 
							src="./tn_SL_Corner_Bench_Screenshot_SL.png" 
							href="./SL_Corner_Bench_Screenshot_SL.png">As seen in SL</img> 
						<img 
							src="./tn_SL_Corner_Bench_Screenshot_Rhino.png" 
							href="./SL_Corner_Bench_Screenshot_Rhino.png">Rhino model</img> 
					</images>
        
					<p><b>Prim count = 3. </b>The two legs and support rail are of a single, stretched-sphere sculpty. I made it like so...</p>

					<ol>
						<li>I first positioned the two prior prims: bench seat and bency back.</li>
						<li>I made simple separate curves for the rail&#8217;s longer sections.
							<ul>
								<li>The part which goes actually through the seat back.</li>
								<li>The parts parallel to the seat bottom, supporting it.</li>
								<li>The upright legs.</li>
							</ul>
						</li>
						<li>The long sections I then joined with arcs using <code>snap to end</code>.</li>
						<li>I joined all the curves.</li>
						<li>I built a pipe a long the curves.</li>
						<li>I created a default curve of UV resolution 4 x 4.</li>
						<li>I located my sphere in the middle of the pipe&#8217;s longest section.</li>
						<li>I stretched the spheres poles out along the curve, adding V knots as I went.</li>
						<li>Next-to-last I flaired out the feet.</li>
						<li>Lastly I added a full compliment of U knots.</li>
					</ol>
		      <br/>
        </subtopic>
        
      </topic>
		  
      <topic>
        <title>Exporting from Rhino into SL</title>
        <p>This is what has worked best for me...</p>
        <ol>
          <li>Export your model from out of Rhino in the standard <code>*.3dm</code> format.</li>
          <li>Translate each <code>*.3dm</code> into a sculpty using the 3-rd party program <code>3dm2sculpt</code> by SL resident Cindy Crabgrass.
          	<ul>
          		<li>Download it from here <a href="http://wiki.secondlife.com/wiki/3dm2sculpt">3dm2sculpt</a></li>
          		<li>Read the directions. It&#8217;s very easy.</li>
          		<li>Otherwise wonderful, <code>3dm2sculpt</code> keeps the true X, Y &amp; Z proportions from the original model. This is not ideal for sculpties.</li>
            </ul>
          </li>
          <li>Sculpties show better when they fit maximally within a virtual sphere. To inflate them, I use <code>sculptypaint</code> by SL resident Cel Edman.
          	<ul>
          		<li>Download it from here <a href="http://www.xs4all.nl/~elout/sculptpaint/">sculptypaint</a></li>
          		<li>Read the directions. It&#8217;s very easy.</li>
            </ul>
          </li>
          <li>Export your final sculpty from <code>sculptypaint</code> in <code>*.png</code> format at 128 x 128 resolution (<note>to overcome <code>JPEG 2000</code> compression-loss artifacts</note>).</li>
        </ol>
		    <br/>
      </topic>
			
    </section>
    
    <!-- SECTION DELIMITER -->
        
    <section>
      <title>Why lofting does not work...yet</title><inlink></inlink>
      
      
      <topic>
        <title>How my first project in Rhino went wrong</title>   

				<p>My first attempt to design a pagoda roof prototype in <code>Rhino</code> by lofting curves (<note>the seemingly most obvious method</note>) went awry. Here is exactly how and why lofting does not yet work in building sculpties for Second Life. One day I expect it will work. But that day has yet to dawn</p>
				
				<p>Not as how the geometry may look spherical, but is not. As far as the sculpty-rendering engine of SL is concerned, this model is torus-like, not sphere-like. So the engine assembles it wrongly.</p>


				<images>
					<img 
						src="./tn_3dm_rendered_by_Rhino.png" 
						href="./3dm_rendered_by_Rhino.png">Rendered by <code>Rhino</code></img> 
					<img 
						src="./tn_3dm_in_Rhino.png" 
						href="./3dm_in_Rhino.png">Original <code>*3dm</code> in <code>Rhino</code><br/><note>(design height)</note></img> 
						<img 
							src="./sculpty_from_3dm2sculpt.png" 
							href="./sculpty_from_3dm2sculpt.png">Output from <code>3dm2sculpt</code></img> 
				</images>	
        
      </topic>
        
        
			<topic>
				<title>How lofting might work some day</title>
				<p>A <code>Rhino</code>-exported lofted surface translated by <code>3dm2sculpt</code> will have an unsightly split artefact. Why so? Because lofted surfaces want to to fit inside a torus, not a sphere. Let me demonstrate.</p>

				<ul>
					<li>Open the <code>3dm2sculpt</code>-generated <code>*.tga</code> file into <code>GIMP</code> (<note>or Photoshop, whatever</note>).</li>
					<li>Export the <code>*.tga</code> as <code>*.png</code> format.</li>
					<li>Open the <code>*.png</code> into <code>sculptypaint</code> format.</li>
					<li>Rotate the view to see the unsightly split artefact showing in your sculpty.
						<ul>
							<li>Optional: <note>Export to <code>*.obj</code> and view said file in <code>Rhino</code> to see the split artefact better.</note></li>
						</ul>
					</li>
					<li>Note that <code>sculptypaint</code> is showing the sculpty in sphere mode.</li>
				</ul>      
		    <br/>


				<p>The split artefact viewed in <code>sculptypaint</code>. (<note>Note that any editing done in <code>sculptypaint</code> will expand dimenstions to comletely fill a theoretical cube. This is good! You want this.</note>)</p>

				<images>
					<img 
						src="./tn_SP_as_sphere.png" 
						href="./SP_as_sphere.png"><code>*.obj </code><b>as sphere</b><br/>in <code>sculptypaint</code> <br/>showing split artefact</img>
					<img 
						src="./tn_obj_as_sphere_0.png" 
						href="./obj_as_sphere_0.png"><code>*.obj </code><b>as sphere</b><br/>showing split artefact<br/>imported by <code>Rhino</code><br/><note>(normal RL proportion)</note></img> 
					<img 
						src="./tn_obj_as_sphere_1.png" 
						href="./obj_as_sphere_1.png"><code>*.obj </code><b>as sphere</b><br/>expanded by <code>sculptypaint</code><br/>imported by <code>Rhino</code><br/><note>(best sculpty proportion)</note></img> 
				</images>	

				<p>Now let&#8217;s see what happens when we view that same exact model <warn>as a torus</warn> instead of a sphere.</p>

				<ul>
					<li>Within <code>sculptypaint</code> select the torus mode instead.</li>
					<li>See the split artefact appear to magically mend itself.
						<ul>
							<li>Optional: <note>Export to <code>*.obj </code>and view said file in <code>Rhino</code> to see the split artefact actually mended.</note></li>
						</ul>
					</li>
					<li>Click <code>Save 128x128 Sculpt Image PNG</code> to save the fixed version.</li>
					<li>Rename the PNG so created to something reasonable.</li>
					<li>Do not upload to Second Life.</li>
				</ul>
		    <br/>

				<p>The split artefact as apparently mended in <code>sculptypaint</code>. I hasn&#8217;t been mended, not really. But it appears so. Why? Because we are seeing how out would look if Second Life had the ability to stitch the sculpty graphic&#8217;s ends together in a torus-like manner. The actual sculpty graphic itself has not significantly changed.</p>


				<images>
					<img 
						src="./tn_SP_as_torus.png" 
						href="./SP_as_torus.png"><code>*.obj </code>screenshot <b>as torus</b><br/>in <code>sculptypaint</code> <br/>showing mend</img>
					<img 
						src="./tn_obj_as_torus.png" 
						href="./obj_as_torus.png"><code>*.obj </code><b>as torus</b><br/>in <code>Rhino</code><br/>showing mend<br/><note>(sculpty size)</note></img> 
					<img 
						src="./Mended_Sculpty.png" 
						href="./Mended_Sculpty.png"><code>*.png </code><b>as torus</b><br/>rebaked by <code>sculptypaint</code><br/><note>(Do not upload)</note></img> 
				</images>

				<p>But alas, Second Life does not yet have feature. There has been talk of it though. Wouldn&#8217;t that be really terrific? Let us all ask, politely, that Linden Labs might hasten that forward.</p>

			</topic>
			
<!--					
					<p>Blah</p>
					
					<images>
						<img 
							src="./tn_" 
							href="./">Step 1</img> 
						<img 
							src="./tn_" 
							href="./">Step 1</img> 
					</images>
-->

      
    </section> 
        
    <!-- SECTION DELIMITER -->
    
    <section>
    	<title>Texturing tools</title><inlink>templates</inlink>
    	
    	<p>Just like sculpt maps, textures are 2D graphic files made for use on 3D objects. Basically, textures are like paintings on flat sheets of rubber that your computer graphics card wraps around a 3D shape to give it, obviously enough, <i>texture</i>. Without this texture wrapped around it, the shape is either invisible or nearly so.</p>
    	
    	<p>Very expensive 3D paint programs hold up the actual 3D model for easy painting on each side in turn using the mouse. Most of us have to make due without such an expensive convenience, however. For that we require a less costly work-around method. Chief among these is the use of templates.</p>
    	
    	<p>When you wrap a 2D graphic (<note>photo, painting, whatever</note>) around a 3D object model the computer only gives you two choices: default and planar. For both sculpties and avatars you nearly always want the default. The default is to wrap it so that the square edges of your graphic fit along a seam on the surface of the 3D model.</p>
    	
    	<p>On avatars that seam is rather complex but always exactly in the same place. On sculpties that seam is very simple but can be almost anywhere at all. And wherever there is a seam on the 3D model your graphic must be either featurelessly uniform or else perfectly aligned. The former is ugly and obvious. The latter can be agonizingly difficult. A template will help to achieve the latter. A template will pinpoint where the seam is and how it aligns.</p>
    	
    	<topic>
    		<title>Custom templates</title>
    	
    	  <p>If you want to design SL clothing, very good templates already exist. All you need do is search the SL blogs to find them. Books on SL content creation also provide them on accompanying CDROMs. Prior SL content creators have made these for their own use and generously share them with all.</p>
    		
    		<p>Human SL avatars are based on one of two 3D models: male and female. Changing your shape does not change the basic elements of that model. Changing your shape only works to inflate or lengthen certain dimensions of that model. A template is an outline of the very 3D model itself, displayed in 2D format. So one of two templates is all you need to design clothing for any shape.</p>
    		
    		<p>Pre-existing custom templates are useless for texturing scupties because the basic 3D model itself varies wildly from object to object. So sculpty designers have to make due with generic templates as a guide.</p>
    		
    		<p>I&#8217;ll say no more about custom templates since this how-to is all about sculpties.</p>
    		
    	</topic>

    	<topic>
    		<title>Generic templates</title> 
					
    	  <p>Here are two generic templates, both very useful as alignment guides in texturing sculpties. On the left is a 20x20 resolution test pattern freely distributed both on-line and in books like "Second Life, A Guide to Your Virtual World". It was designed by SL resident Robin Sojourner. You will find it very useful most of the time. On the right is a 32x32 resloution test pattern designed by yours truly. I hope you might find it equally useful the rest of the time.</p>
    	  
    	  <p>Which of the two will prove the most useful will vary depending upon how large or complicated your sculpty design happens to be. For medium to very small items, the one by Robin Sojourner will surely serve best. For use with really big designs you might like mine better.</p>
    	  
				<images>
					<img 
						src="http://www.robinwood.com/Catalog/Technical/SL-Tuts/Test-Pattern.jpg">20 x 20 Pattern<br/>by Robin Sojourner</img> 
					<img  
						src="./SL_Test_Pattern.png">32 x 32 Pattern<br/>by Aplonis Ember</img>
				</images>
					
    	  <p>Let us compare them. Each is good in its own way. Robin&#8217;s has a repeating pattern of numbers. Every square on my template has its own unique number-and-letter combination. On large objects it can be hard, using Robin&#8217;s template to know quite which square you are looking at because you cannot see the whole thing, or see the back side. The number-and-color combinations are unique, true. I still find it hard, sometimes. On small objects the font on mine becomes nearly unreadable, though. They compliment each other in this regard. So it is good to have two templates: one each for different sizes.</p>  
    	  
    	  <p>I myself use Robin&#8217;s often and only had need of making a new one when I got into much larger objects. That and upon occasion it sometimes helps to blow an object up really large, even up to the 10-meter limit. Then I can float my avatar beside it, use mouselook, and be my very own microscope. In those cases too a more detailed test pattern often proves handy. Come the day when VR graphics improve enough, we all might have need for a 64x64 pattern. Progress like that always happens sooner than anyone expects.</p>	  
    	  
    		<p>One very important feature of my pattern shows up poorly, if at all, on this web page, owing to the light color background. Know, however, that in addition to the three, white, 2-pixel-high, hoizontal rows there are also a pair of white, 1-pixel wide, vertical lines. These align with the seam of a sculpty. These are the left-most and right-most columns and measure only one pixel wide. They are only a pixel wide because when they join at the seam of a sculpty in your 3D view on SL, then they merge as a single, white, 2-pixel wide, seam indicator. This makes the seam quite easy to find.</p>  
    		
    		<p>Right click on each one in turn and do a <code>Save As</code> to someplace convenient.</p>
    		
    		<subtopic>
    			<title>How I made it</title>
    			<p>Don&#8217;t be too impressed with how much effort it was to get such fine detail on a 32x32 resolution pattern. It really wasn&#8217;t hard at all. I cheated on that part by writing a Perl script.</p>
    			<p>Not too many lines of Perl was all it took to generate those fine details as pure ASCII in SVG format. I then viewed the SVG in Firefox and clipped it from off the screen using GIMP. It came off pixel-perfect because I stuck only to formats like SVG and PNG. If Robin&#8217;s looks a little fuzzy when blown up large, that is because JPEG suffers horribly from lossy compression. Most of the time it doesn&#8217;t matter. But in the particular case of a 32x32 pattern it surely would have. The font which I had to use is so small the dot on a lower-case <i>i</i> is just one pixel.</p>
    	
    	  	<p>Then, after I&#8217;d played around with the new pattern a bit, I decided it could also do with white lines to denote the sculpty seam at LH and RH. Being lazy, rather than starting over with a modified Perl script, I just decided to paint those in manually using the GIMP.  And while I was at it, I figured why not also trisect the matrix vertically. So I did. Hope these features suit your needs as well as mine.</p>
    		</subtopic>
    	</topic> 

    	<topic>
    		<title>Using templates</title>
    	
    	  <p>To use a template you need to have a drawing program that lets you use layers. Layered drawing is like having an entire pad of tracing paper where you can draw different parts on differnt sheets and see them all, or not, depending on how transparent you make that sheet. The base (<note>lowest</note>) layer could be for outlines only. The next layer up might be pasted-in clips from photos. The one above that might be text. And so on... The top layer, at say, 75% to 95% transparent, will be your template.</p>
    		
    		<p>You start out with two layers, the base upon which you have nothing drawn yet, and the top with only the template. Layered drawings do not upload into SL. So you export a copy of this in PNG format. Always choose PNG, never JPEG...unless you really want it fuzzy and indistinct.</p>
    		

				<images>
					<img 
						src="./Template_Examples.png">Pattern to texture<br/>in plural stages.</img>
				</images>  
				
				<p style="text-align:center;font-size:smaller">What is that thing? See these pics... 
					<a class="button" href="./Radial_Engine_Installed_002.png">Link 1</a> 
					&#160; 
					<a class="button" href="./Radial_Engine_Installed_001.png">Link 2</a>
				</p> 
    		
    		<subtopic>
    		  <title>Early trials</title>
    		
    			<p>I recommend starting out with Robin Sojourner&#8217;s 20x20 template. That way you can proof your model off-line from SL using SculptyPaint. My own 32x32 template displays poorly in ScuptyPaint because of its very tiny font. ScultpyPaint has, of course, its own built-in template. But that one assumes you like counting pixels. I do not. I love SculptyPaint however because it saves me lots of bother uploading try-out textures into SL, not to mention wasting all those L$10 upload fees.</p>
    		
    			<p>Look at your sculpty wearing the templated try-out texture and decide how you want to proceed with editng. Make some additions and/or changes to the texture in the layered drawing program, re-export and re-view it in Sculpty paint again. It&#8217;s really quite easy, working off-line that way. Saves for a lot of frustration.</p>
    		</subtopic>
    		
    		<subtopic>
    			<title>Final trials</title>
    		
    			<p>Once you are mostly happy with your texture in all those areas away from the seam and areas of high contour distortion comes the time to upload trial textures for last-round modeling in SL itself. Each such upload will cost $L10, though. So don&#8217;t be hasty and jump ahead to this step too early. Be sure that now is really the time to focus only on those areas near to the seam, poles and high-contour areas.</p>
    		
    			<p>In your layered drawing program, swap out Robin Sojourner&#8217;s template for mine. Re-export your texture as <code>PNG</code> and upload it, along with your sculpty, to SL. Model your scupty wearing the latest try-out texture from several angles. Make notes. Take screenshots. Log off from SL.</p>
    		
    			<p>Return to your layered drawing program and edit the texture. Re-export, re-upload, re-apply, re-view jotting more notes and taking more screenshots. In your very final rounds blow the sculpty up really big, a full 10 meters. That way your avatar can be your virutal microscope. You ought be able to line things up pixel perfect with such close scrutiny as that.</p>
    		
    			<p>When you are finally happy, turn the template layer 100% transparent, re-export, re-upload, re-apply and call it done.</p>
    		</subtopic>
    	</topic>    	

    	<topic>
    		<title>Inkscape</title>
    	
    	  <p>Which layered drawing program ought you to use? My own favorite is Inkscape. It&#8217;s free and open-source. Inkscape is a <i>vector</i> drawing program. It works quite differently from ordinary paint programs. If you know Corel Draw, it&#8217;s kind of like that. The native storage format for Inkscape is <code>SVG</code>. But you can export to <code>PNG</code> also.</p>
    		
    		<p>Paint programs are the bane of anyone not a shure-handed free-style artist. I can&#8217;t use them. I lay down paint, shake my head, undo, and try again. Over and over. Vector drawing allows for successive approximation. With Inkscapae I can down a line of virtual wet spagetti. Then I can squint at it and push or drag it closer to where I think it looks better. I never need to undo and start over. When the line is where I want, I can then tell that line, "Be fatter, be red, be 10% blurry and 50% transparent". Then I can copy that line and tell the copy to be just a little different. I can do that not just with lines, but with any shape at all. I can make a square and tell that square, "Show this picture inside, tint it orange". That sort of thing.</p>
    		
    		<p>Draw freely; get Inscape here: <a class="button" href="http://inkscape.org/">&#160;Inkscape Home Page&#160;</a></p>
    	</topic> 
    	
    </section>

  </body>
</howto>    


