<?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/"
	>

<channel>
	<title>kode80</title>
	<atom:link href="http://kode80.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://kode80.com</link>
	<description>Coding for web, iPhone and OSX</description>
	<pubDate>Tue, 09 Mar 2010 19:55:45 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Stylized Graffiti Rendering</title>
		<link>http://kode80.com/2010/01/08/stylized-graffiti-rendering/</link>
		<comments>http://kode80.com/2010/01/08/stylized-graffiti-rendering/#comments</comments>
		<pubDate>Fri, 08 Jan 2010 19:16:08 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[actionscript]]></category>

		<category><![CDATA[effects]]></category>

		<category><![CDATA[experiment]]></category>

		<category><![CDATA[GML]]></category>

		<category><![CDATA[graffiti]]></category>

		<guid isPermaLink="false">http://kode80.com/?p=567</guid>
		<description><![CDATA[Earlier this week I stumbled upon <a href="http://000000book.com/" target="_blank">#000000book.com</a> a site created as an open database of GML files. GML is a new XML format used to describe graffiti tags. This is my first experiment in stylized rendering of graffiti in 3D.]]></description>
			<content:encoded><![CDATA[<p>
<object width="950" height="500">
<param name="movie" value="http://kode80.com/wp-content/uploads/2010/01/graffiti_rendering.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#000000"></param>
<embed type="application/x-shockwave-flash" width="950" height="500" src="http://kode80.com/wp-content/uploads/2010/01/graffiti_rendering.swf" quality="high" bgcolor="#000000" wmode="window" menu="false" ></embed>
</object>
</p>
<div class="container">
<div class="column span-24 append-1">
<div class="box">
Click the above example to load another tag, there are 26 tags to view and 4 different styles. Mouse position controls rotation.
</div>
</div</p>
<div class="column span-8 append-1">
Earlier this week I stumbled upon <a href="http://000000book.com/" target="_blank">#000000book.com</a> a site created as an open database of GML files. GML is a new XML format used to describe graffiti tags. GML stores not only the resulting tag but the artists hand movements that created it, essentially a recording of the tag being written. Aside from providing a great source of interesting data I consider this to be an important effort in curating an often misunderstood global artform.
</div>
<div class="column span-7 append-1">
The first step was to create an AS3 library that could parse GML files and provide an interface to the time stamped point data. In doing this it became very apparent that not all GML files were created equal with some files having wrong parenting of nodes and others storing coords incorrectly but this is to be expected considering the GML spec is only at 0.1c.
</div>
<div class="column span-7 end">
To render the tags my aim was for a stylized pseudo 3D look. The points are transformed and projected with Z based on time, then rendered as a 2D textured line. Each line segments left/right edges are outlined and the start/end edges are rotated/scaled based on neighboring point angle and Z respectively. Finally a subtle glow filter adds some contrast.
</div>
</div>
<p><!-- LINKS --></p>
<div class="container">
<div class="column span-24 end">
<div class="box">
<h5>Code</h5>
<p><a href="http://code.google.com/p/kode80as3experiments/source/browse/trunk/src/com/kode80/experiments/gml/" target="_blank">GML experiment source on Google code</a></p>
<h5>Links</h5>
<p><a href="http://000000book.com/" target="_blank">000000book GML database</a></p>
<p><a href="http://jamiedubs.com/wikis/blackbook/" target="_blank">000000book API</a></p>
<p><a href="http://fffff.at/gml/" target="_blank">Version 0.1c of the GML specification</a></p>
</div>
</div>
</div>
<a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fkode80.com%2F2010%2F01%2F08%2Fstylized-graffiti-rendering%2F&amp;linkname=Stylized%20Graffiti%20Rendering" title="Facebook" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/facebook.png" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fkode80.com%2F2010%2F01%2F08%2Fstylized-graffiti-rendering%2F&amp;linkname=Stylized%20Graffiti%20Rendering" title="Twitter" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/twitter.png" alt="Twitter"/></a> <a href="http://www.addtoany.com/add_to/netvibes_share?linkurl=http%3A%2F%2Fkode80.com%2F2010%2F01%2F08%2Fstylized-graffiti-rendering%2F&amp;linkname=Stylized%20Graffiti%20Rendering" title="Netvibes Share" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/netvibes.png" alt="Netvibes Share"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fkode80.com%2F2010%2F01%2F08%2Fstylized-graffiti-rendering%2F&amp;linkname=Stylized%20Graffiti%20Rendering" title="Delicious" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/delicious.png" alt="Delicious"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fkode80.com%2F2010%2F01%2F08%2Fstylized-graffiti-rendering%2F&amp;linkname=Stylized%20Graffiti%20Rendering"><img src="http://kode80.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://kode80.com/2010/01/08/stylized-graffiti-rendering/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PV3D light rays</title>
		<link>http://kode80.com/2009/11/19/pv3d-light-rays/</link>
		<comments>http://kode80.com/2009/11/19/pv3d-light-rays/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 15:09:17 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[actionscript]]></category>

		<category><![CDATA[effects]]></category>

		<category><![CDATA[experiment]]></category>

		<category><![CDATA[light rays]]></category>

		<category><![CDATA[lighting]]></category>

		<category><![CDATA[opensource]]></category>

		<category><![CDATA[papervision]]></category>

		<category><![CDATA[pixel bender]]></category>

		<guid isPermaLink="false">http://kode80.com/?p=523</guid>
		<description><![CDATA[For a while now I've been wanting to experiment with volumetric lighting techniques in Papervision and the other day I came across a post processing technique that gives great results for very modest overhead.]]></description>
			<content:encoded><![CDATA[<p>
<object width="950" height="500">
<param name="movie" value="http://kode80.com/wp-content/uploads/2009/11/pv3d_lightrays.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#000000"></param>
<embed type="application/x-shockwave-flash" width="950" height="500" src="http://kode80.com/wp-content/uploads/2009/11/pv3d_lightrays.swf" quality="high" bgcolor="#000000" wmode="window" menu="false" ></embed>
</object>
</p>
<div class="container">
<div class="column span-24 append-1">
<div class="box">
In the example above, click and drag to reposition the light rays filter light source.
</div>
</div</p>
<div class="column span-8 append-1">
<p>For a while now I&#8217;ve been wanting to experiment with volumetric lighting techniques in Papervision and the other day I came across a great article from Fabien Sanglard regarding a fake post processing approach described in Graphics Gems 3. (Fabien has some excellent posts on GFX coding which I highly recommend, especially if you are an iPhone developer)
</p></div>
<div class="column span-7 append-1">
The post processing technique described is beautiful in it&#8217;s simplicity and gives great results for very modest overhead. All it requires is drawing the occluders of the scene as black over a colored background then applying something similar to a radial blur emanating from the imaginary light source.
</div>
<div class="column span-7 end">
In the scene above the rendered output is scaled by 25% and drawn to a bitmap using a ColorTransform to make it black. This bitmap then has the light rays pixel bender filter applied, is scaled back up and blended with the scene using the regular blend mode. Check my experiments repository for the code!
</div>
</div>
<p><!-- LINKS --></p>
<div class="container">
<div class="column span-24 end">
<div class="box">
<h5>Code</h5>
<p><a href="http://code.google.com/p/kode80as3experiments/source/browse/trunk/src/com/kode80/experiments/pvgodrays/" target="_blank">PV3D light rays source on Google code</a></p>
<h5>Links</h5>
<p><a href="http://www.fabiensanglard.net/lightScattering/index.php" target="_blank">Fabien Sanglard&#8217;s article on light scattering as a post process</a></p>
</div>
</div>
</div>
<a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F11%2F19%2Fpv3d-light-rays%2F&amp;linkname=PV3D%20light%20rays" title="Facebook" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/facebook.png" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F11%2F19%2Fpv3d-light-rays%2F&amp;linkname=PV3D%20light%20rays" title="Twitter" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/twitter.png" alt="Twitter"/></a> <a href="http://www.addtoany.com/add_to/netvibes_share?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F11%2F19%2Fpv3d-light-rays%2F&amp;linkname=PV3D%20light%20rays" title="Netvibes Share" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/netvibes.png" alt="Netvibes Share"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F11%2F19%2Fpv3d-light-rays%2F&amp;linkname=PV3D%20light%20rays" title="Delicious" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/delicious.png" alt="Delicious"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F11%2F19%2Fpv3d-light-rays%2F&amp;linkname=PV3D%20light%20rays"><img src="http://kode80.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://kode80.com/2009/11/19/pv3d-light-rays/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Per pixel depth clipping</title>
		<link>http://kode80.com/2009/10/26/per-pixel-depth-clipping/</link>
		<comments>http://kode80.com/2009/10/26/per-pixel-depth-clipping/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 15:55:45 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[actionscript]]></category>

		<category><![CDATA[experiment]]></category>

		<category><![CDATA[papervision]]></category>

		<category><![CDATA[per pixel depth clipping]]></category>

		<category><![CDATA[pixel bender]]></category>

		<category><![CDATA[zbuffer]]></category>

		<guid isPermaLink="false">http://kode80.com/?p=506</guid>
		<description><![CDATA[With my 11bit depth buffer technique in PV3D the primary goal was enabling post processing effects that are only achievable with a depth buffer however at the back of my mind I wondered if depth testing was in some way feasible.]]></description>
			<content:encoded><![CDATA[<p>
<object width="950" height="500">
<param name="movie" value="http://kode80.com/wp-content/uploads/2009/10/perpixel_depth_clipping.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#000000"></param>
<embed type="application/x-shockwave-flash" width="950" height="500" src="http://kode80.com/wp-content/uploads/2009/10/perpixel_depth_clipping.swf" quality="high" bgcolor="#000000" wmode="window" menu="false" ></embed>
</object>
</p>
<div class="container">
<div class="column span-24 append-1">
<div class="box">
In the example above, mouse X controls the cubes X position, mouse Y controls the cubes Z position and clicking switches between viewing the output and the depth buffer.
</div>
</div</p>
<div class="column span-8 append-1">
<p>The primary purpose of a depth buffer is to enable per pixel depth checking. Before a pixel can be drawn its depth is compared with the current depth at that point in the depth buffer. If the new depth is greater than the current depth then the new pixel is obviously occluded and thus shouldn&#8217;t be drawn. Doing this prevents depth sorting issues and allows objects to intersect without the need for dynamic tessellation.
</p></div>
<div class="column span-7 append-1">
With my 11bit depth buffer technique in PV3D the primary goal was enabling post processing effects that are only achievable with a depth buffer however at the back of my mind I wondered if depth testing was in some way feasible. Initially I contemplated lowering the precision to 8bit and using BitmapData methods to create per object masks but this would involve a large number of bitmap operations.
</div>
<div class="column span-7 end">
Using custom PixelBender blend modes seemed like the perfect solution offering a similar setup minus all the bitmap operations while still keeping 11bit precision. The first blend mode does the depth testing for each depth buffer layer resulting in a clipped depth buffer. Then a second blend mode copies over the texture based on a red channel encoded object ID.
</div>
</div>
<a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F10%2F26%2Fper-pixel-depth-clipping%2F&amp;linkname=Per%20pixel%20depth%20clipping" title="Facebook" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/facebook.png" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F10%2F26%2Fper-pixel-depth-clipping%2F&amp;linkname=Per%20pixel%20depth%20clipping" title="Twitter" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/twitter.png" alt="Twitter"/></a> <a href="http://www.addtoany.com/add_to/netvibes_share?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F10%2F26%2Fper-pixel-depth-clipping%2F&amp;linkname=Per%20pixel%20depth%20clipping" title="Netvibes Share" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/netvibes.png" alt="Netvibes Share"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F10%2F26%2Fper-pixel-depth-clipping%2F&amp;linkname=Per%20pixel%20depth%20clipping" title="Delicious" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/delicious.png" alt="Delicious"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F10%2F26%2Fper-pixel-depth-clipping%2F&amp;linkname=Per%20pixel%20depth%20clipping"><img src="http://kode80.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://kode80.com/2009/10/26/per-pixel-depth-clipping/feed/</wfw:commentRss>
		</item>
		<item>
		<title>kode80 joins PV3D</title>
		<link>http://kode80.com/2009/10/26/kode80-joins-pv3d/</link>
		<comments>http://kode80.com/2009/10/26/kode80-joins-pv3d/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 15:28:41 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[actionscript]]></category>

		<category><![CDATA[opensource]]></category>

		<category><![CDATA[papervision]]></category>

		<guid isPermaLink="false">http://kode80.com/?p=504</guid>
		<description><![CDATA[As you can probably tell from the experiments on this site I have something of a love affair with 3D in Flash. Recently I was invited to join the Papervision3D team as a contributing member to help out with the latest iteration of the engine, PV3D 3.0... ]]></description>
			<content:encoded><![CDATA[<p>As you can probably tell from the experiments on this site I have something of a love affair with 3D in Flash. I remember the first time I saw a Papervision example running and how blown away I was, PV3D was truly a milestone in the Flash platforms history. Since then I have used PV3D in many commercial works and have taken every opportunity to explore how far 3D in Flash can be taken. With the introduction of PixelBender and the additions to the Graphics API the room for experimentation has increased once more.<br />
Recently I was invited to join the Papervision3D team as a contributing member to help out with the latest iteration of the engine, PV3D 3.0. Working alongside some of the best AS3 coders in the business on such a landmark project is certainly an honor, exciting times ahead.</p>
<a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F10%2F26%2Fkode80-joins-pv3d%2F&amp;linkname=kode80%20joins%20PV3D" title="Facebook" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/facebook.png" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F10%2F26%2Fkode80-joins-pv3d%2F&amp;linkname=kode80%20joins%20PV3D" title="Twitter" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/twitter.png" alt="Twitter"/></a> <a href="http://www.addtoany.com/add_to/netvibes_share?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F10%2F26%2Fkode80-joins-pv3d%2F&amp;linkname=kode80%20joins%20PV3D" title="Netvibes Share" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/netvibes.png" alt="Netvibes Share"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F10%2F26%2Fkode80-joins-pv3d%2F&amp;linkname=kode80%20joins%20PV3D" title="Delicious" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/delicious.png" alt="Delicious"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F10%2F26%2Fkode80-joins-pv3d%2F&amp;linkname=kode80%20joins%20PV3D"><img src="http://kode80.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://kode80.com/2009/10/26/kode80-joins-pv3d/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Fluid dynamics smoke</title>
		<link>http://kode80.com/2009/10/05/fluid-dynamics-smoke/</link>
		<comments>http://kode80.com/2009/10/05/fluid-dynamics-smoke/#comments</comments>
		<pubDate>Mon, 05 Oct 2009 15:12:19 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[actionscript]]></category>

		<category><![CDATA[effects]]></category>

		<category><![CDATA[experiment]]></category>

		<category><![CDATA[fluid dynamics]]></category>

		<category><![CDATA[opensource]]></category>

		<category><![CDATA[smoke]]></category>

		<guid isPermaLink="false">http://kode80.com/?p=480</guid>
		<description><![CDATA[Fluid dynamics is the study of fluids in motion. Simulating the interactions of gas and liquid in motion is a highly processor intensive task but the results can be well worth it. This is my first attempt at a fluid dynamics smoke/cloud experiment in Flash.]]></description>
			<content:encoded><![CDATA[<p>
<object width="950" height="500">
<param name="movie" value="http://kode80.com/wp-content/uploads/2009/10/fluid_smoke.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#000000"></param>
<embed type="application/x-shockwave-flash" width="950" height="500" src="http://kode80.com/wp-content/uploads/2009/10/fluid_smoke.swf" quality="high" bgcolor="#000000" wmode="window" menu="false" ></embed>
</object>
</p>
<div class="container">
<div class="column span-24 append-1">
<div class="box">
In the example above, click and drag to draw smoke. Mouse movement without clicking pushes smoke around.
</div>
</div</p>
<div class="column span-8 append-1">
<p>Fluid dynamics is the study of fluids in motion. Simulating the interactions of gas and liquid in motion is a highly processor intensive task requiring many iterations of thousands of calculations.</p>
<p>It is impossible to research fluid dynamics without hearing the name Jos Stam, the principle scientist at Autodesk (and winner of Academy Award for his work  on subdivision surfaces).
</p>
</div>
<div class="column span-7 append-1">
<p>The example above is an implementation of Jos Stams Real-Time Fluid Dynamics for Games paper. It utilizes an 80&#215;80 grid and is pure AS3 (no Alchemy or Pixel Bender). To achieve a decent framerate at that grid size certain liberties had to be taken with the algorithm. For example by assuming both diffuse and viscosity are 0 many of the calculations can be simplified.
</p>
</div>
<div class="column span-7 end">
<p>The multiple iterations per frame step were also removed as with this type of soft smoke/cloud effect they are not necessary for a satisfactory result On top of that I have optimized as much as possible, for example I was able to remove a good 80% of multiplication&#8217;s from the original paper.</p>
<p>Next step, Pixel Bender and/or Alchemy&#8230;
</p>
</div>
</div>
<p><!-- LINKS --></p>
<div class="container">
<div class="column span-24 end">
<div class="box">
<h5>Code</h5>
<p><a href="http://code.google.com/p/kode80as3experiments/source/browse/trunk/src/com/kode80/experiments/fluiddynamics/" target="_blank">Fluid dynamics smoke source on Google code</a></p>
<h5>Links</h5>
<p><a href="http://www.dgp.toronto.edu/people/stam/reality/Research/pdf/GDC03.pdf" target="_blank">Real-Time Fluid Dynamics for Games paper</a></p>
<p><a href="http://blog.inspirit.ru/?p=248" target="_blank">Eugene Zatepyakin&#8217;s AS3 fluid experiment</a>,<br />
<a href="http://blog.inspirit.ru/?p=339" target="_blank">Alchemy version</a></p>
<p><a href="http://blog.oaxoa.com/2008/01/21/actionscript-3-fluids-simulation/" target="_blank">Pierluigi Pesenti&#8217;s AS3 fluid smoke experiment</a></p>
</div>
</div>
</div>
<a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F10%2F05%2Ffluid-dynamics-smoke%2F&amp;linkname=Fluid%20dynamics%20smoke" title="Facebook" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/facebook.png" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F10%2F05%2Ffluid-dynamics-smoke%2F&amp;linkname=Fluid%20dynamics%20smoke" title="Twitter" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/twitter.png" alt="Twitter"/></a> <a href="http://www.addtoany.com/add_to/netvibes_share?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F10%2F05%2Ffluid-dynamics-smoke%2F&amp;linkname=Fluid%20dynamics%20smoke" title="Netvibes Share" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/netvibes.png" alt="Netvibes Share"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F10%2F05%2Ffluid-dynamics-smoke%2F&amp;linkname=Fluid%20dynamics%20smoke" title="Delicious" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/delicious.png" alt="Delicious"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F10%2F05%2Ffluid-dynamics-smoke%2F&amp;linkname=Fluid%20dynamics%20smoke"><img src="http://kode80.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://kode80.com/2009/10/05/fluid-dynamics-smoke/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PV3D depth buffer source</title>
		<link>http://kode80.com/2009/09/30/pv3d-depth-buffer-source/</link>
		<comments>http://kode80.com/2009/09/30/pv3d-depth-buffer-source/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 20:57:03 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[actionscript]]></category>

		<category><![CDATA[effects]]></category>

		<category><![CDATA[experiment]]></category>

		<category><![CDATA[fog]]></category>

		<category><![CDATA[opensource]]></category>

		<category><![CDATA[papervision]]></category>

		<category><![CDATA[pixel bender]]></category>

		<category><![CDATA[zbuffer]]></category>

		<guid isPermaLink="false">http://kode80.com/?p=464</guid>
		<description><![CDATA[Using the same Pixel Bender kernel as my previous depth of field experiment it is possible to achieve depth based fog. Source code for this example included!]]></description>
			<content:encoded><![CDATA[<p>
<object width="950" height="500">
<param name="movie" value="http://kode80.com/wp-content/uploads/2009/09/pv3d_depth_fog.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#000000"></param>
<embed type="application/x-shockwave-flash" width="950" height="500" src="http://kode80.com/wp-content/uploads/2009/09/pv3d_depth_fog.swf" quality="high" bgcolor="#000000" wmode="window" menu="false" ></embed>
</object>
</p>
<div class="container">
<div class="column span-24 append-1">
<div class="box">
Clicking the example above will switch between viewing output and the depth buffer.
</div>
</div</p>
<div class="column span-8 append-1">
<p>Using the same Pixel Bender kernel as my previous depth of field experiment it is possible to achieve depth based fog. Since the kernel controls alpha based on depth we just have to fill the filter target with the desired fog color. To make it a little more visually interesting I have added some animated perlin noise as well.
</p>
</div>
<div class="column span-7 append-1">
<p>The trick to creating the depth buffer was rather simple. First a texture is created with each pixel set to it&#8217;s Y value, then when rendering, each vertex has it&#8217;s V texture coordinate set based on it&#8217;s Z position. From here a Pixel Bender kernel can decode the depth&#8230; and then the fun begins!
</p>
</div>
<div class="column span-7 end">
<p>I have updated my experiments repository with the above example. It&#8217;s still in the early proof of concept stage but should provide you with a starting point for your own depth aware Pixel Bender effects.
</p>
</div>
</div>
<p><!-- LINKS --></p>
<div class="container">
<div class="column span-24 end">
<div class="box">
<h5>Code</h5>
<p><a href="http://code.google.com/p/kode80as3experiments/source/browse/trunk/src/com/kode80/experiments/pvzbuffer2/" target="_blank">Depth buffer fog source on Google code</a></p>
<h5>Links</h5>
<p><a href="http://kode80.com/2009/09/29/pv3d-depth-of-field-v2/" target="_blank">Depth buffer depth of field experiment</a></p>
<p><a href="http://kode80.com/2009/09/28/papervision-ssao-phase-ii/" target="_blank">Depth buffer ambient occlusion experiment</a></p>
</div>
</div>
</div>
<a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F09%2F30%2Fpv3d-depth-buffer-source%2F&amp;linkname=PV3D%20depth%20buffer%20source" title="Facebook" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/facebook.png" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F09%2F30%2Fpv3d-depth-buffer-source%2F&amp;linkname=PV3D%20depth%20buffer%20source" title="Twitter" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/twitter.png" alt="Twitter"/></a> <a href="http://www.addtoany.com/add_to/netvibes_share?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F09%2F30%2Fpv3d-depth-buffer-source%2F&amp;linkname=PV3D%20depth%20buffer%20source" title="Netvibes Share" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/netvibes.png" alt="Netvibes Share"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F09%2F30%2Fpv3d-depth-buffer-source%2F&amp;linkname=PV3D%20depth%20buffer%20source" title="Delicious" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/delicious.png" alt="Delicious"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F09%2F30%2Fpv3d-depth-buffer-source%2F&amp;linkname=PV3D%20depth%20buffer%20source"><img src="http://kode80.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://kode80.com/2009/09/30/pv3d-depth-buffer-source/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PV3D Depth of Field v2</title>
		<link>http://kode80.com/2009/09/29/pv3d-depth-of-field-v2/</link>
		<comments>http://kode80.com/2009/09/29/pv3d-depth-of-field-v2/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 19:01:38 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[actionscript]]></category>

		<category><![CDATA[DOF]]></category>

		<category><![CDATA[effects]]></category>

		<category><![CDATA[experiment]]></category>

		<category><![CDATA[papervision]]></category>

		<category><![CDATA[pixel bender]]></category>

		<category><![CDATA[zbuffer]]></category>

		<guid isPermaLink="false">http://kode80.com/?p=410</guid>
		<description><![CDATA[The biggest issue with my past DOF experiments was the lack of depth buffer precision. With my latest PV3D depth buffer implementation providing 11bit precision at the pixel level the past DOF limitations are no longer an issue.]]></description>
			<content:encoded><![CDATA[<p>
<object width="950" height="500">
<param name="movie" value="http://kode80.com/wp-content/uploads/2009/09/pv3d_dof_v2.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#000000"></param>
<embed type="application/x-shockwave-flash" width="950" height="500" src="http://kode80.com/wp-content/uploads/2009/09/pv3d_dof_v2.swf" quality="high" bgcolor="#000000" wmode="window" menu="false" ></embed>
</object>
</p>
<div class="container">
<div class="column span-24 append-1">
<div class="box">
In the example above, use the controls to set the depth that the DOF starts and ends at and the strength of the blur. Setting the focus depth to greater than the blur depth will cause the distance to be in focus with the foreground out of focus. Click and drag to reposition the camera.
</div>
</div</p>
<div class="column span-8 append-1">
<p>The biggest issue with my past DOF experiments in Papervision was the lack of depth buffer precision. Depth information was limited to per triangle and so even with high tessellation and generous blurring the effect was not that great and displayed a lot of artifacts.
</p>
</div>
<div class="column span-7 append-1">
<p>With my latest PV3D depth buffer implementation providing 11bit precision at the pixel level the past DOF limitations are no longer an issue. Since the effect no longer requires high tessellation there is also a decent performance boost!
</p>
</div>
<div class="column span-7 end">
<p>To achieve this new version of DOF a simple Pixel Bender kernel reads the depth buffer and sets the targets alpha channel based on the depth, with a blur filter applied to the target we have blur based on depth, depth of field.
</p>
</div>
</div>
<p><!-- LINKS --></p>
<div class="container">
<div class="column span-24 end">
<div class="box">
<h5>Links</h5>
<p><a href="http://kode80.com/2009/06/29/papervision-zbuffer-and-dof/" target="_blank">My original Papervision DOF experiment</a></p>
<p><a href="http://en.wikipedia.org/wiki/Depth_of_field" target="_blank">Depth of field wikipedia page</a></p>
</div>
</div>
</div>
<a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F09%2F29%2Fpv3d-depth-of-field-v2%2F&amp;linkname=PV3D%20Depth%20of%20Field%20v2" title="Facebook" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/facebook.png" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F09%2F29%2Fpv3d-depth-of-field-v2%2F&amp;linkname=PV3D%20Depth%20of%20Field%20v2" title="Twitter" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/twitter.png" alt="Twitter"/></a> <a href="http://www.addtoany.com/add_to/netvibes_share?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F09%2F29%2Fpv3d-depth-of-field-v2%2F&amp;linkname=PV3D%20Depth%20of%20Field%20v2" title="Netvibes Share" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/netvibes.png" alt="Netvibes Share"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F09%2F29%2Fpv3d-depth-of-field-v2%2F&amp;linkname=PV3D%20Depth%20of%20Field%20v2" title="Delicious" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/delicious.png" alt="Delicious"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F09%2F29%2Fpv3d-depth-of-field-v2%2F&amp;linkname=PV3D%20Depth%20of%20Field%20v2"><img src="http://kode80.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://kode80.com/2009/09/29/pv3d-depth-of-field-v2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Papervision SSAO phase II</title>
		<link>http://kode80.com/2009/09/28/papervision-ssao-phase-ii/</link>
		<comments>http://kode80.com/2009/09/28/papervision-ssao-phase-ii/#comments</comments>
		<pubDate>Mon, 28 Sep 2009 15:17:18 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[actionscript]]></category>

		<category><![CDATA[ambient occlusion]]></category>

		<category><![CDATA[effects]]></category>

		<category><![CDATA[experiment]]></category>

		<category><![CDATA[papervision]]></category>

		<category><![CDATA[pixel bender]]></category>

		<category><![CDATA[ssao]]></category>

		<category><![CDATA[zbuffer]]></category>

		<guid isPermaLink="false">http://kode80.com/?p=388</guid>
		<description><![CDATA[Screen Space Ambient Occlusion is a post processing technique for approximating the shading achieved by ambient occlusion. In this example I implement SSAO for Papervision using a custom depth buffer material and Pixel Bender.]]></description>
			<content:encoded><![CDATA[<p>
<object width="950" height="500">
<param name="movie" value="http://kode80.com/wp-content/uploads/2009/09/ambient_occlusion_phase2.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#000000"></param>
<embed type="application/x-shockwave-flash" width="950" height="500" src="http://kode80.com/wp-content/uploads/2009/09/ambient_occlusion_phase2.swf" quality="high" bgcolor="#000000" wmode="window" menu="false" ></embed>
</object>
</p>
<div class="container">
<div class="column span-24 append-1">
<div class="box">
In the example above, the SSAO layers brightness, contrast, alpha, blur and blend mode can be adjusted to achieve different effects. Included are 7 presets as examples of what can be achieved with just these parameters. Click and drag to reposition the camera.
</div>
</div</p>
<div class="column span-8 append-1">
<p>Screen Space Ambient Occlusion is a post processing technique for approximating the shading achieved by ambient occlusion. Rather than using scene information such as geometry and lights to calculate shading, SSAO requires only a 2D depth buffer. For each pixel in the depth buffer multiple samples are taken from nearby and used to approximate the level of occlusion, this value can then be used to shade the output pixel.
</p>
</div>
<div class="column span-7 append-1">
<p>The example scene above is made entirely of Papervision cubes and spheres and contains no lights and no shader materials. Each object renders it&#8217;s bitmap texture as expected but also renders it&#8217;s depth to the depth buffer. The depth buffer is filtered using my SSAO Pixel Bender kernel then blurred and brightness/contrast adjusted using standard Flash filters.
</p>
</div>
<div class="column span-7 end">
<p>For a purely post processed effect the results are remarkably good adding a lot of depth to a flat scene. However there is still lots of room for improvement. The halo around objects could be minimized with a custom blur filter. The self-occluding surface issue is the result of no normal information and I have a few potential solutions for that. Still, not bad for phase 2!
</p>
</div>
</div>
<a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F09%2F28%2Fpapervision-ssao-phase-ii%2F&amp;linkname=Papervision%20SSAO%20phase%20II" title="Facebook" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/facebook.png" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F09%2F28%2Fpapervision-ssao-phase-ii%2F&amp;linkname=Papervision%20SSAO%20phase%20II" title="Twitter" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/twitter.png" alt="Twitter"/></a> <a href="http://www.addtoany.com/add_to/netvibes_share?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F09%2F28%2Fpapervision-ssao-phase-ii%2F&amp;linkname=Papervision%20SSAO%20phase%20II" title="Netvibes Share" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/netvibes.png" alt="Netvibes Share"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F09%2F28%2Fpapervision-ssao-phase-ii%2F&amp;linkname=Papervision%20SSAO%20phase%20II" title="Delicious" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/delicious.png" alt="Delicious"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F09%2F28%2Fpapervision-ssao-phase-ii%2F&amp;linkname=Papervision%20SSAO%20phase%20II"><img src="http://kode80.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://kode80.com/2009/09/28/papervision-ssao-phase-ii/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Papervision SSAO preview</title>
		<link>http://kode80.com/2009/09/26/papervision-ssao-preview/</link>
		<comments>http://kode80.com/2009/09/26/papervision-ssao-preview/#comments</comments>
		<pubDate>Sat, 26 Sep 2009 04:38:01 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[actionscript]]></category>

		<category><![CDATA[ambient occlusion]]></category>

		<category><![CDATA[effects]]></category>

		<category><![CDATA[experiment]]></category>

		<category><![CDATA[papervision]]></category>

		<category><![CDATA[pixel bender]]></category>

		<category><![CDATA[ssao]]></category>

		<category><![CDATA[zbuffer]]></category>

		<guid isPermaLink="false">http://kode80.com/?p=372</guid>
		<description><![CDATA[An early preview of my Screen Space Ambient Occlusion implementation in Papervision. Utilizing an 11bit depth buffer and Pixel Bender kernel.]]></description>
			<content:encoded><![CDATA[<p>
<object width="950" height="500">
<param name="movie" value="http://kode80.com/wp-content/uploads/2009/09/ambientocclusionphase1.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#000000"></param>
<embed type="application/x-shockwave-flash" width="950" height="500" src="http://kode80.com/wp-content/uploads/2009/09/ambientocclusionphase1.swf" quality="high" bgcolor="#000000" wmode="window" menu="false" ></embed>
</object>
</p>
<div class="container">
<div class="column span-24 append-1">
<p>
This is an early preview of my Screen Space Ambient Occlusion implementation in Papervision. To achieve this I am using a custom material that renders the scene as an 11bit depth buffer. I am then using Pixel Bender to interpret the depth buffer and filter using my SSAO implementation. More examples, code and a better optimized PB kernel to come next week.</p>
</div>
</div>
<p><!-- LINKS --></p>
<div class="container">
<div class="column span-24 end">
<div class="box">
<h5>Links:</h5>
<p><a href="http://en.wikipedia.org/wiki/Screen_Space_Ambient_Occlusion" target="_blank">Screen Space Ambient Occlusion Wikipedia page</a></p>
<p><a href="http://meshula.net/wordpress/?p=145" target="_blank">Some great examples of different approaches to Screen Space Ambient Occlusion at meshula.net</a></p>
</div>
</div>
</div>
<a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F09%2F26%2Fpapervision-ssao-preview%2F&amp;linkname=Papervision%20SSAO%20preview" title="Facebook" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/facebook.png" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F09%2F26%2Fpapervision-ssao-preview%2F&amp;linkname=Papervision%20SSAO%20preview" title="Twitter" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/twitter.png" alt="Twitter"/></a> <a href="http://www.addtoany.com/add_to/netvibes_share?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F09%2F26%2Fpapervision-ssao-preview%2F&amp;linkname=Papervision%20SSAO%20preview" title="Netvibes Share" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/netvibes.png" alt="Netvibes Share"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F09%2F26%2Fpapervision-ssao-preview%2F&amp;linkname=Papervision%20SSAO%20preview" title="Delicious" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/delicious.png" alt="Delicious"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F09%2F26%2Fpapervision-ssao-preview%2F&amp;linkname=Papervision%20SSAO%20preview"><img src="http://kode80.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://kode80.com/2009/09/26/papervision-ssao-preview/feed/</wfw:commentRss>
		</item>
		<item>
		<title>iPhone MD2 example</title>
		<link>http://kode80.com/2009/09/24/iphone-md2-example/</link>
		<comments>http://kode80.com/2009/09/24/iphone-md2-example/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 20:25:44 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[iphone]]></category>

		<category><![CDATA[md2]]></category>

		<category><![CDATA[opengles]]></category>

		<category><![CDATA[opensource]]></category>

		<guid isPermaLink="false">http://kode80.com/?p=348</guid>
		<description><![CDATA[The first major step when developing a 3D app is finding a way of importing models created in external editing software. Using my MD2 Objective C classes you can easily load, render and animate MD2 models in your iPhone app, example project included!]]></description>
			<content:encoded><![CDATA[<p>
<object width="950" height="500">
<param name="movie" value="http://kode80.com/wp-content/uploads/2009/09/iphone_md2_example_video.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#000000"></param>
<embed type="application/x-shockwave-flash" width="950" height="500" src="http://kode80.com/wp-content/uploads/2009/09/iphone_md2_example_video.swf" quality="high" bgcolor="#000000" wmode="window" menu="false" ></embed>
</object>
</p>
<div class="container">
<div class="column span-8 append-1">
<p>The first major step when developing a 3D app is finding a way of importing models created in external editing software. There are hundreds of formats to choose from each with their own pro&#8217;s and con&#8217;s.
</p>
<p>
For most 3D apps on the iPhone all that is required is the mesh (vertices, triangles, texture coordinates, normals) so the simpler the format the better.
</p>
<p>
Using a format that is well supported across a variety of editors and platforms is also essential for an optimal work flow especially if coders and artists are in different cities/states/countries.
</p>
</div>
<div class="column span-7 append-1">
<p>The MD2 file format was created by id Software in 1997 for non-level models in Quake II. It is a very light weight file format containing only the mesh. Animation is handled via keyframes with up to 512 frames stored in a file. Vertices are stored in a compressed format while normals are stored as an integer lookup into a pre-calculated table.
</p>
<p>
It proves to be a great fit for the iPhone in most instances.
</p>
</div>
<div class="column span-7 end">
<p>Using my KEMD2Object class you can easily load, render and animate MD2 files. Animation is handled by filling a KEMD2Animation struct with the start frame, end frame and FPS of the animation and setting the animation property to that struct.
</p>
<p>
For animated MD2&#8217;s make sure to call the tick method each frame passing in the time in seconds since the last call as this is where the keyframe interpolation occurs.
</p>
</div>
</div>
<p><!-- LINKS --></p>
<div class="container">
<div class="column span-24 end">
<div class="box">
<h5>Downloads:</h5>
<p><a href="http://kode80.com/wp-content/uploads/2009/09/kemd2objectexample.zip" target="_blank">My MD2 classes and example project</a></p>
<h5>Links:</h5>
<p><a href="http://tfc.duke.free.fr/old/models/md2.htm" target="_blank">Full break down of the MD2 format by David Henry</a></p>
<p><a href="http://www.blender.org/" target="_blank">www.blender.org</a></p>
<p><a href="http://www.idsoftware.com/games/quake/quake2/" target="_blank">id Software&#8217;s Quake II page</a></p>
</div>
</div>
</div>
<a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F09%2F24%2Fiphone-md2-example%2F&amp;linkname=iPhone%20MD2%20example" title="Facebook" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/facebook.png" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F09%2F24%2Fiphone-md2-example%2F&amp;linkname=iPhone%20MD2%20example" title="Twitter" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/twitter.png" alt="Twitter"/></a> <a href="http://www.addtoany.com/add_to/netvibes_share?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F09%2F24%2Fiphone-md2-example%2F&amp;linkname=iPhone%20MD2%20example" title="Netvibes Share" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/netvibes.png" alt="Netvibes Share"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F09%2F24%2Fiphone-md2-example%2F&amp;linkname=iPhone%20MD2%20example" title="Delicious" rel="nofollow" target="_blank"><img src="http://kode80.com/wp-content/plugins/add-to-any/icons/delicious.png" alt="Delicious"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fkode80.com%2F2009%2F09%2F24%2Fiphone-md2-example%2F&amp;linkname=iPhone%20MD2%20example"><img src="http://kode80.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://kode80.com/2009/09/24/iphone-md2-example/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

