<?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>Harry Northover - The Blog&#187; Getting Started with Augmented Reality (FLARToolkit).</title>
	<atom:link href="http://www.harrynorthover.com/blog/category/augmented-reality/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.harrynorthover.com/blog</link>
	<description>harrynorthover.com is a blog created by 15 year old Harry Northover</description>
	<lastBuildDate>Wed, 31 Mar 2010 22:00:04 +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>Getting Started with Augmented Reality (FLARToolkit).</title>
		<link>http://www.harrynorthover.com/blog/2009/04/15/getting-started-with-augmented-reality-flartoolkit/</link>
		<comments>http://www.harrynorthover.com/blog/2009/04/15/getting-started-with-augmented-reality-flartoolkit/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 22:50:34 +0000</pubDate>
		<dc:creator>Harry</dc:creator>
				<category><![CDATA[3D]]></category>
		<category><![CDATA[Augmented Reality]]></category>
		<category><![CDATA[Experimental]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[FLARToolkit]]></category>

		<guid isPermaLink="false">http://www.harrynorthover.com/blog/?p=680</guid>
		<description><![CDATA[If you have been following me on Twitter, then you may have noticed that I have been getting into Augmented Reality. This is the coolest thing I have seen in a long time! Now if you don&#8217;t know what this is, then it is a means of mapping 3D objects to a marker in the [...]]]></description>
			<content:encoded><![CDATA[<p>If you have been following <a href="http://www.twitter.com/harrynorthover" target="_blank">me on Twitter</a>, then you may have <a href="http://twitter.com/harrynorthover/status/1493666316" target="_blank">noticed</a> that I have been <a href="http://twitter.com/harrynorthover/status/1505193808" target="_blank">getting</a> into <a href="http://en.wikipedia.org/wiki/Augmented_reality" target="_blank">Augmented Reality</a>. This is the <strong>coolest</strong> thing I have seen in a long time! Now if you don&#8217;t know what this is, then it is a means of mapping 3D objects to a marker in the real world through a web cam.</p>
<p>Here is a simple guide to getting setup using the Augmented Reality in Flash. This includes downloading the library&#8217;s and then getting a simple demo up and running.</p>
<p>The name of the library used for Augmented Reality in Flash is called <a href="http://www.libspark.org/wiki/saqoosha/FLARToolKit/en" target="_blank">FLARToolkit</a> which is developed by Saqoosha. It is a port of the <a href="http://www.hitl.washington.edu/artoolkit/" target="_blank">ARToolkit</a> which is written in C. You can download it from <a href="http://www.libspark.org/wiki/saqoosha/FLARToolKit/en" target="_blank">here</a> through SVN. If you haven&#8217;t got a SVN client setup then I highly recommend <a href="http://www.syntevo.com/smartsvn/index.html" target="_blank">SmartSVN</a> which is a free client and I must thank <a href="http://richardleggett.co.uk/blog/" target="_blank">Richard Leggett</a> for <a href="http://twitter.com/richardleggett/statuses/1489494390" target="_blank">recommending</a> this to me!</p>
<p>Now once you have got the code, add it to your global Actionscript folder, then print out this <a href="http://www.harrynorthover.com/files/flash/ar/assets/Marker.jpg" target="_self" rel="lightbox[680]">marker</a> and run the example. You can either compile the source in the &#8216;src&#8217; folder or just run the SWF in the &#8216;bin-debug&#8217; folder. Hopefully this gives you a idea of what AR/FLARToolkit is all about.</p>
<p>If you can run the example yourself, here is a video of it in action.</p>
<p><object width="612" height="486" data="http://vimeo.com/moogaloop.swf?clip_id=4169730&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1" type="application/x-shockwave-flash"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=4169730&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1" /></object><br />
<a href="http://vimeo.com/4169730">FLARToolkit / Augmented Reality Basic Demo.</a> from <a href="http://vimeo.com/user1592225">Harry Northover</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p>I have also written a base class for a FLARToolkit application. It is designed so that all you have to do is override the function &#8216;<em>add3d()</em>&#8216; to add your 3D objects to &#8216;<em>FLAR_Container</em>&#8221; object, and then override another function, &#8216;<em>addAnimation_3d()</em>&#8216; to add the animation. My description here is very brief so read the <em>readme</em> file in the package. You can download the class <a href="http://harry-northover-code-store.googlecode.com/files/FLARBaseClass.zip" target="_self">here</a>. If you want to see how much code this can reduce then here is an example class using the base class:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> com.harrynorthover.ar.flar.base.FLARSingleMBase;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.filters</span>.<span style="color: #004993;">BlurFilter</span>;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">import</span> org.papervision3d.lights.PointLight3D;
	<span style="color: #0033ff; font-weight: bold;">import</span> org.papervision3d.materials.shadematerials.FlatShadeMaterial;
	<span style="color: #0033ff; font-weight: bold;">import</span> org.papervision3d.materials.utils.MaterialsList;
	<span style="color: #0033ff; font-weight: bold;">import</span> org.papervision3d.objects.primitives.Cube;
&nbsp;
	<span style="color: #000000;">&#91;</span>SWF<span style="color: #000000;">&#40;</span><span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;640&quot;</span>, <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;480&quot;</span>, <span style="color: #004993;">frameRate</span>=<span style="color: #990000;">&quot;30&quot;</span>, <span style="color: #004993;">backgroundColor</span>=<span style="color: #990000;">&quot;#FFFFFF&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Demo_BaseClass_Test extends FLARSingleMBase
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> cube<span style="color: #000000; font-weight: bold;">:</span>Cube;
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Demo_BaseClass_Test<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #3f5fbf;">/*This is the function 'Init' you need to call to setup the FLARToolkit scene.
			     WIDTH, HEIGHT, FRAMERATE*/</span>
			Init<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">640</span>,   <span style="color: #000000; font-weight:bold;">480</span>,    <span style="color: #000000; font-weight:bold;">30</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #3f5fbf;">/*
		...
		This function is the one you need to override
		to add things to your 3D scene.
		*/</span>
&nbsp;
		override <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> add3D<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #009900;">// Add you 3D stuff here. The more the better :-)</span>
			<span style="color: #6699cc; font-weight: bold;">var</span> pl<span style="color: #000000; font-weight: bold;">:</span>PointLight3D = <span style="color: #0033ff; font-weight: bold;">new</span> PointLight3D<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
			pl.z = <span style="color: #000000; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">1000</span>;
			pl.<span style="color: #004993;">y</span> = <span style="color: #000000; font-weight:bold;">1000</span>;
			pl.<span style="color: #004993;">x</span> = <span style="color: #000000; font-weight:bold;">1000</span>;
			pl.flipped = <span style="color: #0033ff; font-weight: bold;">true</span>;	
&nbsp;
			<span style="color: #009900;">//var blurFilter:BlurFilter = new BlurFilter(24, 12, 1);</span>
			<span style="color: #6699cc; font-weight: bold;">var</span> matList<span style="color: #000000; font-weight: bold;">:</span>MaterialsList = <span style="color: #0033ff; font-weight: bold;">new</span> MaterialsList<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
			<span style="color: #6699cc; font-weight: bold;">var</span> fsm<span style="color: #000000; font-weight: bold;">:</span>FlatShadeMaterial = <span style="color: #0033ff; font-weight: bold;">new</span> FlatShadeMaterial<span style="color: #000000;">&#40;</span>pl<span style="color: #000000;">&#41;</span>;
&nbsp;
			matList.addMaterial<span style="color: #000000;">&#40;</span>fsm, <span style="color: #990000;">&quot;all&quot;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
  			cube = <span style="color: #0033ff; font-weight: bold;">new</span> Cube<span style="color: #000000;">&#40;</span>matList, <span style="color: #000000; font-weight:bold;">60</span>, <span style="color: #000000; font-weight:bold;">60</span>, <span style="color: #000000; font-weight:bold;">60</span>, <span style="color: #000000; font-weight:bold;">5</span>, <span style="color: #000000; font-weight:bold;">5</span>, <span style="color: #000000; font-weight:bold;">5</span><span style="color: #000000;">&#41;</span>;
  			<span style="color: #009900;">//cube.useOwnContainer = true;</span>
  			<span style="color: #009900;">//cube.filters = [blurFilter];</span>
&nbsp;
  			<span style="color: #009900;">// FLAR_Container is the FLARBaseNode that you</span>
  			<span style="color: #009900;">// add your 3D objects to.</span>
	        FLAR_Container.<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>cube<span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #3f5fbf;">/*
		...
		This is the function to which you override to add
		your 3D animation.
		*/</span>
&nbsp;
		override <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> addAnimation_3d<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #009900;">//Add you animation here.</span>
			cube.yaw<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">10</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>See? Lots of code that has been got rid of!</p>
<h3>Other demos I have been working on are here:</h3>
<p><strong>FLAR + Lines3D</strong>:</p>
<p><object width="612" height="459" data="http://vimeo.com/moogaloop.swf?clip_id=4172342&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1" type="application/x-shockwave-flash"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=4172342&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1" /></object><br />
<a href="http://vimeo.com/4172342">FLARToolkit and Lines3D / Augmented Reality</a> from <a href="http://vimeo.com/user1592225">Harry Northover</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p><strong>Incorporating <a href="http://code.google.com/p/as3dmod/" target="_blank">AS3DMod</a>:</strong></p>
<p><object width="612" height="459" data="http://vimeo.com/moogaloop.swf?clip_id=4172923&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1" type="application/x-shockwave-flash"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=4172923&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1" /></object><br />
<a href="http://vimeo.com/4172923">FLAR + As3DMod</a> from <a href="http://vimeo.com/harrynorthover">Harry Northover</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p>So there you go, my first few demos. Yes, I know, they are not very special but now I&#8217;m working on getting mutliple markers working and just more advanced demos in general. If you are looking for more advice on how to get set up with FLAR go over to <a href="http://www.mikkoh.com/blog/?p=182" target="_blank">this blog here</a>. This has everything you need to get going. Also, check out <a href="http://www.squidder.com/tag/flartoolkit/" target="_blank">squidder.com for some cool demos</a>.</p>
<p>Happy ARing!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.harrynorthover.com/blog/2009/04/15/getting-started-with-augmented-reality-flartoolkit/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 1.452 seconds -->
