<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Softimage Blog &#187; Rigging</title>
	<atom:link href="http://www.softimageblog.com/archives/category/rigging/feed" rel="self" type="application/rss+xml" />
	<link>http://www.softimageblog.com</link>
	<description>People and thoughts behind Softimage in production...</description>
	<lastBuildDate>Wed, 23 Nov 2011 18:48:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Facial Animation, The Static KineState, and Dorritos?</title>
		<link>http://www.softimageblog.com/archives/209</link>
		<comments>http://www.softimageblog.com/archives/209#comments</comments>
		<pubDate>Thu, 24 May 2007 03:12:35 +0000</pubDate>
		<dc:creator>Steven Caron</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Rigging]]></category>

		<guid isPermaLink="false">http://www.xsi-blog.com/archives/209</guid>
		<description><![CDATA[This is my first post at XSIBlog, so I want to thank Patrick and the other authors for keeping this going. I have always wanted to share but time is always against me not to mention having something worthy of sharing. PLEASE NOTE: The following python scripts require this procedure to work properly. Facial Animation [...]]]></description>
			<content:encoded><![CDATA[<p>This is my first post at XSIBlog, so I want to thank Patrick and the other authors for keeping this going. I have always wanted to share but time is always against me not to mention having something worthy of sharing.</p>
<p><strong>PLEASE NOTE</strong>: The following python scripts require <a href="http://www.softimageblog.com/?p=24">this procedure</a> to work properly.</p>
<p><strong>Facial Animation</strong></p>
<p>A thread started at <a href="http://www.xsibase.com/">XSI Base</a> simply named, <a href="http://www.xsibase.com/forum/index.php?board=11;action=display;threadid=29757">facial animation (questions)</a>, many facial rigging and animation concepts were shared. The two concepts discussed mostly were your traditional shape animation controlled by in scene controllers (a la Osipa) and also using Control Splines or curves with many complex rig elements that give you the desired motion. At the end of the day shape animation gets you pretty far with many character types ( realistic and stylized ) and setup time is pretty fast. The setup time is also important here, Softimage considers this a feature for FaceRobot that they market and rightfully so. Time is money, producers know this as should you! So if you will hear me out I am going to explain a way for you to continue to use shape animation and still get the low level control over subtle face movements.</p>
<p><span id="more-209"></span><strong>The Static KineState</strong></p>
<p>What is the Static KineState? I am sure anyone spending any amount of time rigging knows something about it. So lets define it for those that don&#8217;t.</p>
<p>The <a href="http://softimage.wiki.avid.com/xsidocs/skel.htm">Static KineState</a> indicates that an envelope is applied to the skeleton element. The StaticKineState is the initial position of the skeleton when the envelope was applied, and is used for envelope calculations.</p>
<p>If this property is storing these initial values then I must be able to change them. This is the gem that makes this rig work.</p>
<p><strong>Dorritos</strong></p>
<p>Now we are going to make the rig. This is not intended to be a tutorial so I apologize if I miss steps, all the project files are included at the bottom. So lets go over the rig!</p>
<p>I am starting with Primitive>Character>Face Man and I first made a quick &#8220;smile&#8221; shape, followed by a typical neck, head, and jaw for the character. I used nulls instead of joints for simplicity sake.</p>
<p><img src='http://www.xsi-blog.com/userContent/upload/2007/05/rignsmile.gif' alt='rignsmile.gif' /></p>
<p>Now I am going to make a clone of this enveloped head and immediately remove the duplicated shape cluster, envelope cluster, and the &#8220;ShapeWeights&#8221; property. The clone uses the &#8220;CopyOp&#8221;, with this we get all the deformations from the first head which include the envelope deform and shape deform. Now we need to setup the local deformers for the cloned mesh.</p>
<p><img src='http://www.xsi-blog.com/userContent/upload/2007/05/exploreclone.jpg' alt='exploreclone.jpg' /></p>
<p>These local deformers use an &#8220;Object To Cluster&#8221; constraint. I like to use edge clusters but you could use any SubComponent you choose. So I picked an edge in the corner of the mouth and ran this handy script that creates the cluster, the object, constrains them, and makes the local deformer. You need to select a component on the original head, and run the script.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#imports</span>
<span style="color: #ff7700;font-weight:bold;">import</span> win32com.<span style="color: black;">client</span>
<span style="color: #ff7700;font-weight:bold;">from</span> win32com.<span style="color: black;">client</span> <span style="color: #ff7700;font-weight:bold;">import</span> constants
&nbsp;
<span style="color: #808080; font-style: italic;">#globals</span>
xsi	= win32com.<span style="color: black;">client</span>.<span style="color: black;">Dispatch</span><span style="color: black;">&#40;</span> <span style="color: #483d8b;">&quot;XSI.Application&quot;</span> <span style="color: black;">&#41;</span>.<span style="color: black;">Application</span>
xsiPrint = xsi.<span style="color: black;">LogMessage</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> setupDorrito<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
	<span style="color: #ff7700;font-weight:bold;">if</span> xsi.<span style="color: black;">Selection</span> <span style="color: #66cc66;">&lt;</span> <span style="color: #ff4500;">1</span>:
		xsiPrint<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Select an component!&quot;</span>,constants.<span style="color: black;">siError</span><span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">False</span>
&nbsp;
	root = xsi.<span style="color: black;">ActiveSceneRoot</span>
&nbsp;
	<span style="color: #808080; font-style: italic;">#create cluster constrained null, setup its look</span>
	clsCnsNull = root.<span style="color: black;">AddNull</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;clsCnsNull&quot;</span><span style="color: black;">&#41;</span>
	clsCnsNull.<span style="color: black;">primary_icon</span>.<span style="color: black;">value</span> = <span style="color: #ff4500;">0</span>
	clsCnsNull.<span style="color: black;">size</span>.<span style="color: black;">value</span> = <span style="color: #ff4500;">0.1</span>
	clsCnsNull.<span style="color: black;">shadow_icon</span>.<span style="color: black;">value</span> = <span style="color: #ff4500;">7</span>
	clsCnsNull.<span style="color: black;">shadow_colour_custom</span>.<span style="color: black;">value</span> = <span style="color: #ff4500;">1</span>
	clsCnsNull.<span style="color: black;">B</span>.<span style="color: black;">value</span> = <span style="color: #ff4500;">1</span>
	clsCnsNull.<span style="color: black;">G</span>.<span style="color: black;">value</span> = <span style="color: #ff4500;">0.5</span>
&nbsp;
	<span style="color: #808080; font-style: italic;">#make cluster from selection</span>
	subComponent = xsi.<span style="color: black;">Selection</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#41;</span>.<span style="color: black;">subComponent</span>
	cnsCls = subComponent.<span style="color: black;">CreateCluster</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;cnsCls&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
	<span style="color: #808080; font-style: italic;">#constrain object to cluster</span>
	cns = clsCnsNull.<span style="color: black;">Kinematics</span>.<span style="color: black;">AddConstraint</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;ObjectToCluster&quot;</span>,cnsCls<span style="color: black;">&#41;</span>
	cns.<span style="color: black;">tangent</span>.<span style="color: black;">value</span> = <span style="color: #ff4500;">1</span>
	cns.<span style="color: black;">dirx</span>.<span style="color: black;">value</span> = <span style="color: #ff4500;">0</span>
	cns.<span style="color: black;">diry</span>.<span style="color: black;">value</span> = -<span style="color: #ff4500;">1</span>
	cns.<span style="color: black;">upvct_active</span>.<span style="color: black;">value</span> = <span style="color: #ff4500;">1</span>
	cns.<span style="color: black;">upx</span>.<span style="color: black;">value</span> = <span style="color: #ff4500;">1</span>
	cns.<span style="color: black;">upy</span>.<span style="color: black;">value</span> = <span style="color: #ff4500;">0</span>
&nbsp;
	<span style="color: #808080; font-style: italic;">#make dorrito</span>
	dorrito = root.<span style="color: black;">AddNull</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;dorrito&quot;</span><span style="color: black;">&#41;</span>
	dorrito.<span style="color: black;">primary_icon</span>.<span style="color: black;">value</span> = <span style="color: #ff4500;">0</span>
	dorrito.<span style="color: black;">size</span>.<span style="color: black;">value</span> = <span style="color: #ff4500;">0.2</span>
	dorrito.<span style="color: black;">shadow_icon</span>.<span style="color: black;">value</span> = <span style="color: #ff4500;">8</span>
	dorrito.<span style="color: black;">shadow_colour_custom</span>.<span style="color: black;">value</span> = <span style="color: #ff4500;">1</span>
	dorrito.<span style="color: black;">G</span>.<span style="color: black;">value</span> = <span style="color: #ff4500;">1</span>
	dorrito.<span style="color: black;">shadow_offsetX</span>.<span style="color: black;">value</span> = <span style="color: #ff4500;">0.1</span>
	dorrito.<span style="color: black;">shadow_scaleX</span>.<span style="color: black;">value</span> = <span style="color: #ff4500;">0</span>
&nbsp;
	clsCnsNull.<span style="color: black;">AddChild</span><span style="color: black;">&#40;</span>dorrito<span style="color: black;">&#41;</span>
	dorrito.<span style="color: black;">kinematics</span>.<span style="color: black;">local</span>.<span style="color: black;">transform</span> = XSIMath.<span style="color: black;">CreateTransform</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
setupDorrito<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>The result&#8230;</p>
<p><img src='http://www.xsi-blog.com/userContent/upload/2007/05/setupdorrito.jpg' alt='setupdorrito.jpg' /></p>
<p>At work we call this controller a &#8220;Dorrito&#8221; because when the first &#8220;on the face&#8221; rig came out, one of our animators, Jason Taylor, started calling it that and it stuck. So my controller is a flat pyramid that looks like a Dorrito, so I suggest you do the same :) Now I will add an envelope to the cloned mesh and choose this Dorrito as a deformer. I now need to paint the cloned mesh&#8217;s envelope. The way I do this is add another deformer to the deformer list, set all the points to 100 % of this new deformer, and then choose the Dorrito and paint it&#8217;s influence. Once I am happy with the deformation I just remove the extra deformer from the envelope and I get zero weights except for where I painted the Dorrito&#8217;s influence. This deformer moves with the cluster constrained null, but it causes this nasty double transform when I rotate the head!</p>
<p><img src='http://www.xsi-blog.com/userContent/upload/2007/05/doubletransform.jpg' alt='doubletransform.jpg' /></p>
<p>Why is this happening? Because you have the first envelope on the original head which is deforming the points based on the transformation of the deformers (neck, head, and jaw). Then you have a &#8220;CopyOp&#8221; and another envelope above that is getting transformed by the same movement so XSI just does it twice! What you want to do is subtract that first envelope transformation from the second envelope transformation. The Static KineState gives you access to that intial position. If you take your deformer&#8217;s Static KineState property and set it&#8217;s parameters equal to the global transform parameters of your cluster constrained null you will effectively be constantly reseting the deformer&#8217;s initial position. Here is a script to setup the expressions between the cluster constrained null and the local deformer. Just select cluster constrained null first, then the Dorrito.</p>
</pre>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#imports</span>
<span style="color: #ff7700;font-weight:bold;">import</span> win32com.<span style="color: black;">client</span>
<span style="color: #ff7700;font-weight:bold;">from</span> win32com.<span style="color: black;">client</span> <span style="color: #ff7700;font-weight:bold;">import</span> constants
&nbsp;
<span style="color: #808080; font-style: italic;">#globals</span>
xsi	= win32com.<span style="color: black;">client</span>.<span style="color: black;">Dispatch</span><span style="color: black;">&#40;</span> <span style="color: #483d8b;">&quot;XSI.Application&quot;</span> <span style="color: black;">&#41;</span>.<span style="color: black;">Application</span>
xsiPrint = xsi.<span style="color: black;">LogMessage</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> setupStaticState<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
	defList = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
	clsList = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
	<span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">xrange</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span>,<span style="color: #008000;">len</span><span style="color: black;">&#40;</span>xsi.<span style="color: black;">Selection</span><span style="color: black;">&#41;</span>,<span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span>:
		clsList.<span style="color: black;">append</span><span style="color: black;">&#40;</span>xsi.<span style="color: black;">Selection</span><span style="color: black;">&#40;</span>i<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
		defList.<span style="color: black;">append</span><span style="color: black;">&#40;</span>xsi.<span style="color: black;">Selection</span><span style="color: black;">&#40;</span>i+<span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
&nbsp;
	<span style="color: #ff7700;font-weight:bold;">for</span> a,b <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">zip</span><span style="color: black;">&#40;</span>defList,clsList<span style="color: black;">&#41;</span>:
		defKineState = a.<span style="color: black;">Properties</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Static KineState&quot;</span><span style="color: black;">&#41;</span>
		clsKine = b.<span style="color: black;">Properties</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Kinematics&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
		defKineState.<span style="color: black;">orix</span>.<span style="color: black;">AddExpression</span><span style="color: black;">&#40;</span>clsKine.<span style="color: black;">FullName</span> + <span style="color: #483d8b;">&quot;.global.rotx&quot;</span><span style="color: black;">&#41;</span>
		defKineState.<span style="color: black;">oriy</span>.<span style="color: black;">AddExpression</span><span style="color: black;">&#40;</span>clsKine.<span style="color: black;">FullName</span> + <span style="color: #483d8b;">&quot;.global.roty&quot;</span><span style="color: black;">&#41;</span>
		defKineState.<span style="color: black;">oriz</span>.<span style="color: black;">AddExpression</span><span style="color: black;">&#40;</span>clsKine.<span style="color: black;">FullName</span> + <span style="color: #483d8b;">&quot;.global.rotz&quot;</span><span style="color: black;">&#41;</span>
		defKineState.<span style="color: black;">posx</span>.<span style="color: black;">AddExpression</span><span style="color: black;">&#40;</span>clsKine.<span style="color: black;">FullName</span> + <span style="color: #483d8b;">&quot;.global.posx&quot;</span><span style="color: black;">&#41;</span>
		defKineState.<span style="color: black;">posy</span>.<span style="color: black;">AddExpression</span><span style="color: black;">&#40;</span>clsKine.<span style="color: black;">FullName</span> + <span style="color: #483d8b;">&quot;.global.posy&quot;</span><span style="color: black;">&#41;</span>
		defKineState.<span style="color: black;">posz</span>.<span style="color: black;">AddExpression</span><span style="color: black;">&#40;</span>clsKine.<span style="color: black;">FullName</span> + <span style="color: #483d8b;">&quot;.global.posz&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
setupStaticState<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>Now you can rotate the head or jaw and the deformer just rides the mesh, you can even use shape animation and the deformer just rides on top of that with no double transform.</p>
<p><img src='http://www.xsi-blog.com/userContent/upload/2007/05/nodoubletransform.jpg' alt='nodoubletransform.jpg' /><br />
<a href='http://www.xsi-blog.com/userContent/upload/2007/05/dorritocap.mov' title='dorritocap.mov'>Viewport Capture</a></p>
<p><strong>Closing</strong></p>
<p>There are many ways to rig a face and none should be discarded from any rigger's toolbox. I hope other riggers will get some use out of this technique and will share their work with us. Before I go, I want to thank my rigging supervisor Remi McGill for suggesting the usage of the Static KineState and <a href="http://www.blur.com/">Blur</a> for allowing me to share with the community. Below are the project files which includes the scripts. Thanks for reading!</p>
<p><a href='http://www.xsi-blog.com/userContent/upload/2007/05/dorritoproject.zip' title='dorritoproject.zip'>Project Files</a></p>
<img src="http://www.softimageblog.com/?ak_action=api_record_view&id=209&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.softimageblog.com/archives/209/feed</wfw:commentRss>
		<slash:comments>21</slash:comments>
<enclosure url="http://www.xsi-blog.com/userContent/upload/2007/05/dorritocap.mov" length="254200" type="video/quicktime" />
		</item>
		<item>
		<title>Geometry + Rig / RefModels in 6.0</title>
		<link>http://www.softimageblog.com/archives/169</link>
		<comments>http://www.softimageblog.com/archives/169#comments</comments>
		<pubDate>Thu, 01 Feb 2007 16:43:44 +0000</pubDate>
		<dc:creator>Helge Mathee</dc:creator>
				<category><![CDATA[JScript]]></category>
		<category><![CDATA[Rigging]]></category>
		<category><![CDATA[Thoughts]]></category>

		<guid isPermaLink="false">http://www.xsi-blog.com/archives/169</guid>
		<description><![CDATA[After a couple of chit chats about referenced models in 6.0, I would take to take a few minutes to explain how you can use the delta referencing system to separate rig and geometry into two different files, which can be edited independently from one another. Okay so here&#8217;s how it works: Create your geometry [...]]]></description>
			<content:encoded><![CDATA[<p>After a couple of chit chats about referenced models in 6.0, I would take to take a few minutes to explain how you can use the delta referencing system to separate rig and geometry into two different files, which can be edited <strong>independently</strong> from one another.</p>
<p><img src="http://www.xsi-blog.com/userContent/upload/2007/02/geo_rig_ref.jpg" alt="geo_rig_ref.jpg" /></p>
<p><span id="more-169"></span><br />
Okay so here&#8217;s how it works:</p>
<ol>
<li>Create your geometry and rig</li>
<li>Put rig and geometry into two different models</li>
<li>Create the connection (envelope, constraints etc)</li>
<li>Export <strong>FIRST</strong> the geometry, and <strong>SECOND</strong> the rig.</li>
<li>Go to a new scene and import <strong>FIRST</strong> the rig and <strong>SECOND</strong> the geometry as referenced models.</li>
<li>To ensure the models are loaded in the right order in the future, also name them alphabetically in that order. (in my example I am using numbers to set that order)</li>
<li>Put both ref models into a new one and export it as the &#8220;fullmodel&#8221;.</li>
</ol>
<p>You end up with three files. The first one includes just the geometry + envelope operator and weightmaps, the second one includes just the rig, and the third one, the &#8220;fullmodel&#8221;, includes just two file pointers to the previous two.</p>
<p>If you want to go ahead and make changes to the rig, you can externally, while just loading the rig up and modify it. If you are about to change the geometry, and you don&#8217;t want to loose the envelope, just open up the fullmodel, localize the submodels and do your edits, afterwards convert the geometry back to referenced, and reload the &#8220;fullmodel&#8221;.</p>
<p>Below you can see a working example in the explorer, and a repro script to generate this setup. All steps (also changes on the geometry after the connection has been established) are part of that script.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> project <span style="color: #339933;">=</span> ActiveProject.<span style="color: #660066;">path</span><span style="color: #339933;">;</span>
NewScene<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// create objects</span>
CreatePrim<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Cylinder&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;MeshSurface&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
Create2DSkeleton<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">3</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0.5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
AppendBone<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;eff&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">3</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// create models</span>
CreateModel<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;root&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;_0rig&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
CreateModel<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;cylinder&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;_1geo&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// reset the transform of the models so</span>
<span style="color: #006600; font-style: italic;">// they are in the center of the world</span>
SetUserPref<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;SI3D_NODETRANSFORM_CHILD_COMPENSATE&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
ResetTransform<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;_0rig&quot;</span><span style="color: #339933;">,</span> siObj<span style="color: #339933;">,</span> siSRT<span style="color: #339933;">,</span> siXYZ<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
SetUserPref<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;SI3D_NODETRANSFORM_CHILD_COMPENSATE&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// create the envelope (connect the rig)</span>
ApplyFlexEnv<span style="color: #009900;">&#40;</span>
<span style="color: #3366CC;">&quot;_1geo.cylinder;&quot;</span><span style="color: #339933;">+</span>
<span style="color: #3366CC;">&quot;_0rig.bone,_0rig.bone1&quot;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// export to files</span>
ExportModel<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;_1geo&quot;</span><span style="color: #339933;">,</span> project<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>Models<span style="color: #000099; font-weight: bold;">\\</span>geo.emdl&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
ExportModel<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;_0rig&quot;</span><span style="color: #339933;">,</span> project<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>Models<span style="color: #000099; font-weight: bold;">\\</span>rig.emdl&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// new scene</span>
NewScene<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// import both as referenced</span>
SICreateRefModel<span style="color: #009900;">&#40;</span>project<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>Models<span style="color: #000099; font-weight: bold;">\\</span>rig.emdl&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;_0rig&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
SICreateRefModel<span style="color: #009900;">&#40;</span>project<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>Models<span style="color: #000099; font-weight: bold;">\\</span>geo.emdl&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;_1geo&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// create a new model including both</span>
CreateModel<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;_0rig,_1geo&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;fullmodel&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// export this model again</span>
ExportModel<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;fullmodel&quot;</span><span style="color: #339933;">,</span> project<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>Models<span style="color: #000099; font-weight: bold;">\\</span>fullmodel.emdl&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// new scene</span>
NewScene<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// import the fully rigged, separated model as referenced</span>
SICreateRefModel<span style="color: #009900;">&#40;</span>project<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>Models<span style="color: #000099; font-weight: bold;">\\</span>fullmodel.emdl&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;fullmodel&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// change the geometry while maintaining the connection</span>
MakeModelLocal<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;_0rig&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
MakeModelLocal<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;_1geo&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
Translate<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;_1geo.cylinder.edge[67]&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1.5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
ConvertToRefModel<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;_1geo&quot;</span><span style="color: #339933;">,</span> project <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>Models<span style="color: #000099; font-weight: bold;">\\</span>geo.emdl&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// reload the full model</span>
UpdateReferencedModel<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;fullmodel&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Here&#8217;s a <a href="http://www.xsi-blog.com/userContent/upload/2007/02/geo_rig_referenced.js" title="geo_rig_referenced.js">link</a> to the script file so you can download it and try it out.</p>
<p>I hope this helps!<br />
Helge</p>
<img src="http://www.softimageblog.com/?ak_action=api_record_view&id=169&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.softimageblog.com/archives/169/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Enveloping rigid elements</title>
		<link>http://www.softimageblog.com/archives/110</link>
		<comments>http://www.softimageblog.com/archives/110#comments</comments>
		<pubDate>Mon, 21 Aug 2006 10:15:24 +0000</pubDate>
		<dc:creator>Helge Mathee</dc:creator>
				<category><![CDATA[JScript]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Rigging]]></category>

		<guid isPermaLink="false">http://www.xsi-blog.com/?p=110</guid>
		<description><![CDATA[how to get elements on a surface, while they are not deforming.]]></description>
			<content:encoded><![CDATA[<p>Alright, here&#8217;s a new article of mine. This time I am dealing with a problem a lot of people are facing when trying to envelope a large number of objects onto a surface, while the objects themselves are not supposed to deform. As this is a typical problem related to objects like feathers, all scripts + tools are named somewhat related to feathers. All of these techniques can be applied to other objects as well, though.</p>
<p>Lets start. One easy way to approach this problem is to create a mesh including all objects we want to envelope, and then simply set the envelope weights of all points of a single instance to the exact same weight, aka:</p>
<p>In this image we have a mesh with 6 cubes (all merged together) enveloped to a two-bone chain.<br />
By default the weight is blended in the middle part,</p>
<p><img src="http://www.xsi-blog.com/userContent/hmathee/wingRig/rigid_env_01.jpg" alt="" /></p>
<p>which results in a deform for the middle two cubes:</p>
<p><img src="http://www.xsi-blog.com/userContent/hmathee/wingRig/rigid_env_02.jpg" alt="" /></p>
<p><span id="more-110"></span>by using the weight editor, I adjusted the weight of all cubes so they only target one bone:</p>
<p><img src="http://www.xsi-blog.com/userContent/hmathee/wingRig/rigid_env_03.jpg" alt="" /></p>
<p>which results in movement, but not deformation for each one:</p>
<p><img src="http://www.xsi-blog.com/userContent/hmathee/wingRig/rigid_env_04.jpg" alt="" /></p>
<p>So this is all working, why bother dealing with a system to deal with these things? Well, as long as we are dealing with six cubes it is all cheesy and simple, but as soon as we start dealing with something like feathers on a bird, we can&#8217;t just go in and envelope each feather with the weight editor, well, we could, but it would just take forever.</p>
<p>What I used to do in those cases is to build an instancer operator, which would take a mesh containing &#8220;where-and-how-to-instance&#8221; information, and a single mesh which is supposed to be instanced. First, lets clarify the &#8220;where&#8230;to-instance&#8221; part:</p>
<p>When instancing an object, all you need is a position, orientation and scaling, which can be stored as three points really, but in this example I am going to use 4 points:</p>
<p><img src="http://www.xsi-blog.com/userContent/hmathee/wingRig/rigid_env_05.jpg" alt="" /></p>
<p>1. Pos: The position of the object to be instanced<br />
2. Cns: The Z-Direction of the object (seen from pos)<br />
3. Upv: The Y-Direction of the object (seen from pos)<br />
4. Bnd: An additional point to be used for deformation (later)</p>
<p>So basically we could draw a quadrangular polygon instead of four points, like below, where we are instancing ten grids:</p>
<p><img src="http://www.xsi-blog.com/userContent/hmathee/wingRig/rigid_env_06.jpg" alt="" /></p>
<p>Now: Instead of enveloping the objects we want to be instanced, we envelope the mesh containing the quads. This is going to be called our &#8220;Instancing-Cloud&#8221;. It contains all of the information we need to instance our objects. Moreover, it is easy to envelope, as we know exactly which points are to be enveloped where. Every first out of four points is the position, every second out of four points is the z-direction etc&#8230; All we need to build is a couple of scripts:</p>
<p>1. One which adds a quadrangle to a mesh based on a transform of a null.<br />
2. One which creates a new mesh and instances an object onto an Instancing-Cloud.<br />
3. One which generates clusters for the instance-cloud for easier enveloping.</p>
<p>A finished setup could look something like this: We see the quads representing the instances:</p>
<p><img src="http://www.xsi-blog.com/userContent/hmathee/wingRig/rigid_env_07.jpg" alt="" /></p>
<p>When deformed: The quads deform, but the instances will not:</p>
<p><img src="http://www.xsi-blog.com/userContent/hmathee/wingRig/rigid_env_08.jpg" alt="" /></p>
<p>Including the instances it should look like this:</p>
<p><img src="http://www.xsi-blog.com/userContent/hmathee/wingRig/rigid_env_09.jpg" alt="" /></p>
<p>When deformed:</p>
<p><img src="http://www.xsi-blog.com/userContent/hmathee/wingRig/rigid_env_10.jpg" alt="" /></p>
<p>As we have point clusters for each type of point in the instance-cloud (pos, cns, upv and bnd) it is quite simple to rig the cns for example to a bunch of rotational controllers:</p>
<p><img src="http://www.xsi-blog.com/userContent/hmathee/wingRig/rigid_env_11.jpg" alt="" /></p>
<p>And when we rotate them, only the cns points are deformed, therefore the instances rotate as well:</p>
<p><img src="http://www.xsi-blog.com/userContent/hmathee/wingRig/rigid_env_12.jpg" alt="" /></p>
<p>Additionally we can deform the cloud overall:</p>
<p><img src="http://www.xsi-blog.com/userContent/hmathee/wingRig/rigid_env_13.jpg" alt="" /></p>
<p>So now lets discuss the last part of the story: What&#8217;s the bnd position for?<br />
The bnd position is used for deformation of each instance. As this is quite limited, all I am going to do is move the instances points using a sinus function, to get somewhat of twisting and bending going on. This is up to your imagination, as I said, this setup has been used for feathers, that&#8217;s why the bnd position is used for bending (and named like that as well: bnd = bending).</p>
<p>In the next image I rigged the bnd position to the rotational controller earlier used for cns, to show what happens:</p>
<p><img src="http://www.xsi-blog.com/userContent/hmathee/wingRig/rigid_env_11.jpg" alt="" /></p>
<p>So now when I rotate them:</p>
<p><img src="http://www.xsi-blog.com/userContent/hmathee/wingRig/rigid_env_14.jpg" alt="" /></p>
<p>Or along another axis:</p>
<p><img src="http://www.xsi-blog.com/userContent/hmathee/wingRig/rigid_env_15.jpg" alt="" /></p>
<p>As always &#8211; <a href="http://www.xsi-blog.com/userContent/hmathee/wingRig/mt_feathers.js">I&#8217;d like to share the progress so far</a>, but I have to warn you, it is not at all documented:</p>
<p>Put the file into one of the plugins folders, and run the following script to get some feather setup going:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">NewScene<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> cloud <span style="color: #339933;">=</span> mt_createFeatherCloud<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> grid <span style="color: #339933;">=</span> CreatePrim<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Grid&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;MeshSurface&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
SetValue<span style="color: #009900;">&#40;</span>grid<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;.grid.ulength&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0.4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
SetValue<span style="color: #009900;">&#40;</span>grid<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;.grid.vlength&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
SetValue<span style="color: #009900;">&#40;</span>grid<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;.polymsh.geom.subdivu&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
Translate<span style="color: #009900;">&#40;</span>grid<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;.pnt[*]&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">1.4</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> siRelative<span style="color: #339933;">,</span> siLocal<span style="color: #339933;">,</span> siObj<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
FreezeObj<span style="color: #009900;">&#40;</span>grid<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> mesh <span style="color: #339933;">=</span> mt_createFeatherMesh<span style="color: #009900;">&#40;</span>cloud<span style="color: #339933;">,</span> grid<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> feathers <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> ActiveXObject<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;XSI.Collection&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&lt;</span><span style="color: #CC0000;">10</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
feathers.<span style="color: #660066;">Add</span><span style="color: #009900;">&#40;</span>mt_createFeatherNull<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
feathers<span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">kinematics</span>.<span style="color: #660066;">local</span>.<span style="color: #660066;">posx</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> i<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
mt_addFeathersToCloud<span style="color: #009900;">&#40;</span>cloud<span style="color: #339933;">,</span>feathers<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
mt_createCloudClusters<span style="color: #009900;">&#40;</span>cloud<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
DeselectAll<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Let me know how it goes,</p>
<p>enjoy!</p>
<img src="http://www.softimageblog.com/?ak_action=api_record_view&id=110&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.softimageblog.com/archives/110/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Soft IK in XSI, Part II &#8211; Stretchy bones</title>
		<link>http://www.softimageblog.com/archives/109</link>
		<comments>http://www.softimageblog.com/archives/109#comments</comments>
		<pubDate>Wed, 16 Aug 2006 17:28:06 +0000</pubDate>
		<dc:creator>Andy Nicholas</dc:creator>
				<category><![CDATA[Animation]]></category>
		<category><![CDATA[JScript]]></category>
		<category><![CDATA[Programming / Scripting]]></category>
		<category><![CDATA[Rigging]]></category>

		<guid isPermaLink="false">http://www.xsi-blog.com/?p=109</guid>
		<description><![CDATA[When I wrote the first article, I hadn&#8217;t planned on writing a sequel, but a couple of people on XSIBase asked me to look into how I could extend the Soft IK system to work with a stretchy bone chain. Initially, figuring out how this could work seems like a pretty tricky problem. The bone [...]]]></description>
			<content:encoded><![CDATA[<p>When I wrote the first article, I hadn&#8217;t planned on writing a sequel, but a couple of people on XSIBase asked me to look into how I could extend the Soft IK system to work with a <em>stretchy</em> bone chain. </p>
<p>Initially, figuring out how this could work seems like a pretty tricky problem. The bone chain needs to stretch intuitively to give the impression that it&#8217;s stuck to the IK effector. But we also need it to flatten gradually to avoid the snap effect. Unfortunately, the only thing we have available to us to control these two effects, is the ability to change the length of the bones, since the end position of the chain must always be located at the effector. </p>
<p>So we need to scale the bones to allow them to stretch, but at a specific rate to make sure we avoid the snap. Like this:</p>
<p><img src="/userContent/anicholas/softik/StretchyChain.gif" alt="Stretchy Soft IK" /></p>
<p><span id="more-109"></span>The first thing to do is to look at how we solved the problem for the non-stretchy bone chain. When we look at what happens when we move the Soft Effector past the point where it starts to leave the original IK effector behind, all we want to do for the stretchy bone chain system is make sure that the bone chain gets longer so that the original IK effector is at the same position as the Soft Effector. But we need to do this while also keeping the bones angles the same, this avoids the snap effect since the bone angles would change at exactly the same rate as in the non-stretchy bone chain system.</p>
<p>A diagram should make things a bit clearer. Basically, given a non-stretchy chain, we want to match the position of the two effectors by scaling the chain length, but without changing the bone angles, like this:</p>
<p><img src="/userContent/anicholas/softik/ChainScale.gif" alt="Scaling the Soft IK chain" /></p>
<p>Okay, so that doesn&#8217;t seem too hard. We just need to figure out how much to move the IK Effector to match the position of the soft effector. </p>
<p>The only way we can do this is by changing the length of the bone chain. Again, this initially looks like quite a tricky problem, until you realize that scaling the length of each bone by some value X, also scales the distance of the original IK effector from the IK root by a factor of X as well. A simple test proves it (and it can be easily shown with a little math too):</p>
<p><img src="/userContent/anicholas/softik/ScaleChain.gif" alt="Scaling bone lengths" /></p>
<p>This diagram shows a bone chain with bones of different lengths, before and after I scaled each individual bone length by a factor of 2. It can be seen that the IK effector has traveled directly away from the IK root and has doubled it&#8217;s distance from it. Not only that, but the bone angles have remained unchanged. This is exactly what we need!</p>
<p>Now, all we need to do is to figure out the amount we need to scale each bone length to make the original IK effector match the position of the soft effector. That scale factor is just the ratio of the distances of the two effectors:</p>
<p><em>Scale Factor = EvalDistance(IK root, Soft Effector) / EvalDistance(IK root, original IK effector)</em></p>
<p>Where EvalDistance() is just a function that measure the distance between the two objects.</p>
<p>Finally, we need to position constrain the original IK effector to the soft effector, so that it follows it. Otherwise, all that would happen is that the length of the chain would change.</p>
<p>So that&#8217;s it, we&#8217;re there. All that remains is to package it all up into a plugin with a handy custom property to drive it all. This is what the new property page looks like:</p>
<p><img src="/userContent/anicholas/softik/StretchyPPG.gif" alt="Stretchy Soft IK PPG" /></p>
<p>The bone lengths can be adjusted (and even animated) from this PPG, as well as the Soft Distance parameter, which behaves in exactly the same way as in the non-stretchy Soft IK. The bone lengths are all driven from this PPG using expressions. Note, that for extra performance we only have one Scripted Operator here which operates on the BoneScale parameter of the PPG. </p>
<p> I&#8217;ve updated the original Soft Effector script to include a new menu item to apply the Stretchy Bone Soft IK system to any chain you select.</p>
<p><a href="http://www.softimageblog.com/userContent/anicholas/softik/FXNut_SoftEffector.zip">Soft Effector Download (3Kb)</a></p>
<p>Incidentally, if you ever want to remove the Soft IK (stretchy or otherwise) from a bone chain. All you have to do is delete the Soft Effector object. All the expressions and operators will be automatically deleted since they will have lost their connections. Nice and tidy!</p>
<p>P.S. Thanks to Daniele Niero for suggesting I cache the math objects inside the operator user data!</p>
<img src="http://www.softimageblog.com/?ak_action=api_record_view&id=109&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.softimageblog.com/archives/109/feed</wfw:commentRss>
		<slash:comments>48</slash:comments>
		</item>
		<item>
		<title>Soft IK in XSI</title>
		<link>http://www.softimageblog.com/archives/108</link>
		<comments>http://www.softimageblog.com/archives/108#comments</comments>
		<pubDate>Mon, 14 Aug 2006 12:48:12 +0000</pubDate>
		<dc:creator>Andy Nicholas</dc:creator>
				<category><![CDATA[Animation]]></category>
		<category><![CDATA[JScript]]></category>
		<category><![CDATA[Programming / Scripting]]></category>
		<category><![CDATA[Rigging]]></category>

		<guid isPermaLink="false">http://www.xsi-blog.com/?p=108</guid>
		<description><![CDATA[When an IK chain extends towards its full length, it will tend to snap into it&#8217;s final position. To prevent this from happening, it is possible to give the appearance that the IK chain is stiffening as it extends towards it&#8217;s full length. This technique isn&#8217;t new and similar functionality is already implemented in Cinema [...]]]></description>
			<content:encoded><![CDATA[<p>When an IK chain extends towards its full length, it will tend to snap into it&#8217;s final position. To prevent this from happening, it is possible to give the appearance that the IK chain is stiffening as it extends towards it&#8217;s full length. This technique isn&#8217;t new and similar functionality is already implemented in Cinema 4D.</p>
<p>In XSI, we need a way of allowing the chain to gradually fall behind the position of the effector. This stops the effector from snapping the chain into the final position, and gives rise to a much more natural motion (as seen below).</p>
<p><img src="/userContent/anicholas/softik/SoftIK.gif" alt="Soft IK Comparison" /><br />
<em>(Note: If you are unable to view the GIF animation, you may need to change settings in your Firewall. For example, in Zone Alarm, you need to disable Privacy->Ad Blocking)</em></p>
<p><span id="more-108"></span>The snap effect visible in the top chain isn&#8217;t due to some inaccuracy in the IK calculation, but is just down to a simple geometrical effect. It can be shown mathematically (see diagram below) that as the effector pulls the chain into the final position, the velocity of the bones towards their final position tends towards infinity! This is obviously not desirable and can make the animation look jerky and artificial.<br />
<a href="http://www.softimageblog.com/userContent/anicholas/softik/BoneSnap.gif" target="_blank"><br />
<img src="/userContent/anicholas/softik/BoneSnap_thumb.gif" alt="Why snapping happens" /></a><br />
<em>(click to enlarge)</em></p>
<p>To achieve the type of motion shown in the lower chain, we need to add an extra object which is used to drive the IK chain effector. A scripted operator links the two objects and we use a mathematical expression to give the desired result. The only bits of information the operator needs are the total chain length, and something I call the &#8220;Soft Distance&#8221;. This represents the distance from the chain&#8217;s full extension that the effect starts to work.</p>
<p>There is one downside with this approach, as it means you can&#8217;t fix the end point of the chain in position. However, this can be solved as long as you are willing to put a small amount of extra work to animate the Soft Distance parameter.</p>
<p>The soft effector object has a custom property to allow you to easily control the operator.</p>
<p><img src="/userContent/anicholas/softik/PPG.gif" alt="Soft Effector PPG" /></p>
<p>To make things easier for you, the Chain Length is calculated by an expression which sums the length of each bone in the chain. This allows you to change the length of a bone, and still have the Soft IK work.</p>
<p>In the diagram below, the Soft Distance is represented by the distance between the green and the red lines (actually, they&#8217;re circles, but too large to see). As soon as the effector reaches the green line, our scripted operator starts to lag the chain effector behind our soft effector. This is done while making sure that we have no jerkiness in the motion of the chain effector.</p>
<p><img src="/userContent/anicholas/softik/SoftIK_Closeup.gif" alt="Soft IK Closeup" /><br />
<em>(Note: If you are unable to view the GIF animation, you may need to change settings in your Firewall. For example, in Zone Alarm, you need to disable Privacy->Ad Blocking)</em></p>
<p>The equation used to create this effect is shown below:</p>
<p><a href="http://www.softimageblog.com/userContent/anicholas/softik/Equation.gif" target="_blank"><br />
<img src="/userContent/anicholas/softik/Equation_thumb.gif" alt="Soft Effector Equation" /></a><br />
<em>(click to enlarge)</em></p>
<p>For a chain length of 3 and a soft distance of 1, this equation looks something like this:</p>
<p><a href="http://www.softimageblog.com/userContent/anicholas/softik/MainGraph.gif" target="_blank"><img src="/userContent/anicholas/softik/MainGraph_thumb.gif" alt="Distance Graph" /></a><br />
<em>(click to enlarge)</em></p>
<p>You can use the following link to download the Soft Effector plugin:</p>
<p><a href="http://www.softimageblog.com/userContent/anicholas/softik/FXNut_SoftEffector.zip">Soft Effector Download (3 Kb)</a></p>
<p>(Note that this also features the Stretchy Bone Chain extension shown in <a href="http://www.softimageblog.com/archives/109">Part 2</a> of this article)</p>
<p>To install the plugin, just download the zip file, unzip the script, and copy it to a &#8220;Plugins&#8221; folder. So for example, you can use your &#8220;C:\users\<em>username</em>\Softimage\XSI\Application\Plugins&#8221; folder, or one in your workgroup. </p>
<p>To use the Soft Effector, create a 2D or 3D Skeleton Chain, select any part of the chain, and go to &#8220;Model->Create->Skeleton->Apply Soft Effector&#8221;.</p>
<img src="http://www.softimageblog.com/?ak_action=api_record_view&id=108&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.softimageblog.com/archives/108/feed</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Template Based Rigging</title>
		<link>http://www.softimageblog.com/archives/102</link>
		<comments>http://www.softimageblog.com/archives/102#comments</comments>
		<pubDate>Thu, 22 Jun 2006 12:17:39 +0000</pubDate>
		<dc:creator>Helge Mathee</dc:creator>
				<category><![CDATA[JScript]]></category>
		<category><![CDATA[Rigging]]></category>

		<guid isPermaLink="false">http://www.xsi-blog.com/?p=102</guid>
		<description><![CDATA[When creating rather complex hierarchies, there are some things you wouldn''t essentially want to deal with. To facilitate these one of my favourite ideas comes into play: Automation.]]></description>
			<content:encoded><![CDATA[<p>When creating rather complex hierarchies, there are some things you wouldn&#8217;t essentially want to deal with. Those tasks include:</p>
<ul>
<li>Making sure all objects follow a valid naming scheme</li>
<li>Giving objects the correct icons / wirecolors / looks</li>
<li>Setup position- / rotationlimits based on the objects&#8217; types</li>
<li>Putting objects into groups based on their types</li>
<li>Changing names of sides when duplicating in symmetry</li>
<li>&#8230; and so many more</li>
</ul>
<p>To deal with these things one of my favourite ideas comes into play: Automation.</p>
<p><span id="more-102"></span>To explain a little bit what complexity we are dealing with, here&#8217;s a screenshot of some rig in the schematic view in different zooms:</p>
<p><img src="/userContent/hmathee/TemplateRigging/mt_rigz_01.jpg" alt="" /></p>
<p><b>A. Object templates</b></p>
<p>As you can see in the lower part of the image, there is naming convention applied to all objects in the hierarchy. The naming convention looks like this:</p>
<p>prefix_name_suffix</p>
<p>In this example the prefix can only be &#8220;m&#8221;, &#8220;l&#8221; or &#8220;r&#8221;, but it could be anything depending on your implementation. The suffix is used to determine the type of object we are dealing with, in the example the greenish objects have the &#8220;JNT&#8221; suffix, which stands for joint, a bone in a chain. Note that all objects have correct naming and the reason is that they have been created using templates. Here&#8221;s the idea:</p>
<p>Use one scripted command to create every object in a rig, using a template to define its attributes. This function would look like something similar to this (pseudo-code):</p>
<pre>function makeElement(prefix,name,suffix,parent)
{
    1. check if the object already exists
    2. check if the prefix is valid
    3. check if the suffix is valid
    4. create the element as a child of the given parent
    5. apply all attributes based on the suffix
    6. return the created element
}</pre>
<p>Not only will all objects obey the template rules, there are also some additional advantages to this method. Turning the workflow around, by having to know the name for an object <i>before</i> you create it, rather than naming it after it has been created already (we are all lazy, aren&#8217;t we) makes sure that rig-elements get the correct names, as you will not be able to create an object which already exists. Furthermore every object created by such a function can be re-created, as all of the information how to create the object is inside of its name. When you find an object called <i>m_global_SRT</i> which is a child of the object <i>m_global_BUF</i> you know how you can re-create it: You just call the function like this: <code>makeElement("m","global","SRT","m_global_BUF");</code></p>
<p>This means you can analyze the hierarchy quite easily and regenerate parts of a rig in a simple manner. Which brings us to the next type of templates.</p>
<p><b>B. Hierarchy templates</b></p>
<p>Templates for a full hierarchy are something like a script which describes how to generate the hierarchy, relying on object templates for each of the objects. There are some additional steps to do here though, as the objects might contain additional modifications. I am assuming that the helper functions to apply those modifications already exist in our rigging-toolset ;-) so I am not implementing anything here.</p>
<p>So a template for a simple hierarchy containing a hip and and a chest srt controller could look like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> makeHipAndChest<span style="color: #009900;">&#40;</span>parent<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    hip <span style="color: #339933;">=</span> makeElement<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;m&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;hip&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;SRT&quot;</span><span style="color: #339933;">,</span>parent<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    chest <span style="color: #339933;">=</span> makeElement<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;m&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;chest&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;SRT&quot;</span><span style="color: #339933;">,</span>hip<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Tweaking the functions a little bit, we can end up with something similar the code below:</p>
<pre>function makeElement(prefix,name,suffix,parent)
{
    1. check if the object already exists
    2. check if the prefix is valid
    3. check if the suffix is valid
    4. check if the suffix is SRT and if so, create a buffer object for it, using the same prefix and name but a "BUF" suffix
    5. create the element as a child of the given parent or of the buffer
    6. apply all attributes based on the suffix
    7. return the created element
}</pre>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> makeHipAndChest<span style="color: #009900;">&#40;</span>parent<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    hip <span style="color: #339933;">=</span> makeElement<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;m&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;hip&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;SRT&quot;</span><span style="color: #339933;">,</span>parent<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    transform<span style="color: #009900;">&#40;</span>hip<span style="color: #339933;">,</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">90</span><span style="color: #339933;">,</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    chest <span style="color: #339933;">=</span> makeElement<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;m&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;chest&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;SRT&quot;</span><span style="color: #339933;">,</span>hip<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    transform<span style="color: #009900;">&#40;</span>hip<span style="color: #339933;">,</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">5</span><span style="color: #339933;">,</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Simple enough, the example hierarchy looks like this:</p>
<p><img src="/userContent/hmathee/TemplateRigging/mt_rigz_02.jpg" alt="" /></p>
<p>The transform method is representing one essential modification done to the object in the hierarchy, well, its transform. But there are some more things to look at. Stuff like expressions, constraints, added custom property sets etc&#8230; should be persisted, as they are essential to a rig. What is important for the functionality as well is to be able to recreate a hierarchy changing parts of the naming scheme, for example make a left arm and then a right one, or prefix the name of each object created with &#8220;upper&#8221; or &#8220;lower&#8221; to specialize the naming of those objects. Using a function such as &#8220;makeElement&#8221; which is based on names will make this quite difficult though. To explain this in more detail, imagine the following scenario:</p>
<p>We created a simple hierachy of a camera and an interest, where the camera has a direction constraint to the interest. The camera is called &#8220;m_Camera_CAM&#8221; and the interest is called &#8220;m_CameraInterest_POS&#8221;. Now, if we call our function to create the camera, which could look like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> makeCamera<span style="color: #009900;">&#40;</span>parent<span style="color: #339933;">,</span>newPrefix<span style="color: #339933;">,</span>newName<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    prefix <span style="color: #339933;">=</span> newPrefix <span style="color: #339933;">?</span> newPrefix <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;m&quot;</span> <span style="color: #006600; font-style: italic;">// if there is a newPrefix, use that, otherwise use &quot;m&quot;</span>
    makeElement<span style="color: #009900;">&#40;</span>prefix<span style="color: #339933;">,</span>newName <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;camera&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;CAM&quot;</span><span style="color: #339933;">,</span>parent<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    makeElement<span style="color: #009900;">&#40;</span>prefix<span style="color: #339933;">,</span>newName <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;CameraInterest&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;POS&quot;</span><span style="color: #339933;">,</span>parent<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    makeConstraint<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;DIR&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;m_Camera_CAM&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;m_CameraInterest_CAM&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>If we would call the function with the following parameters <code>makeCamera(parent,"l","hero")</code> we would end up with two objects called <i>m_heroCamera_CAM</i> and <i>m_heroCameraInterest_POS</i> with no constraint, because the <i>makeConstraint</i> function is based on the old objects&#8217; names. To deal with those things we have to introduce a remapping scheme. It could look like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> makeCamera<span style="color: #009900;">&#40;</span>parent<span style="color: #339933;">,</span>newPrefix<span style="color: #339933;">,</span>newName<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    prefix <span style="color: #339933;">=</span> newPrefix <span style="color: #339933;">?</span> newPrefix <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;m&quot;</span> <span style="color: #006600; font-style: italic;">// if there is a newPrefix, use that, otherwise use &quot;m&quot;</span>
    element <span style="color: #339933;">=</span> makeElement<span style="color: #009900;">&#40;</span>prefix<span style="color: #339933;">,</span>newName <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;Camera&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;CAM&quot;</span><span style="color: #339933;">,</span>parent<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    remappingTable <span style="color: #009900;">&#91;</span> <span style="color: #3366CC;">&quot;m_Camera_CAM&quot;</span> <span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> element.<span style="color: #000066;">name</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// store the current name of the element to be able to remap</span>
    element <span style="color: #339933;">=</span> makeElement<span style="color: #009900;">&#40;</span>prefix<span style="color: #339933;">,</span>newName <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;CameraInterest&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;POS&quot;</span><span style="color: #339933;">,</span>parent<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    remappingTable <span style="color: #009900;">&#91;</span> <span style="color: #3366CC;">&quot;m_CameraInterest_POS&quot;</span> <span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> element.<span style="color: #000066;">name</span><span style="color: #339933;">;</span>
    makeConstraint<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;DIR&quot;</span><span style="color: #339933;">,</span>remappingTable<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">&quot;m_Camera_CAM&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>remappingTable<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">&quot;m_CameraInterest_CAM&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Alright &#8211; now we can rebuild hierarchies persisting their attributes by using object templates, adding local modifications such as transforms etc, constraints and expressions can be stored by remapping their inputs using the remappingTable etc&#8230; </p>
<p>With this we can now build a library of rig elements and recreate them easily, while still being able to change prefix and specialize the name. Moreover the rig parts can be recreated anywhere in the existing hierarchy, as the function takes the base parent as an input argument. What is really interesting about this approach though, is that you can write a function to <i>auto generate</i> rigging-part-functions by just analyzing what somebody rigged manually. Put simple: Rig manually -> Create a rigging function out of it -> Re-use the function to create the rig part multiple times !</p>
<p>To finish up the theory and the talk about &#8220;how nice it would be&#8221;, here&#8217;s an implementation of my own which I put together while rigging a couple of characters&#8230;</p>
<p><a href="http://www.softimageblog.com/userContent/hmathee/TemplateRigging/mt_rigz_doc.pdf">Documentation</a><br />
<a href="http://www.softimageblog.com/userContent/hmathee/TemplateRigging/mt_rigz.xsiaddon">Addon</a> (This is often saved as XML, just rename the file to &#8220;mt_rigz.xsiaddon&#8221;.)<br />
<a href="http://www.softimageblog.com/userContent/hmathee/TemplateRigging/mt_rigz_templates.avi">Movie</a> (Camtasia Capture 56 MB Techsmith Codec)</p>
<p>If anybody pushes this a lot further, and is allowed to share any of it, I&#8217;d love to get some feedback in this blog!</p>
<p>Enjoy!</p>
<img src="http://www.softimageblog.com/?ak_action=api_record_view&id=102&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.softimageblog.com/archives/102/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Now you see it, now you don&#8217;t. Digital assets in XSI.</title>
		<link>http://www.softimageblog.com/archives/100</link>
		<comments>http://www.softimageblog.com/archives/100#comments</comments>
		<pubDate>Thu, 15 Jun 2006 17:20:12 +0000</pubDate>
		<dc:creator>Andy Nicholas</dc:creator>
				<category><![CDATA[JScript]]></category>
		<category><![CDATA[Rigging]]></category>
		<category><![CDATA[Thoughts]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.xsi-blog.com/?p=100</guid>
		<description><![CDATA[Sometimes when you&#8217;re trying your hardest to put together a rig that the animators won&#8217;t break, you wish that XSI had something like Houdini&#8217;s digital assets. In case you haven&#8217;t come across Houdini yet, &#8220;Digital Assets&#8221; are a way of encapsulating a group of objects and hiding everything except for certain items that you choose. [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes when you&#8217;re trying your hardest to put together a rig that the animators won&#8217;t break, you wish that XSI had something like Houdini&#8217;s digital assets. In case you haven&#8217;t come across Houdini yet, &#8220;Digital Assets&#8221; are a way of encapsulating a group of objects and hiding everything except for certain items that you choose. </p>
<p>So as an example, you could create a Digital Asset of an apple. In the interface that you create, you would maybe expose a control to change the color of the apple. In fact, to make it even easier, it might just be a slider that controls the color to go from green to red. You could call that control &#8220;Ripeness&#8221; if you want. You could also add a slider for controlling the size. </p>
<p><span id="more-100"></span><br />
If you now give this asset to another artist, the only way they can change the apple is for them to use the controls you have provided. This means that they won&#8217;t be able to make the apple turn blue (accidentally or otherwise). </p>
<p>In a large pipeline, this can prove to be extremely useful. It means that if the TD knows what they&#8217;re doing, they can deploy assets in production which won&#8217;t get broken or changed in an unexpected way later on. Obviously, care must be taken not to take this paradigm too far and to over encapsulate the object making that asset inflexible. So research and planning for an asset&#8217;s role in the pipeline is vital to make sure that the right level of control is applied.</p>
<p>So how can we create Digital Assets in XSI? Natively, they aren&#8217;t supported. What do we need? We just need a way to store our asset, a method of presenting certain parameters of our choice to the user, and a way of hiding objects from various XSI editors (Explorer, etc.). </p>
<p>The obvious choice for storing our asset is to use an XSI model. Each model represents a unique namespace for objects and they are XSI&#8217;s current method of asset encapsulation (albeit limited).</p>
<p>The second one is also easy. Proxy parameters enable us to provide another location to change any parameter we want. We can also use conventional parameters and then link to them using expressions. While this method might not be quite as nice as a fully customized interface, it will do for this article. Other options might include using an HTML page to display controls to drive parameters, or an ActiveX control, etc.</p>
<p>So that just leaves us with hiding objects from the various XSI editors. To do that we use this:</p>
<p><code>obj.SetCapabilityFlag( siNotInspectable, true);</code></p>
<p>The <em>SetCapabilityFlag()</em> method can be found on the ProjectItem object, which occurs near the top of the class hierarchy of the SDK. This means that a large number of objects support this method, including mesh objects, operators, clips, materials, properties, clusters, and many others. In addition, the parameter object also has this method, despite not inheriting from the ProjectItem object.</p>
<p>So here&#8217;s an example implementation of the apple Digital Asset. </p>
<p><img src="/userContent/anicholas/digitalAssets/tut05_01.jpg" alt="The apple asset" /> </p>
<p>In the end, I put in four controls.</p>
<p><img src="/userContent/anicholas/digitalAssets/tut05_02.jpg" alt="Asset PPG Controls" /> </p>
<p>The Deform parameter drives the amplitude of a push operator connected to a weight map to add variation to the shape of the apple. Since I didn&#8217;t lock the weightmap, you can still modify it using the weight paint brush to change the shape.</p>
<p>The Ripeness parameter drives an expression to control the color in the render tree (you need to render the apple to see the color change). Note that I had to use a &#8220;Vector Share&#8221; via a &#8220;Vector To Color&#8221; to drive the diffuse color, as XSI doesn&#8217;t let you put expressions on color parameters. </p>
<p>The Size parameter uses some basic rigging to change the size of the apple without changing the size of the stalk.</p>
<p>And finally, the Resolution parameter directly drives the Geometry Approximation to alter the subdivision level.</p>
<p>After hiding all the properties that I didn&#8217;t want the user to see, it looks like this in Explorer:</p>
<p><img src="/userContent/anicholas/digitalAssets/tut05_03.jpg" alt="View of asset in explorer" /> </p>
<p>Note that I&#8217;ve set the Explorer view to show &#8220;Local Properties&#8221; so that we don&#8217;t see any inherited properties that would otherwise appear there in italics.</p>
<p>To hide the various properties that I didn&#8217;t want to see, I used a simple script that can be run from &#8220;<em>Model->Get Property->Digital Asset Tools->Pick Objects to Not Inspect</em>&#8220;. You can download this script below. When you run the tool, you pick items in Explorer that you want to hide with the left mouse button. Right click to finish and see them disappear. Note that I haven&#8217;t supplied a tool to make things re-appear again, so make sure you know what you&#8217;re doing!</p>
<p>Okay, so this all seems great. However there are a few gotchas that you have to be aware of:</p>
<ul>
<li>Once you&#8217;ve hidden something, you&#8217;ll have to use scripting to get it back again. There&#8217;s no other way.</li>
<li>Don&#8217;t try to hide shared properties (e.g. ambient, the Scene_Root&#8217;s material, etc.) as it will hide all instances of that property. For example, if you hide the shared ambient property, you&#8217;ll find that the &#8220;Ambient&#8221; button in the Render toolbar won&#8217;t show the PPG to let you edit it.</li>
<li>Only hide an actual object when you&#8217;re certain it&#8217;s not needed. In my example, if the user selects the Apple mesh and presses H, they can always unhide it by selecting it in Explorer and pressing H again. If you&#8217;ve hidden the actual object from the Explorer too, then the only way to get it back is to use the &#8220;Unhide All Objects&#8221; from the Display menu.</li>
<li>Hiding individual parameters can be great for hiding them from editors such as the graph editor. <strong>BUT</strong>, be very aware that you&#8217;ll no longer be able to access that parameter from scripting using many of the conventional methods. <strong>This may well break numerous common operations in XSI, so make sure you research the implications of what you&#8217;re doing. You have been warned!</strong><br />
<em>(In fact, you can still access the parameter to unhide it again, but you have to do it by pushing it&#8217;s name into the Items property of an XSICollection)</em></li>
<li>Duplicating the DigitalAsset model with Ctrl-D will lose any expressions that you&#8217;ve set up, unless you&#8217;ve enabled &#8220;Copy Animation&#8221; in the Duplicate Options. This can cripple your Digital Asset if it relies on expressions to do some of the work.</li>
</ul>
<p>The most important thing to note, is that (to my knowledge) this technique has not been production tested inside XSI yet. This is a fairly non-standard way of working in XSI, and it isn&#8217;t something that Softimage would be expecting you to do. Hence there may be other gotchas that I&#8217;ve not found yet that could invalidate this way of working. </p>
<p>Having said that, it&#8217;s definitely a cool technique, and I hope that this or a similar type of workflow will be acknowledged or supported by XSI in the future.</p>
<p>I&#8217;ve uploaded the asset as an XSI 5.0 model (both the unhidden and the final versions of the asset), as well as the script for making your objects and properties hidden. To install it, you need to copy the script to your user/application/plugins folder.</p>
<p><a href="http://www.softimageblog.com/userContent/anicholas/digitalAssets/DigitalAsset.zip" title="DigitalAsset.zip">DigitalAsset.zip</a> </p>
<p><em>(Disclaimer: I&#8217;ve given fair warning during this article about the dangers of hiding things, so I accept no responsibility for any losses you may incur! Please take care.)</em></p>
<img src="http://www.softimageblog.com/?ak_action=api_record_view&id=100&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.softimageblog.com/archives/100/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Prototyping a simple feather simulator</title>
		<link>http://www.softimageblog.com/archives/33</link>
		<comments>http://www.softimageblog.com/archives/33#comments</comments>
		<pubDate>Sun, 24 Jul 2005 03:40:05 +0000</pubDate>
		<dc:creator>Andrea Interguglielmi</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Rigging]]></category>

		<guid isPermaLink="false">http://www.xsi-blog.com/?p=33</guid>
		<description><![CDATA[With a minimum of scripting and math knowledge, it is possible to solve big problems just using our imagination (and asking Google for the right things). The first important step is to dissect our big problem into smaller ones, which will not lead to our half-artistic brain crashing. By following this rule, even a big [...]]]></description>
			<content:encoded><![CDATA[<p>With a minimum of scripting and math knowledge, it is possible to solve big problems just using our imagination (and asking Google for the right things).</p>
<p>The first important step is to dissect our big problem into smaller ones, which will not lead to our half-artistic brain crashing. By following this rule, even a big thing such as a feather simulator can be prototyped without a degree in computer science.</p>
<p>This article is not a tutorial nor is it done to teach how to make the definitive simulator. It will just show a starting point for prototyping a small feather system and, hopefully, it will offer a good topic for discussing alternative solutions and approaches.</p>
<p>With that being said, lets start with our problem to solve: how to cover a mesh with feathers.</p>
<p><span id="more-33"></span><strong>Feather instantiation</strong></p>
<p>When I made my prototype I had in my mind one clear thing, it would be so simple to instantiate the feathers on a nurbs surface, it would be just a matter of offsetting each feather along U and V, XSI would then do the rest finding the XYZ cords of a UV point on the surface.</p>
<pre>//Pseudo-code
function InstantiateFeathers()
{
    U_steps = 1/N1;
    V_steps = 1/N2;

    for(u = 0; u &amp;lt; N1; u += U_step)
    {
        for(v = 0; v &amp;lt; N2; v += V_step)
        {
            position_vector = GetXYZFromUV(u,v);
            CreateFeatherAt(position_vector);
        }
    }
}</pre>
<p>However, most of the time, the object to be covered is a polygon mesh, so the situation is a bit more complicated, we have to recreate the UV space somehow.</p>
<p>A solution could be to group polygons in rectangular clusters and automatically generate an unwrapped UV map for each cluster.</p>
<p><img src="/userContent/ainterguglielmi/feathers_images/BirdUV.jpg" width="432" height="288" /></p>
<p>By doing this it is possible to treat a poly mesh as a parametric surface, but we cannot rely anymore on XSI&#8217;s internal UV-to-XYZ function, we have to make our own.</p>
<p>This function will use two edges of a polygon to define a local cords system XY, once a point is located in the polygon&#8217;s local UV it is just a matter of tracing the same vector in XY space, maybe the image bellow explains it better.</p>
<p><img src="/userContent/ainterguglielmi/feathers_images/UV_XY.jpg" width="432" height="288"/></p>
<p>Now that a way to cover meshes with feathers has been found, it&#8217;s time to think about how those feathers are going to be oriented along the mesh, the UV approach came really handy in the development of our next step.</p>
<p><strong>Feather orientation</strong></p>
<p>If the goal is to orient many objects with the minimum amount of work for the final user, then a solution is to control those objects with a small number of sub-controls.</p>
<p>The orientation and the scale of each feather is in fact the result of the interpolation between several control objects, lets call them &#8220;control-feathers&#8221;, with just a few of them it is possible to orient thousands of elements, even over time which means animated feathers!</p>
<p><img src="/userContent/ainterguglielmi/feathers_images/ControlObjects.jpg" width="432" height="288"/></p>
<p>Such an interpolation is based on the distance of a feather to its control-feathers, the nearer a feather is to its control the more alike is the feather&#8217;s orientation.</p>
<p>The unwrapped UV space used for instancing feathers along the mesh is perfect for calculating the distance between two points, even if the surface is curved as a cylinder, that in the case of a bird is pretty much a good approximation of our target mesh.</p>
<p><img src="/userContent/ainterguglielmi/feathers_images/Distance_UV.jpg" width="432" height="288"/></p>
<p>This system was used in production with great results, but the concept of separated polygon groups gave many problems.</p>
<p>It was time expensive to set up a mesh for hosting feathers, each cluster had its own control-feather set and it was quite difficult to maintain continuity along the seams, so as it often happens, once you&#8217;ve done the job, you find a better way to do it.</p>
<p><strong>An alternative approach.</strong></p>
<p>It is possible to get rid of the UV approach by sacrificing just a bit of control over the feathers&#8217; distribution and bit of precision for the distance calculation between feathers and control-feathers.</p>
<p>In short, the instantiation process would be done on a per-polygon basis by virtually subdividing each polygon for a user defined N number of times, a weight map could scale in proportion this N value to give better control over the density.</p>
<p><img src="/ainterguglielmi/feathers_images/PolySubdi.jpg" width="432" height="288"/></p>
<p>To calculate the distance of a feather to its control-feathers we have to get rid of those controls that are too far and on the opposite side of the mesh.</p>
<p>For each feather we have to find the distance to each control-feather and set a tolerance range so that only those controls inside that range will be used for the interpolation, but still those controls on the opposite side of the mesh could be inside our tolerance range, so to get rid of them we have to play a bit around with the dot product and see what&#8217;s the angle between the feather and the controls, at this point we can interpolate even without the UV space being sure that only the right controls are going to be used.</p>
<p><img src="/userContent/ainterguglielmi/feathers_images/Final.jpg" width="432" height="288"/></p>
<p>Download the <a href="http://www.softimageblog.com/userContent/ainterguglielmi/feathers_images/testfeather.mov">Test movie</a>.<br />
Download some <a href="http://www.softimageblog.com/userContent/ainterguglielmi/feathers_images/trickyAndDucks.zip">shots</a> from the short movie &#8220;Tricky &#038; Ducks&#8221;.</p>
<p>I&#8217;d like to thank Paolo Martella and Daniele Niero, who worked with me to develop this system.<br />
Bird model by Daniele Niero.</p>
<img src="http://www.softimageblog.com/?ak_action=api_record_view&id=33&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.softimageblog.com/archives/33/feed</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>XSI as a compiler!</title>
		<link>http://www.softimageblog.com/archives/29</link>
		<comments>http://www.softimageblog.com/archives/29#comments</comments>
		<pubDate>Wed, 15 Jun 2005 14:52:15 +0000</pubDate>
		<dc:creator>Andrea Interguglielmi</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[JScript]]></category>
		<category><![CDATA[Rigging]]></category>

		<guid isPermaLink="false">http://www.xsi-blog.com/?p=29</guid>
		<description><![CDATA[Usually the common behavior for a character TD is to create rigs in a visual way: pressing buttons, dragging and dropping relationships and so on. Unfortunately this is the most diffused way to approach character rigging, it leads to a few issues and surprisingly, it could be the wrong way to go. Once a character [...]]]></description>
			<content:encoded><![CDATA[<p>Usually the common behavior for a character TD is to create rigs in a visual way: pressing buttons, dragging and dropping relationships and so on. Unfortunately this is the most diffused way to approach character rigging, it leads to a few issues and surprisingly, it could be the wrong way to go.</p>
<p>Once a character rig is complete it&#8217;s very difficult, if not sometimes impossible, to modify it without wasting a lot of time. What if we missed one bone in the middle of the hierarchy, or if we discovered that our rig&#8217;s proportions were wrong. The case is even worse if the rig we have to fix is made by another person, that huge amount of data organized in a hierarchy is going to be a puzzle, impossible to read and understand.</p>
<p>If a rig is made by a sequential series of instructions sent to the 3d application, which is what happens when making a character just using the graphical interface, we loose the history of what buttons we pressed. In other words, we loose the source code of our work. Saving the content of the log window is not the solution, we would end up with a mess of commands that don&#8221;t really describe what our character looks like, it would be just a long linear list of actions.</p>
<p><span id="more-29"></span>For example:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">Create2DSkeleton<span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span><span style="color: #CC0000;">3.758</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">0.310</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0.107</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1.72</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">90</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">4</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
SetValue<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;eff.kine.local.cnspos&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
SetValue<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;eff.kine.local.cnsori&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
ParentObj<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;bone&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;eff&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
AppendBone<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;eff&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">3.78</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">0.167</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
ParentObj<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;bone1&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;eff&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Would you say that this is an arm?</p>
<p><strong>A rig as a piece of software.</strong></p>
<p>The new generation of scripting languages like JScript, Python or VBscript offer almost all the structures to model our code as other lower level languages as c++ do. Those languages are object oriented, it means that instead of having our code as a sequence of actions, we can model objects to describe the reality in complex structures still easy to be read.</p>
<p>So, how can an object oriented language helps in defining a rig?<br />
Here is an example:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> Arm<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #006600; font-style: italic;">//Public Properties:</span>
    <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #000066;">Name</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;arm&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">ShoulderPosition</span> <span style="color: #339933;">=</span> XSIMath.<span style="color: #660066;">CreateVector3</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">ElbowPosition</span> <span style="color: #339933;">=</span> XSIMath.<span style="color: #660066;">CreateVector3</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">HandPosition</span> <span style="color: #339933;">=</span> XSIMath.<span style="color: #660066;">CreateVector3</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">//Private Properties:</span>
    <span style="color: #003366; font-weight: bold;">var</span> armComplete<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">//Public Methods:</span>
    <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">Create</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> armChain <span style="color: #339933;">=</span> ActiveSceneRoot.<span style="color: #660066;">Add2dChain</span><span style="color: #009900;">&#40;</span>
                            <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">ShoulderPosition</span><span style="color: #339933;">,</span>
                            <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">ElbowPosition</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        armChain.<span style="color: #660066;">AddBone</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">HandPosition</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        armIsComplete <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">SayHello</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>armComplete <span style="color: #339933;">==</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            LogMessage<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Hello, I''m &quot;</span> <span style="color: #339933;">+</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #000066;">Name</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>This is a JScript object, the equivalent of a class, it is describing our arm using properties to collect the data we need and methods to take care of how this data is used.<br />
Now let&#8217;s create an instance of this arm in scene:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> myArm <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Arm<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
myArm.<span style="color: #000066;">Name</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;HelloArm&quot;</span><span style="color: #339933;">;</span>
myArm.<span style="color: #660066;">ShoulderPosition</span>.<span style="color: #660066;">Set</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
myArm.<span style="color: #660066;">ElbowPosition</span>.<span style="color: #660066;">Set</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">3</span><span style="color: #339933;">,</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,-</span><span style="color: #CC0000;">0.5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
myArm.<span style="color: #660066;">HandPosition</span>.<span style="color: #660066;">Set</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">6</span><span style="color: #339933;">,</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
myArm.<span style="color: #660066;">Create</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
myArm.<span style="color: #660066;">SayHello</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Here we are, we&#8217;ve got our HelloArm which is an instance of an Arm object, proceeding in this way we could create a leg object, a spine object and then use all these objects from a human object.</p>
<p>After the first rig will be coded it will be really easy to make new creatures, modify our base human object and treat all those files as shared libraries that everyone can use and flex to the production needs. In such a workflow a character rig is nothing more than a piece of software and XSI is our compiler.</p>
<img src="http://www.softimageblog.com/?ak_action=api_record_view&id=29&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.softimageblog.com/archives/29/feed</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
	</channel>
</rss>

