<?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; Behavior</title>
	<atom:link href="http://www.softimageblog.com/archives/category/simulation/behavior/feed" rel="self" type="application/rss+xml" />
	<link>http://www.softimageblog.com</link>
	<description>People and thoughts behind Softimage in production...</description>
	<lastBuildDate>Mon, 21 Jun 2010 20:40:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Behavior Table Properties and Caching</title>
		<link>http://www.softimageblog.com/archives/73#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=behavior-table-properties-and-caching</link>
		<comments>http://www.softimageblog.com/archives/73#comments</comments>
		<pubDate>Fri, 09 Dec 2005 21:40:13 +0000</pubDate>
		<dc:creator>Patrick Boucher</dc:creator>
				<category><![CDATA[Behavior]]></category>

		<guid isPermaLink="false">http://www.xsi-blog.com/?p=73</guid>
		<description><![CDATA[The Piccolo language has this neat little function called <em>AddPropertyTable</em> which you can call on pretty much any object. This attaches a table of userdefined properties on the object that you can then fill with whatever you wish. This table of course goes whereever the object goes and is accessible through dot notation.

I use this profusely, especially with my actors. This way I can tack on actor characteristics (i.e.: agression level, strength, sight distance, etc) and refer to these characteristics later in the code.]]></description>
			<content:encoded><![CDATA[<p>The Piccolo language has this neat little function called <em>AddPropertyTable</em> which you can call on pretty much any object. This attaches a table of userdefined properties on the object that you can then fill with whatever you wish. This table of course goes whereever the object goes and is accessible through dot notation.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> world <span style="color: #339933;">=</span> engine.<span style="color: #660066;">GetCurrentWorld</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
world.<span style="color: #660066;">AddPropertyTable</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
world.<span style="color: #660066;">ChanceOfRainInWorld</span> <span style="color: #339933;">=</span> <span style="color: #CC0000;">0.8</span><span style="color: #339933;">;</span>
Console.<span style="color: #660066;">PrintNl</span><span style="color: #009900;">&#40;</span>world.<span style="color: #660066;">ChanceOfRainInWorld</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>I use this profusely, especially with my actors. This way I can tack on actor characteristics (i.e.: agression level, strength, sight distance, etc) and refer to these characteristics later in the code.</p>
<p><strong>Actor Caching</strong></p>
<p>Once you&#8217;ve distributed your actors in the world and you&#8217;ve given them characteristics you may need to save these characteristics for future simulations. I built a little helper file that contains two functions to save and retrieve an <em>actor cache</em>. You can then, in your Piccolo startup, load a world with only your environment, and load your actors from this cache that will recreate the property table as it was when you saved the cache. Right now the code only supports saving and retrieving String, Integer and Float values because that&#8217;s what I needed. If you build on this code and add types, I&#8217;d appreciate your contributing back to the community.</p>
<p>The other benefit of this is that you can create your population distribution in XSI along with your actor characteristics, output an actor cache that can then be read back into Behavior as the initial state of your simulation.</p>
<p><strong>Motion Caching</strong></p>
<p>There are also two functions to do home-brewed motion caching. The same kind of thing Behavior does with DrvMotion. The only advantage is that it takes the black out of black-box and you know how the cache is built and what the file format is. It&#8217;s more of a Behavior/Piccolo exercise than anything else. It is definitely slower than DrvMotion because it is pure Piccolo.</p>
<p>You can download an <a href="/userContent/patrickb/behavior/PB_MotionCache.zip">example project</a> (Behavior 2.1) and check out the code.<br />
Any comments would be very welcome!</p>
<img src="http://www.softimageblog.com/?ak_action=api_record_view&id=73&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.softimageblog.com/archives/73/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Render Passes in Behavior</title>
		<link>http://www.softimageblog.com/archives/71#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=render-passes-in-behavior</link>
		<comments>http://www.softimageblog.com/archives/71#comments</comments>
		<pubDate>Wed, 07 Dec 2005 01:14:12 +0000</pubDate>
		<dc:creator>Patrick Boucher</dc:creator>
				<category><![CDATA[Bablings and Ramblings]]></category>
		<category><![CDATA[Behavior]]></category>

		<guid isPermaLink="false">http://www.xsi-blog.com/?p=71</guid>
		<description><![CDATA[I&#8217;m currently winding down on this Behavior project that has been making me loose sleep. I&#8217;m at the stage where I need to create my data for my multiple render passes&#8230;.
Warning: If you&#8217;ve never used Behavior before or don&#8217;t care for crowd sim, skip this one. If you care for a stupid Behavior trick&#8230; Read [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently winding down on this Behavior project that has been making me loose sleep. I&#8217;m at the stage where I need to create my data for my multiple render passes&#8230;.</p>
<p><strong>Warning</strong>: If you&#8217;ve never used Behavior before or don&#8217;t care for crowd sim, skip this one. If you care for a stupid Behavior trick&#8230; Read on&#8230;</p>
<p>Behavior has a rendering pipeline that involves spewing a bunch of files into a directory and rendering them out with a nifty geometry shader and Mental Ray. Thing is, you have to run a simulation for every render pass you have. This means, you don&#8217;t have a choice but to cache your actor&#8217;s motion data in a first pass and then simulate all your other passes using the cache to output your .mi2 files.</p>
<p>When I did all this I wound up with characters that wouldn&#8217;t render at <em>exactly</em> the same spot from pass to pass even if I had used a caching mechanism. We&#8217;re talking pixels here but it was enough to show&#8230;</p>
<p>Ever notice all those .mrd files Behavior creates along with your .mi2 files? They contain your actor positions for every frame of your simulation. To get my passes properly aligned I just copied all the .mrd files from the output directory of one simulation into the output directory of another and voila!</p>
<p>I&#8217;m wondering if this is just a cosmic fluke that should be chaulked up to planetary alignment or if it&#8217;s a legal Behavior move but&#8230; It just saved my butt!</p>
<p>Carry on!</p>
<img src="http://www.softimageblog.com/?ak_action=api_record_view&id=71&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.softimageblog.com/archives/71/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
