<?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>Dead Shift</title>
	<atom:link href="http://deadshift.com/feed" rel="self" type="application/rss+xml" />
	<link>http://deadshift.com</link>
	<description>Making something killer &#62;:]</description>
	<lastBuildDate>Mon, 14 Jun 2010 21:13:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>A Farewell to Arm Calibration</title>
		<link>http://deadshift.com/blog/a-farewell-to-arm-calibration</link>
		<comments>http://deadshift.com/blog/a-farewell-to-arm-calibration#comments</comments>
		<pubDate>Wed, 09 Jun 2010 03:09:19 +0000</pubDate>
		<dc:creator>PolyVector</dc:creator>
				<category><![CDATA[Devlog]]></category>

		<guid isPermaLink="false">http://deadshift.com/?p=342</guid>
		<description><![CDATA[Designing a heroine, and throwing out miles of animation code in favor of something that's clean and simple.]]></description>
			<content:encoded><![CDATA[<div id="attachment_343" class="wp-caption alignnone" style="width: 510px"><a href="/wp-content/uploads/2010/06/Dead-Shift-2010-06-08-18-26-30-08.png" rel="shadowbox[post-342];player=img;"><img class="size-medium  wp-image-343  " title="Happy Birthday, Miri" src="/wp-content/uploads/2010/06/Dead-Shift-2010-06-08-18-26-30-08-500x281.png" alt="" width="500" height="281" /></a><p class="wp-caption-text">Happy Birthday, Miri</p></div>
<p><span id="more-342"></span></p>
<p>About a week ago we finished designing <strong>Miri</strong>, the lead character in Dead Shift!&#8230; Now if that isn&#8217;t a milestone, I don&#8217;t know what is.  So to mark this momentous occasion, I decided to fix our long-broken animation pipeline&#8230;  Just look at that face, she deserves a new animation system, right?</p>
<p>Dead Shift has used BVH (<a href="http://en.wikipedia.org/wiki/Biovision_Hierarchy">Biovision Hierarchy</a>) motion capture files to animate characters since last summer <em>(Note to self: Finish this fucking game already!)</em>&#8230; While the captures themselves were nice, the outcome was less-than-stellar, and sometimes downright weird.  This was due to the complex nature of 3D animation and a little thorn in my side called Calibration: A process of joining the character and animation to an initial &#8220;Bind Pose&#8221; to ensure everyone&#8217;s on the same page.  This process is easy to accomplish in proper animation software such as <a href="http://www.animeeple.com/">Animeeple</a>, but a nightmare to work out in kludgy XML files!</p>
<p>So I thought &#8220;screw it&#8221;, and deleted my entire BVH processor, my custom XML processors to calibrate and tweak animations/skeletons&#8230; even my most basic BoneContent processors, animation smoothers&#8230; EVERYTHING involving animation in the pipeline was scrapped&#8230;  I decided that I wanted all animations to be processed in a simple fixed-FPS manor instead of the crazy per-bone keyframe stuff XNA supports, so I wrote an all new set of &#8220;SimpleAnimation&#8221; classes.  These classes define animations as a list of keyframes represented by arrays of quaternion rotations and root offsets, and they can easily read from Animeeple&#8217;s custom XML format.  Here are some benefits of the new system:</p>
<ul>
<li>No Calibration!  Animeeple has already calibrated the animation to  the model I&#8217;m working with, so I can just blindly copy the data <img src='http://deadshift.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </li>
<li>Looks Great!  Properly calibrated animations have a wonderful quality to them&#8230; (as the next progress video will eventually show)</li>
<li>Clean! Roughly 1/4th the code and complexity of the previous implementation.</li>
<li>Predictable! We know that each frame contains information for all bones, which makes my life much easier!</li>
<li>Features:  Because keyframes are so easy to deal with, I&#8217;ve already added things like Automatic Loop Correction, Resampling, Motion Tracking, Triggers/Markers as hints for character logic.</li>
<li>New animation formats should be easy to support, but for now I&#8217;m sticking with Animeeple XML. <img src='http://deadshift.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </li>
</ul>
<p>Downsides?:</p>
<ul>
<li>Models must be loadable by Animeeple, and my new zombie models aren&#8217;t&#8230; So I do need to find a nice way to convert and clean them up before they can go back into the game&#8230;</li>
</ul>
<p>Please direct any questions and comments to Miri:</p>
<div id="attachment_345" class="wp-caption alignnone" style="width: 510px"><a href="/wp-content/uploads/2010/06/Dead-Shift-2010-06-08-19-51-38-25.png" rel="shadowbox[post-342];player=img;"><img class="size-medium wp-image-345" title="Happy Hunting" src="/wp-content/uploads/2010/06/Dead-Shift-2010-06-08-19-51-38-25-500x281.png" alt="Happy Hunting" width="500" height="281" /></a><p class="wp-caption-text">Happy Hunting</p></div>
]]></content:encoded>
			<wfw:commentRss>http://deadshift.com/blog/a-farewell-to-arm-calibration/feed</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Gila Bend Video</title>
		<link>http://deadshift.com/blog/gila-bend-video</link>
		<comments>http://deadshift.com/blog/gila-bend-video#comments</comments>
		<pubDate>Sun, 23 May 2010 01:31:24 +0000</pubDate>
		<dc:creator>PolyVector</dc:creator>
				<category><![CDATA[Devlog]]></category>

		<guid isPermaLink="false">http://deadshift.com/?p=329</guid>
		<description><![CDATA[A new HD video showing off the Windows version I'm working on... New zombies, vehicles, graphics, and awesomeness. :)]]></description>
			<content:encoded><![CDATA[
	<script type="text/javascript">
		var flashvars = {};
		flashvars.playOnStart = "false";
		flashvars.startVolume = "70";
		flashvars.autoHideOther = "false";
		flashvars.autoHideVideoControls = "false";
		flashvars.onStartShowControls = "true";
		flashvars.fullVideoScale = "true";
		flashvars.showPlayButton = "true";
		flashvars.share = "false";
		flashvars.MediaLink2 = "http://www.youtube.com/watch?v=E2Rvbit6OJQ";
		flashvars.image = "http://deadshift.com/wp-content/plugins/youtube-with-style/lib/img.php?v=E2Rvbit6OJQ";
		var params = {};
		params.bgcolor = "#000000";
		params.allowfullscreen = "true";
		params.wmode = "opaque";
		var attributes = {};
		attributes.id = "myplayer";
		swfobject.embedSWF("http://deadshift.com/wp-content/plugins/youtube-with-style/lib/player.swf", "myAlternativeContent", "500", "312", "9.0.0", false, flashvars, params, attributes);
	</script> <div id="myAlternativeContent">	<object width="500" height="306"><param name="movie" value="http://www.youtube.com/v/E2Rvbit6OJQ&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/E2Rvbit6OJQ&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="500" height="306"></embed></object></div>
]]></content:encoded>
			<wfw:commentRss>http://deadshift.com/blog/gila-bend-video/feed</wfw:commentRss>
		<slash:comments>30</slash:comments>
		</item>
		<item>
		<title>Making Sketchup Your Bitch</title>
		<link>http://deadshift.com/blog/making-sketchup-your-bitch</link>
		<comments>http://deadshift.com/blog/making-sketchup-your-bitch#comments</comments>
		<pubDate>Sun, 25 Apr 2010 21:07:49 +0000</pubDate>
		<dc:creator>PolyVector</dc:creator>
				<category><![CDATA[Devlog]]></category>

		<guid isPermaLink="false">http://deadshift.com/?p=269</guid>
		<description><![CDATA[Some things I've learned on my quest to design levels myself in Sketchup...]]></description>
			<content:encoded><![CDATA[<div id="attachment_276" class="wp-caption alignnone" style="width: 510px"><a href="/wp-content/uploads/2010/04/Capture1.png" rel="shadowbox[post-269];player=img;"><img class="size-medium wp-image-276" title="Capture" src="/wp-content/uploads/2010/04/Capture1-500x281.png" alt="" width="500" height="281" /></a><p class="wp-caption-text">Ever wonder what&#39;s inside that freakish building?</p></div>
<p><span id="more-269"></span>There are a lot of people on both sides of the fence regarding Sketchup as a game development tool.  There are those who tout its ease-of-use, and those who hate the wasteful triangulation that gets performed at all contact points/lines/etc.  I recently decided to design my own levels for Dead Shift, and only rely on purchased assets for items, characters, and filler.  I chose to use Sketchup for this purpose because it&#8217;s the <em>only</em> 3D modeler my coder brain can comprehend.  There have been some caveats, so I&#8217;m going to share a few hacks and work-arounds for other developers in the same situation.</p>
<p><strong>Problem: Triangluation</strong><br />
Sketchup&#8217;s Triangulation of the mesh generates many unwanted polygons.  This can easily slow down rendering and kill the performance of collision detection routines.  This happens because Sketchup considers every point on a plane important, even if the points are simply another object touching a wall.  A common worst-case scenario is extruded text placed on a wall, this will generate so many unwanted polys that it&#8217;s almost funny!</p>
<p><strong>Solution:</strong><br />
When you have objects touching, try moving them 1cm towards each other (causing slight interpenetration), or 1cm away from each other (for a slight gap) if you prefer.  As long as the points/lines are no longer perfectly coplanar, they won&#8217;t affect the polycount!  I&#8217;ve reduced the polycount on a test level by 1,000 only expanding the walls slightly.  It&#8217;s a great technique, and allows you to create much more detail with fewer polygons! <img src='http://deadshift.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>Problem: Materials</strong><br />
Sketchup only supports a simple Diffuse texture, and that&#8217;s about it.</p>
<p><strong>Solution:</strong><br />
Write a content pipeline extension (or something equivalent if not using XNA) that will parse an XML file and apply custom material info based on the exported material name.  Here&#8217;s a rough example:</p>
<p>Exported Material Name: &#8220;Bricks001&#8243;<br />
XML Example Excerpt:<br />
&lt;Material&gt;Bricks001&lt;/Material&gt;<br />
&lt;NormalMap&gt;Path/To/BrickNormals.png&lt;/NormalMap&gt;<br />
&lt;SpecularPower&gt;0.25&lt;/SpecularPower&gt;</p>
<p><strong>Problem: Entity Placement</strong></p>
<p>There isn&#8217;t a good way to place entities without writing custom importer/exporter scripts.<strong><br />
</strong></p>
<p><strong>Solution:</strong></p>
<p>Create a material with a name such as: &#8220;Entity_MachineGun&#8221;.  Create a single-polygon component using this material that points downward.  From your pipeline extension, you can use the bottom vertex of each polygon as a placement position.  You could use other shapes, but I feel the triangle is easiest to deal with.  Note: Sketchup has a nifty little feature to have components always face the camera. <img src='http://deadshift.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>Problem: Collision Meshes</strong><br />
Sketchup doesn&#8217;t provide a nice way of managing collision meshes.</p>
<p><strong>Solution:</strong><br />
Create a new Material named &#8220;CollisionOnly&#8221;, and make it a bright transparent color (to stand out).  Make sure your game is aware that anything using this material should never be drawn (using your pipeline extension, or whatever method you please).  When you want a complex shape to have a simpler collision mesh, simply create a bounding mesh using the &#8220;CollisionOnly&#8221; material, and make sure the visible shape&#8217;s material has collision disabled.</p>
<div id="attachment_272" class="wp-caption alignnone" style="width: 510px"><a href="/wp-content/uploads/2010/04/Screen-shot-2010-04-25-at-1.08.56-PM.png" rel="shadowbox[post-269];player=img;"><img class="size-medium wp-image-272" title="Screen shot 2010-04-25 at 1.08.56 PM" src="/wp-content/uploads/2010/04/Screen-shot-2010-04-25-at-1.08.56-PM-500x412.png" alt="" width="500" height="412" /></a><p class="wp-caption-text">Simple collision mesh</p></div>
<p>Note:  If you place all collision shapes on a &#8220;Collision&#8221; Layer, it&#8217;s easy to show/hide your collision mesh while editing the level!  Make sure you follow the &#8220;Triangulation&#8221; tip to ensure the collision mesh doesn&#8217;t generate unwanted polygons&#8230; or it defeats the purpose!</p>
<p><strong>Misc Tips:</strong></p>
<ul>
<li>Always &#8220;Explode&#8221; your level before exporting.  I use the freely available BombAll.py script to automatically explode everything.</li>
</ul>
<p><strong>Todo:</strong></p>
<ul>
<li>Decals might work nicely with Sketchup by using custom materials&#8230; hrmmm <img src='http://deadshift.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
</ul>
<p>Well, I&#8217;m running low on caffeine and should probably be getting back to work&#8230; That&#8217;s all for now, folks! <img src='http://deadshift.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://deadshift.com/blog/making-sketchup-your-bitch/feed</wfw:commentRss>
		<slash:comments>44</slash:comments>
		</item>
		<item>
		<title>Welcome to the Motel Arizona</title>
		<link>http://deadshift.com/blog/welcome-to-the-motel-arizona</link>
		<comments>http://deadshift.com/blog/welcome-to-the-motel-arizona#comments</comments>
		<pubDate>Tue, 20 Apr 2010 14:28:45 +0000</pubDate>
		<dc:creator>PolyVector</dc:creator>
				<category><![CDATA[Devlog]]></category>

		<guid isPermaLink="false">http://deadshift.com/?p=243</guid>
		<description><![CDATA[Deciding on the game's location, and struggling to get things in order for a Windows Version! :)]]></description>
			<content:encoded><![CDATA[<div id="attachment_247" class="wp-caption alignnone" style="width: 510px"><a href="/wp-content/uploads/2010/04/Capture.png" rel="shadowbox[post-243];player=img;"><img class="size-medium wp-image-247 " title="Motel Arizona" src="/wp-content/uploads/2010/04/Capture-500x281.png" alt="" width="500" height="281" /></a><p class="wp-caption-text">Good artists copy, I use Google Image Search</p></div><br />
<span id="more-243"></span>In the last couple weeks I&#8217;ve moved my entire development environment over to a new 27&#8243; iMac running Windows 7 x64.  My old setup was running in VMWare Fusion on a 20&#8243; iMac, but this didn&#8217;t allow for the game to run in Windows, only the Xbox360.  The migration turned out to be more painful than a horde of zombies&#8230; I had issues <a href="http://synergy2.sourceforge.net/">Synergy</a>-ing the 20&#8243; and 27&#8243; Macs together, then issues with .NET &#8220;security&#8221; not liking my code being on a networked drive, then issues with my Xbox chatpad lacking Windows drivers (unfixable), then sporadic issues with XNA&#8217;s HLSL Compiler locking up and taking Visual Studio down with it!  After a couple of days working countless issues out, I was finally able to get started porting Dead Shift to Windows, and that&#8217;s where the real fun began.</p>
<p>It took me an embarrassing amount of time and sanity to track down a bug that was causing every polygon in the game to explode, preventing me from working on anything else&#8230;  Apparently, on my Mac&#8217;s GPU at least, the POSITION1 semantic overwrites/conflicts/kills/destroys/violates the POSITION0 semantic, and I was happily using both&#8230;  *grumbles*</p>
<p>Anyways!&#8230;</p>
<p>In the tradition of <a href="http://en.wikipedia.org/wiki/Body_Harvest">Body Harvest</a>, I&#8217;m foolishly designing Dead Shift as I go with no real plan.  Recently, Skunkie and I tried to work out the best possible location for the game based on the following criteria:</p>
<ol>
<li>It must be a town that I&#8217;m capable of designing in Sketchup, which means simple architecture</li>
<li>It must convey a sense of isolation, atmosphere, fallen civilization, etc, and work well with wide cinematic camera angles</li>
<li>It must feel like a real place, despite being rather empty (due to my lack of artistic abilities).</li>
<li>It must be hard to escape on foot in real life&#8230; Muhahaha!</li>
</ol>
<p><div id="attachment_257" class="wp-caption alignnone" style="width: 510px"><a href="/wp-content/uploads/2010/04/Screen-shot-2010-04-20-at-7.20.19-AM.png" rel="shadowbox[post-243];player=img;"><img class="size-medium wp-image-257" title="Sketchup Goodness" src="/wp-content/uploads/2010/04/Screen-shot-2010-04-20-at-7.20.19-AM-500x297.png" alt="" width="500" height="297" /></a><p class="wp-caption-text">Amazing how much Dead Shift&#39;s renderer improves this crap. <img src='http://deadshift.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p></div>
<p>The answer was a place we have driven through more times than I can count&#8230; A little town called <a href="http://www.flickr.com/search/?q=gila+bend&amp;s=int">Gila Bend</a> (<a href="http://en.wikipedia.org/wiki/Gila_Bend,_Arizona">wiki</a>),  located in the middle of an Arizona desert, about hour or so from the Mexican border.  There are cheesy signs, buildings, and sculptures sprinkled amongst the derelict buildings, motels, and gas stations.  I can&#8217;t imagine a more perfect location for a zombie outbreak, and you gotta love that <a href="http://arizona-photos.com/images/gila-bend-arizona.jpg" rel="shadowbox[post-243];player=img;">welcome sign</a>.  I&#8217;m not going to recreate the actual town, but I will be using it as a source inspiration. <img src='http://deadshift.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://deadshift.com/blog/welcome-to-the-motel-arizona/feed</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Undead and Kicking</title>
		<link>http://deadshift.com/blog/undead-and-kicking</link>
		<comments>http://deadshift.com/blog/undead-and-kicking#comments</comments>
		<pubDate>Wed, 10 Mar 2010 16:04:54 +0000</pubDate>
		<dc:creator>PolyVector</dc:creator>
				<category><![CDATA[Devlog]]></category>

		<guid isPermaLink="false">http://deadshift.com/?p=227</guid>
		<description><![CDATA[Stabbing "Real Life" in the face, and getting some bloody work done.]]></description>
			<content:encoded><![CDATA[<div id="attachment_230" class="wp-caption alignnone" style="width: 510px"><a href="/wp-content/uploads/2010/03/ParallaxOcclusionMapping.png" rel="shadowbox[post-227];player=img;"><img class="size-medium wp-image-230" title="ParallaxOcclusionMapping" src="/wp-content/uploads/2010/03/ParallaxOcclusionMapping-500x281.png" alt="" width="500" height="281" /></a><p class="wp-caption-text">With and Without Parallax Occlusion Mapping</p></div>
<p><span id="more-227"></span>Few things have the ability to slow the unstoppable juggernaut that is Dead Shift development&#8230; One of them is Prancer, our 17yr old Chihuahua, needing constant medical attention and trips to the vet/cardiologist&#8230; The other is a main sewer line backing up INTO OUR APARTMENT, flooding it with raw sewage, and forcing us to move into my parents&#8217; living room while the poo is cleaned up&#8230;</p>
<p>So now that those figurative and literal shit-storms are over, I have gotten some work done, and things are starting to get back to normal.  However, we have made some changes in the direction of Dead Shift&#8230; *Drum Roll*</p>
<ul>
<li>Perfecting/optimizing SSAO has been taking far too long&#8230; so I&#8217;m dropping SSAO for the time being, and adding simple horizon-based ambient lighting.</li>
<li>Acquiring decent level models has proven impossible&#8230; so I&#8217;m going to be designing the level myself using Google SketchUp because it&#8217;s simple and works well for architecture.</li>
<li>Parallax Occlusion Mapping has been added to the engine to make it easier for me, a non-artist, to add perceived detail.</li>
<li>The scope is going to be limited&#8230; I&#8217;m not sure exactly what that&#8217;ll entail yet, but I need to start being a bit more realistic if I&#8217;m going to finish anything.</li>
</ul>
<p>So there you have it, now back to work!</p>
<div id="attachment_235" class="wp-caption alignnone" style="width: 510px"><a href="/wp-content/uploads/2010/03/Screen-shot-2010-03-10-at-7.54.25-AM.png" rel="shadowbox[post-227];player=img;"><img class="size-medium wp-image-235" title="Learning Sketchup" src="/wp-content/uploads/2010/03/Screen-shot-2010-03-10-at-7.54.25-AM-500x361.png" alt="" width="500" height="361" /></a><p class="wp-caption-text">Learning SketchUp... Go ahead, laugh. <img src='http://deadshift.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p></div>
]]></content:encoded>
			<wfw:commentRss>http://deadshift.com/blog/undead-and-kicking/feed</wfw:commentRss>
		<slash:comments>38</slash:comments>
		</item>
		<item>
		<title>Enhanced Crowd Rendering</title>
		<link>http://deadshift.com/blog/enhanced-crowd-rendering</link>
		<comments>http://deadshift.com/blog/enhanced-crowd-rendering#comments</comments>
		<pubDate>Tue, 26 Jan 2010 16:27:37 +0000</pubDate>
		<dc:creator>PolyVector</dc:creator>
				<category><![CDATA[Devlog]]></category>

		<guid isPermaLink="false">http://deadshift.com/?p=199</guid>
		<description><![CDATA[Designing a new technique for Skinned Mesh Instancing that supports complex animation and uses less memory.]]></description>
			<content:encoded><![CDATA[
	<script type="text/javascript">
		var flashvars = {};
		flashvars.playOnStart = "false";
		flashvars.startVolume = "70";
		flashvars.autoHideOther = "false";
		flashvars.autoHideVideoControls = "false";
		flashvars.onStartShowControls = "true";
		flashvars.fullVideoScale = "true";
		flashvars.showPlayButton = "true";
		flashvars.share = "false";
		flashvars.MediaLink2 = "http://www.youtube.com/watch?v=i88m8NqiAPw";
		flashvars.image = "http://deadshift.com/wp-content/plugins/youtube-with-style/lib/img.php?v=i88m8NqiAPw";
		var params = {};
		params.bgcolor = "#000000";
		params.allowfullscreen = "true";
		params.wmode = "opaque";
		var attributes = {};
		attributes.id = "myplayer";
		swfobject.embedSWF("http://deadshift.com/wp-content/plugins/youtube-with-style/lib/player.swf", "myAlternativeContent", "500", "312", "9.0.0", false, flashvars, params, attributes);
	</script> <div id="myAlternativeContent">	<object width="500" height="306"><param name="movie" value="http://www.youtube.com/v/i88m8NqiAPw&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/i88m8NqiAPw&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="500" height="306"></embed></object></div>
<p><span id="more-199"></span>A fundamental challenge when designing a game centered around hordes of zombies is how to render a large quantity of animated characters.  A number of solutions exist, but none of them were quite suitable for Dead Shift.  In this post I will introduce a new(?) technique I&#8217;ve developed for skinned mesh instancing (aka. crowd rendering) that addresses many of the issues with the one <a href="http://http.developer.nvidia.com/GPUGems3/gpugems3_ch02.html">proposed in GPU Gems 3</a> (<a href="http://bphelpsdev.spaces.live.com/blog/cns!602815048C7B5C20!302.entry?ccr=5964#comment">and adapted for XNA</a>), making it better suited for crowds of important characters who may require animation techniques such as motion blending.</p>
<p>To start, here is a quick overview of both techniques.</p>
<p>Original Technique:</p>
<ul>
<li>Bones are stored in absolute positions, so no blending is possible.</li>
<li>Animations must be pre-baked at 30fps or 60fps resulting in large memory/storage requirements.</li>
<li>Not suitable for rendering main characters, requiring a completely separate animation system for them!</li>
</ul>
<p>My Enhanced Technique:</p>
<ul>
<li>Bones are stored in relative positions, along with skeletal hierarchy and bind-pos data needed to blend multiple frames/animations together at run-time.</li>
<li>Animations can be pre-baked at lower framerates (15fps works nicely) which drastically lowers memory/storage requirements.</li>
<li>Animation Processing is decoupled from Rendering, allowing arbitrarily complex blending/tweening routines on the GPU and re-use of processed frames between passes (ie. shadow-depth)</li>
<li>Suitable for all characters in a game, unifying all animation into a single system.</li>
</ul>
<p>The process for my technique is as follows:</p>
<ul>
<li>Pre-bake animations as usual with the <a href="http://http.developer.nvidia.com/GPUGems3/gpugems3_ch02.html">GPU Gems 3 technique</a>; output Relative Matrices, NOT Absolute Matrices.  We&#8217;ll refer to this as the &#8220;AnimationTexture&#8221;.</li>
<li>Store the Inverse BindPos as a frame in AnimationTexture, you&#8217;ll need this at runtime.  I find it&#8217;s easy to place this at Frame 0.</li>
<li>Store the Skeletal Hierarchy in a Texture for run-time access&#8230; This can be a separate texture, or simply packed into another dummy animation frame.  The important thing here is that we&#8217;ll need our shaders to be able to look up the Parent BoneIndex for any given BoneIndex&#8230;</li>
<li>Write an &#8220;Animation Processor&#8221; shader that reads frames from AnimationTexture for each character instance and generates a new texture, we&#8217;ll call this &#8220;FinalAnimationTexture&#8221;, in the format of the original GPU Gems 3 technique. Each character will need to be assigned a RowID within this new FinalAnimationTexture to read their processed frame.  Hint: If you use Multiple Render Targets, you can spit out all 3 pixels of a bone matrix at once&#8230; This eliminates the need to process bones 3x. <img src='http://deadshift.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </li>
<li>Render Characters as usual, the only difference being that characters reference RowID in FinalAnimationTexture, instead of FrameID in AnimationTexture&#8230;</li>
<li>If bone data is required on the CPU, wait a frame and read it back.  I&#8217;ve found it far more efficient to first process all bone data we want to read back into a single texture to avoid multiple GPU to CPU transfers.</li>
</ul>
<p>The beauty of this technique lies in the &#8220;Animation Processor&#8221; shader.  Because we don&#8217;t need a World Matrix at this stage, we can easily process over 200 character animations in a single draw call.  Also, nobody says you have to use a single &#8220;Animation Processor&#8221; shader, you could write any number of shaders for different types of animation such as Inverse Kinematics.  All animation frame data simply needs to be written to FinalAnimationTexture, so perform this step however you please.</p>
<p>Now, I&#8217;m <em>far</em> too lazy to draw diagrams, write sample code, and go into extreme detail&#8230; Sorry!&#8230; Feel free to ask questions if you&#8217;re interested, and I&#8217;ll do my best to answer!  I just wanted to put this idea out there for anyone struggling with a similar problem.</p>
<p>Some useful nuggets of information:</p>
<ul>
<li>In order to perfectly sync bones between the CPU and GPU without horribly stalling the GPU, you may have to use the processed animation data from 2-3 frames back (depending on your architecture).  This means double/triple/quadruple buffering FinalAnimationTexture and using outdated animation info to ensure, for example, that a weapon stays perfectly in a character&#8217;s hand.</li>
<li>If you store your original AnimationTexture as Dual Quaternions (2 pixels per bone), it&#8217;s very easy to blend between frames/animations, and you use less memory.  The trick to interpolating dual quaternions is to compare them w/ a dot product and conditionally negate the second DualQuat to ensure blending moves in the right direction&#8230;  Interestingly, this step can be pre-computed at build time in the AnimationTexture so that any frame can be blindly lerp()&#8217;d with the following frame. *devious* <img src='http://deadshift.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://deadshift.com/blog/enhanced-crowd-rendering/feed</wfw:commentRss>
		<slash:comments>43</slash:comments>
		</item>
		<item>
		<title>Anybody Home?</title>
		<link>http://deadshift.com/blog/anybody-home</link>
		<comments>http://deadshift.com/blog/anybody-home#comments</comments>
		<pubDate>Thu, 14 Jan 2010 11:21:47 +0000</pubDate>
		<dc:creator>PolyVector</dc:creator>
				<category><![CDATA[Devlog]]></category>

		<guid isPermaLink="false">http://deadshift.com/?p=186</guid>
		<description><![CDATA[Working like crazy, trying to get a demo together in time for DBP 2010.]]></description>
			<content:encoded><![CDATA[<div id="attachment_185" class="wp-caption alignnone" style="width: 510px"><a href="/wp-content/uploads/2009/10/BloodyBat.png" rel="shadowbox[post-186];player=img;"><img class="size-medium wp-image-185" src="/wp-content/uploads/2009/10/BloodyBat-500x281.png" alt="Come out and Play" width="500" height="281" /></a><p class="wp-caption-text">Come out and play!</p></div>
<p><span id="more-186"></span>Sometimes working on a game can be actual work&#8230; scary huh?  Recently I&#8217;ve been really getting down into the guts of my engine and adding countless little features, fixing little problems, and ripping out a little more hair&#8230;  Some of the changes since I last posted are&#8230; *drum roll*</p>
<ul>
<li>Added Proper Transparency w/ shadow-casting for grass, trees, etc&#8230;</li>
<li>Fixed Depth buffer issues causing Early-Z probs, Shadow Acne, performance, etc&#8230;</li>
<li>Added a Particle System (Dust, Blood)</li>
<li>Added Vehicle Physics (something has to kick up dust!)</li>
<li>Added Weapon Sensors / Injuries (someone has to bleed!)</li>
<li>Added An Entity &#8220;messaging system&#8221; to control communication in a thread safe way&#8230; instructions like &#8220;you die now, I hit you&#8221; shouldn&#8217;t cause a race condition. <img src='http://deadshift.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
<li>Purchased a ton more models (houses, knives, machetes, guns, bats, etc, etc, etc, etc, etc, etc) and somehow my Skunkie hasn&#8217;t left me for spending money on such crap! <img src='http://deadshift.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
</ul>
<p>So what&#8217;s next?  Well, the <a href="http://dreambuildplay.com">DreamBuildPlay 2010</a> competition is coming up in less than 2 fekkin&#8217; months! I&#8217;d really like to enter this year but I don&#8217;t know how realistic that is&#8230;  I need to rework the (bloated and complex) animation system to fix the horrible looking blending and add some much needed flexibility, and I really need to put more work into the physics and collision systems&#8230; If those two major issues work out quickly I may be able to throw something together in time&#8230;  Either way, I&#8217;ll try to get a new video together one of these days for my 5 or so die-hard fans! <img src='http://deadshift.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://deadshift.com/blog/anybody-home/feed</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>A New Video</title>
		<link>http://deadshift.com/blog/a-new-video</link>
		<comments>http://deadshift.com/blog/a-new-video#comments</comments>
		<pubDate>Wed, 09 Dec 2009 20:53:12 +0000</pubDate>
		<dc:creator>PolyVector</dc:creator>
				<category><![CDATA[Devlog]]></category>

		<guid isPermaLink="false">http://deadshift.com/?p=160</guid>
		<description><![CDATA[A new video showing off improved physics, collision detection, and graphics...
Needs optimization, but looks good. :D]]></description>
			<content:encoded><![CDATA[
	<script type="text/javascript">
		var flashvars = {};
		flashvars.playOnStart = "false";
		flashvars.startVolume = "70";
		flashvars.autoHideOther = "false";
		flashvars.autoHideVideoControls = "false";
		flashvars.onStartShowControls = "true";
		flashvars.fullVideoScale = "true";
		flashvars.showPlayButton = "true";
		flashvars.share = "false";
		flashvars.MediaLink2 = "http://www.youtube.com/watch?v=pZoNyrsUYlk";
		flashvars.image = "http://deadshift.com/wp-content/plugins/youtube-with-style/lib/img.php?v=pZoNyrsUYlk";
		var params = {};
		params.bgcolor = "#000000";
		params.allowfullscreen = "true";
		params.wmode = "opaque";
		var attributes = {};
		attributes.id = "myplayer";
		swfobject.embedSWF("http://deadshift.com/wp-content/plugins/youtube-with-style/lib/player.swf", "myAlternativeContent", "500", "312", "9.0.0", false, flashvars, params, attributes);
	</script> <div id="myAlternativeContent">	<object width="500" height="306"><param name="movie" value="http://www.youtube.com/v/pZoNyrsUYlk&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/pZoNyrsUYlk&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="500" height="306"></embed></object></div>
]]></content:encoded>
			<wfw:commentRss>http://deadshift.com/blog/a-new-video/feed</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Feeling Like a Wreck</title>
		<link>http://deadshift.com/blog/feeling-like-a-wreck</link>
		<comments>http://deadshift.com/blog/feeling-like-a-wreck#comments</comments>
		<pubDate>Sat, 14 Nov 2009 00:45:28 +0000</pubDate>
		<dc:creator>PolyVector</dc:creator>
				<category><![CDATA[Devlog]]></category>

		<guid isPermaLink="false">http://deadshift.com/?p=100</guid>
		<description><![CDATA[Hunting down asset packs, and getting very little actual work done.]]></description>
			<content:encoded><![CDATA[<div id="attachment_102" class="wp-caption alignnone" style="width: 510px"><a href="/wp-content/uploads/2009/11/Xbox-360-3.png" rel="shadowbox[post-100];player=img;"><img class="size-medium wp-image-102" src="/wp-content/uploads/2009/11/Xbox-360-3-500x281.png" alt="" width="500" height="281" /></a><p class="wp-caption-text">Watch where you&#39;re going!</p></div>
<p><span id="more-100"></span>So I&#8217;ve been in a programming rut as of late.  I have gotten a little work done here and there, but for the most part I&#8217;ve been just sitting on the couch watching a seemingly never-ending <a href="http://abc.go.com/shows/lost">LOST</a> marathon.  I decided the other day that if I&#8217;m doomed to have coder&#8217;s block, I might as well search for some asset packs that I can throw into my game with little effort.  I found a great <a href="http://www.eivaagames.com/contentpacks/broken-cars-pack/">Broken Cars Pack</a> over at <a href="http://www.eivaagames.com/">Eivaa Games</a>, and they were nice enough to re-export all of the models for me due to a compatibility issue with their OBJ files.  The pack has since been updated w/ more-compatible OBJ, as well as FBX versions.</p>
<p>So, let&#8217;s all be just a little bit productive and build a list of <em>quality</em> asset pack providers for indie game developers. <img src='http://deadshift.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<ul>
<li><a href="http://www.eivaagames.com/contentpacks/">Eivaa Games</a> &#8211; Small collection (Broken Cars, Foliage, Props, Stones, SoundFX)</li>
<li><a href="http://www.dexsoft-games.com/models/">Dexsoft Multimedia</a> &#8211; Large collection (Sci-fi, Fantasy, Cartoon, Modern, Vegitation, Characters, Misc)</li>
<li><a href="http://www.fpscreator.com/">FPSCreator</a> &#8211; Massive Packs of Assets! (Environment, Props, Characters)</li>
<li><a href="http://www.3drt.com/3dm/3dm.htm">3DRT</a> &#8211; Large collection (Characters, Vehicles, Environments)</li>
<li><a href="http://evolver.com">Evolver</a> &#8211; Online Character creator.  Unethical pricing scheme: Edit a character, buy it again&#8230; But surprisingly high-quality characters&#8230; It&#8217;s a tough call&#8230;</li>
<li><a href="http://www.animeeple.com">Animeeple</a> &#8211; Massive collection of Motion Captures/Animations&#8230; Accessed using (free) outstanding animation software&#8230; Compatible with Evolver <img src='http://deadshift.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </li>
<li><a href="http://gothasoft.com/">GothaSoft</a> &#8211; A single pack of Suburban Houses&#8230; They look quite nice though. <img src='http://deadshift.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
<li><a href="http://3d4ya.com/">3d4ya</a> &#8211; Medium collection (Characters, Props)</li>
<li><a href="http://3dbud.com/">3dBud</a> &#8211; Medium collection (Characters, Animals)&#8230; 3d4ya&#8217;s sister site</li>
<li><a href="http://www.garagegames.com/products/browse/artpacks">GarageGames</a> &#8211; Medium Collection (Large Environment Packs, Characters, Props, Sounds)
<ul>
<li><em><strong>Warning</strong>: If you don&#8217;t use Torque, read the &#8220;Features&#8221; of each pack closely!  I recently bought a &#8220;Combo Pack&#8221; and only some sub-packs were usable outside of Torque.  Even the packs that specified they contain .OBJ files don&#8217;t seem to have them for every model&#8230;</em> *grumble*</li>
</ul>
</li>
<li><a href="http://www.game-stuff.com/">Game Stuff</a> &#8211; Large collection (Completed Game Levels, Buildings, Weapons, Plants)&#8230; A bit pricey/high-poly for my tastes.</li>
<li><a href="http://www.darkroomstudios.com/component/page,shop.browse/category_id,2/option,com_virtuemart/Itemid,1/">Darkroom Studios</a> &#8211; Small collection, mostly repeats from Dexsoft, but some nice additions.</li>
<li><a href="http://www.monsterpacks.com/">MonsterPacks</a> &#8211; Small collection (Haunted House, Graveyard, Sci-fi, etc)&#8230; These may or may not suffer from the same problems as other Torque (GarageGames) packs.</li>
<li><a href="http://incompetech.com/m/c/royalty-free/">Incompetech</a> &#8211; Amazing collection of Royalty-free music&#8230; I love the &#8220;Horror&#8221; section. <img src='http://deadshift.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
<li><a href="http://panzerflakes.com">PanzerFlakes</a> &#8211; Royalty-free Game Music&#8230; Decent collection&#8230;</li>
</ul>
<p>If you know of any other <em>quality</em> resources for asset packs, post a comment and I&#8217;ll add it to the list! <img src='http://deadshift.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://deadshift.com/blog/feeling-like-a-wreck/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Learning to Live With Physical Limitations</title>
		<link>http://deadshift.com/blog/learning-to-live-with-physical-limitations</link>
		<comments>http://deadshift.com/blog/learning-to-live-with-physical-limitations#comments</comments>
		<pubDate>Mon, 02 Nov 2009 03:52:16 +0000</pubDate>
		<dc:creator>PolyVector</dc:creator>
				<category><![CDATA[Devlog]]></category>

		<guid isPermaLink="false">http://deadshift.com/?p=62</guid>
		<description><![CDATA[A look at how XNA's performance issues on the Xbox360 affect how indie developers should approach the problem of physics.]]></description>
			<content:encoded><![CDATA[<div id="attachment_71" class="wp-caption alignnone" style="width: 510px"><a href="/wp-content/uploads/2009/11/37720565.png" rel="shadowbox[post-62];player=img;"><img class="size-medium wp-image-71" src="/wp-content/uploads/2009/11/37720565-500x281.png" alt="" width="500" height="281" /></a><p class="wp-caption-text">What is it with games and crates?</p></div>
<p><span id="more-62"></span>For over half a year now I&#8217;ve been tinkering away at my engine, hoping to create some amazing &#8220;Dawn of the Dead Theft Auto&#8221; game with hundreds of onscreen zombies interacting with thousands of physical objects&#8230;  To achieve this I&#8217;ve probably tracked down every managed physics engine/demo/snippet in existence, and what I&#8217;ve come to realize is that my time would have been better spent setting unicorn traps.  The fact of the matter is that XNA on the Xbox360 could never handle a simulation this complex unless the invading zombie horde was taking a siesta&#8230; or we were willing to sacrifice a bit of realism.</p>
<h3>Thinking Last-Gen</h3>
<p>While XNA is able to harness nearly all of the Xbox360&#8242;s GPU goodness, for reasons I won&#8217;t get into here we need to treat the CPU more like a Dreamcast.  So we need to ask ourselves if we want a small-scale realistic game, or a large-scale fun game?  If you&#8217;re shooting for the former, get the latest copy of JigLibX and make your life easy&#8230; If you belong to my unlucky camp and wish to make a large physics-heavy game, be prepared to write your own engine or think up a different game.</p>
<div class="wp-caption alignnone" style="width: 510px"><a href="/wp-content/uploads/2009/11/Xbox-360-2.png" rel="shadowbox[post-62];player=img;"><img src="/wp-content/uploads/2009/11/Xbox-360-2-500x281.png" alt="Zombie Physics 101" width="500" height="281" /></a><p class="wp-caption-text">Zombie Physics 101</p></div>
<h3>Learn From My Mistakes</h3>
<p>While the physics in Dead Shift are far from complete, they&#8217;ve shown enough promise that I would like to share some of the things I&#8217;ve learned the hard way&#8230;</p>
<ul>
<li>Verlet Physics are no replacement for Rigid Body Dynamics.  Verlet systems may seem easy to design, but they are hard to control, hard to stabilize, and the countless constraints required will kill your performance anyway.</li>
<li>Forget about fancy contact resolution, shock propagation, stacking, etc.  When you have a mind-blowingly fast engine, you can think about adding these things.</li>
<li>You can approximate basically any shape with a series of spheres.  They&#8217;re easy to move around, they&#8217;re easy to test for collisions with, and you don&#8217;t have to worry much about coordinate spaces and costly matrix multiplications.</li>
<li>KD-Trees are easier to implement than Octrees, and with a decent SAH (Surface Area Heuristic) they can be much faster too!</li>
<li>Avoid building/clearing temporary Lists at all costs.  Have your collision detection test-as-you-traverse to avoid building lists of polygons or nodes.</li>
<li>Split up work on multiple cores <em>anywhere you can!</em></li>
<li>Research XNA&#8217;s specific performance pitfalls on the 360.  Learn everything you can about the Garbage Collector, avoiding call-by-value functions, manual inlining, etc.</li>
<li>Be prepared to lose sleep, and a bit of sanity.</li>
</ul>

	<script type="text/javascript">
		var flashvars = {};
		flashvars.playOnStart = "false";
		flashvars.startVolume = "70";
		flashvars.autoHideOther = "false";
		flashvars.autoHideVideoControls = "false";
		flashvars.onStartShowControls = "true";
		flashvars.fullVideoScale = "true";
		flashvars.showPlayButton = "true";
		flashvars.share = "false";
		flashvars.MediaLink2 = "http://www.youtube.com/watch?v=aRjZzzmJAIQ";
		flashvars.image = "http://deadshift.com/wp-content/plugins/youtube-with-style/lib/img.php?v=aRjZzzmJAIQ";
		var params = {};
		params.bgcolor = "#000000";
		params.allowfullscreen = "true";
		params.wmode = "opaque";
		var attributes = {};
		attributes.id = "myplayer";
		swfobject.embedSWF("http://deadshift.com/wp-content/plugins/youtube-with-style/lib/player.swf", "myAlternativeContent", "500", "312", "9.0.0", false, flashvars, params, attributes);
	</script> <div id="myAlternativeContent">	<object width="500" height="306"><param name="movie" value="http://www.youtube.com/v/aRjZzzmJAIQ&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/aRjZzzmJAIQ&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="500" height="306"></embed></object></div>
<p>Here are some resources that I&#8217;ve found useful for my little physics experiment:</p>
<ul>
<li>XNAMike&#8217;s port of some physics code.  I adapted an impulse response method from this sample.  [<a href="http://forums.xna.com/forums/t/17242.aspx">Forum Post</a>] [<a href="/wp-content/uploads/2009/11/XNAPhysics3.zip">Zip</a>]</li>
<li>Jacco Bikker&#8217;s explanation of KD-Trees. [<a href="http://www.devmaster.net/articles/raytracing_series/part7.php">Article</a>]</li>
<li>Olivier Renault&#8217;s example collision code.  Good example of OBB-&gt;OBB Separating Axis Theorem. [<a href="http://www.gamedev.net/community/forums/topic.asp?topic_id=193500&amp;whichpage=1&amp;#1213168">Forum Post</a>] [<a href="http://members.lycos.co.uk/olivierrenault/">Homepage</a>]</li>
<li>Ralph Morton&#8217;s &#8220;Icarus&#8221; physics engine.  I haven&#8217;t had much time to play with this, but it looks to be a very clean and basic engine.  No license, do what you want with it! [<a href="http://forums.tidemedia.co.za/nag/showthread.php?t=10132">Forum Post</a>] [<a href="/wp-content/uploads/2009/11/Icarus_END.zip">Zip</a>]</li>
</ul>
<p><strong>Edit (11/28/2009):</strong> Added some links to useful resources.</p>
]]></content:encoded>
			<wfw:commentRss>http://deadshift.com/blog/learning-to-live-with-physical-limitations/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
