<?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>Promethe's Blog &#187; 3DS</title>
	<atom:link href="http://blog.promethe.net/tag/3ds/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.promethe.net</link>
	<description>Web, RIAs and chocolate spaghettis...</description>
	<lastBuildDate>Tue, 29 Jun 2010 09:24:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Augmented Reality in Flash 10</title>
		<link>http://blog.promethe.net/2009/10/20/augmented-reality-in-flash-10/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=augmented-reality-in-flash-10</link>
		<comments>http://blog.promethe.net/2009/10/20/augmented-reality-in-flash-10/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 19:55:46 +0000</pubDate>
		<dc:creator>Promethe</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[3DS]]></category>
		<category><![CDATA[Augmented Reality]]></category>
		<category><![CDATA[FLARToolkit]]></category>
		<category><![CDATA[Flash 10]]></category>

		<guid isPermaLink="false">http://blog.promethe.net/?p=496</guid>
		<description><![CDATA[For those who have never heard of "augmented reality" (AR), here is Wikipedia's definition: Augmented reality (AR) is a term for a live direct or indirect view of a physical real-world environment whose elements are merged with (or augmented by) virtual computer-generated imagery - creating a mixed reality. Sounds a bit blury? Well... I'll try [...]]]></description>
			<content:encoded><![CDATA[<p>For those who have never heard of "augmented reality" (AR), here is <a href="http://en.wikipedia.org/wiki/Augmented_reality" target="_target">Wikipedia</a>'s definition:</p>
<blockquote><p>Augmented reality (AR) is a term for a live direct or indirect view of a physical real-world environment whose elements are merged with (or augmented by) virtual computer-generated imagery - creating a mixed reality.</p></blockquote>
<p>Sounds a bit blury? Well... I'll try to make it clearer with a demo...</p>
<h4>Demo</h4>
<p>First, you will have to print a little black and white "marker". The AR software scans the webcam picture and look for this very marker. When it is found, its 3D position, rotation and scale are computed and used to embed a 3D object. You can found the marker <a href="http://blog.promethe.net/wp-content/uploads/2009/10/flarlogo-marker.pdf" target="_blank">here</a> and it looks like this:</p>
<div id="attachment_517" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.promethe.net/wp-content/uploads/2009/10/flarlogo_marker.jpg" rel="shadowbox[post-496];player=img;"><img class="size-full wp-image-517" title="flarlogo_marker" src="http://blog.promethe.net/wp-content/uploads/2009/10/flarlogo_marker.jpg" alt="FLARToolkit Marker" width="300" height="300" /></a><p class="wp-caption-text">FLARToolkit Marker</p></div>
<p><span id="more-496"></span></p>
<p>Then, launch the following application and place the printed marker in front of your camera:</p>
<div id="attachment_505" class="wp-caption aligncenter" style="width: 330px"><a rel="shadowbox[minkoflar];width=640;height=480" href="http://blog.promethe.net/wp-content/uploads/2009/10/MinkoFLARDemo.swf"><img class="size-full wp-image-505" title="FLARToolkit in Flash 10" src="http://blog.promethe.net/wp-content/uploads/2009/10/minkoflar_tekkaman.jpg" alt="FLARToolkit in Flash 10" width="320" height="240" /></a><p class="wp-caption-text">FLARToolkit demo application (webcam required)</p></div>
<h4>What it does...</h4>
<ul>
<li>Load a <a href="http://blog.promethe.net/2009/10/07/quake-2-3d-models-in-flash-10/">MD2 file</a> and a JPEG texture</li>
<li>Loop through the animation of the model</li>
<li>Define multiple materials (press "w" to switch)</li>
<li>Use the <a href="http://www.libspark.org/wiki/saqoosha/FLARToolKit/en" target="_blank">FLARToolkit</a> library for the AR</li>
<li>Translate FLARToolkit matrices to fit the 3D API</li>
</ul>
<h4>How it works</h4>
<ul>
<li>The viewport and a dummy camera are initialized using the camera parameters and the size of the capture</li>
<li>The webcam image is binarized using a threshold filter: aeras that are darker than a threshold value end up completely white on a black background. Areas that are too small or too big are rejected.</li>
<li>Each remaining area is detected and its bounding box and position are computed</li>
<li>For each area that "looks like" a square, the data of what should be the pattern is extracted</li>
<li>This data is then compared to the actual pattern</li>
<li>If the match confidence is above a certain value (80% is this case), a matrix that contains the position/rotation/scale of the center of the marker is computed</li>
<li>This matrix is converted into a native Matrix3D object that can be used as the world transform for the 3D objects we want to display</li>
</ul>
<h4>What it does not do...</h4>
<ul>
<li>Use FLARManager to handle the AR. Lee "<a href="http://theflashblog.com/" target="_blank">The Flash Blog</a>" Brimelow juste made this <a href="http://gotoandlearn.com/play?id=114" target="_blank">excellent tutorial</a> about FLARManager: thank you Lee!</li>
</ul>
<h4>Known Issues</h4>
<p>The FLARToolkit library is very CPU intensive! I looked into it and beside the fact that it is poorly engineered, it looks like the blob extraction algorithm is the bottleneck. Sadly, there is not much to do about it...</p>
<p>It was ported from a Java port of a C++ library called ARToolkit. I never read the original C++ code or its Java port, but the AS3 version seems to be just a straight forward rewriting without much thinking. AS3 native types are totally ignored, if not re-implemented, and the design clearly perspires C++ (and not only because the original code is embeded in comments all over the place...). FLARManager apparently leverages the lack of a proper API.</p>
<p>To put it in a nutshell, FLARToolkit is an impressive tool but it needs a big cleanup!</p>
<h4>Credits</h4>
<ul>
<li><a href="http://mrdoob.com/80/Hi-ReS!_Stats" target="_blank">Framerate counter</a> by <a href="http://mrdoob.com" target="_blank">Mr. Doob</a></li>
<li>Augmented reality using <a href="http://www.libspark.org/wiki/saqoosha/FLARToolKit/en" target="_blank">FLARToolkit</a> by <a href="http://saqoosha.net/en/" target="_blank">Saqoosha</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.promethe.net/2009/10/20/augmented-reality-in-flash-10/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Display Half Life 3D models with Flash 10</title>
		<link>http://blog.promethe.net/2008/12/24/display-half-life-3d-models-with-flash-10/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=display-half-life-3d-models-with-flash-10</link>
		<comments>http://blog.promethe.net/2008/12/24/display-half-life-3d-models-with-flash-10/#comments</comments>
		<pubDate>Wed, 24 Dec 2008 19:40:56 +0000</pubDate>
		<dc:creator>Promethe</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[3DS]]></category>
		<category><![CDATA[demo]]></category>
		<category><![CDATA[DirectFlex]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash 10]]></category>

		<guid isPermaLink="false">http://blog.promethe.net/?p=273</guid>
		<description><![CDATA[UPDATE: you can find a newer version on the DirectFlex Blog. It's been a while since the last post. But I'm back and I decided to release the first DirectFlex demo ever This demo is quite simple and features a 3D model extracted from the famous Half Life 1 add on Counter-Strike 1.6. The model [...]]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff0000;"><strong>UPDATE</strong>: you can find a newer version on the <a href="http://blog.directflex.net/2009/06/11/labs-new-fps-experiment/" target="_blank">DirectFlex Blog</a>.</span></p>
<p>It's been a while since the last post. But I'm back and I decided to release the first DirectFlex demo ever <img src='http://blog.promethe.net/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>This demo is quite simple and features a 3D model extracted from the famous Half Life 1 add on Counter-Strike 1.6. The model is made of "only" 740 polygons, which is not much compared to what DirectFlex can do. Still, being able to display Half Life 1 models inside of Flash with a decent framerate brings hope for future developments. Anyway it is a good proof that DirectFlex is (way) faster than any other Flash 3D "engine" out there... but hey! live demo first and then technical stuff... (<strong><span style="color: #ff0000;">Flash 10 required!</span></strong>)</p>
<p><a rel="shadowbox[dflex_demo];width=640;height=480" href="http://blog.promethe.net/wp-content/uploads/2008/12/fpsdemo.swf"><img class="aligncenter size-medium wp-image-282" title="dflex_fpsdemo_preview1" src="http://blog.promethe.net/wp-content/uploads/2008/12/dflex_fpsdemo_preview1.png" alt="" width="300" height="223" /></a><br />
<span id="more-273"></span></p>
<p><strong>First Person Shooter Camera</strong></p>
<p><strong> </strong>This demo features one of the camera classes provided by DirectFlex: FPSCamera. This camera mimics the behavior of a any "classic" doom-like FPS game. Simple use the arrows/AWSD to walk forward/backward/strafe. You can also use the mouse to look around. Nothing fancy except the camera class itself which is really lightweight and easy to overload: I actually created a GhostCamera class based on the FPSCamera class by just adding 2 lines of code... All the camera classes are based on the same AbstractCamera class which makes it possible and really easy to switch from one camera type to another in real time in your application. I will release another demo to show how simple the code actually is.</p>
<p><strong>3DS Loader</strong></p>
<p><strong></strong>A good opportunity to show the 3DS loader in action. Loading and parsing are obviously really fast. The 3DS file is embed inside the SWF file which of course makes it even faster. The 3DS loader was built using <a href="http://www.spacesimulator.net/tut4_3dsloader.html" target="_blank">this documentation</a>.</p>
<p><strong>Texture Mapping</strong></p>
<p>The texture I used is the original one. I just resized it to make the final SWF file lighter. Nothing crazy about it except that it looks perfectly fine without cutting down the framerate.</p>
<p><strong>Embed Assets</strong></p>
<p>The texture and the 3D model files are embed inside the final SWF file. The mesh and texture class provided by DirectFlex can load such embed assets natively. It is very useful when you just want to redistribute your application without taking care of deploying the assets on a web server and dealing with security issues.</p>
<p><strong>Real Time Lighting</strong></p>
<p>As you can see, the back of the model is completely black. It does not mean that the texture is actually black <img src='http://blog.promethe.net/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  Each polygon is skinned then lighted using a "fake" Phong algorithm. It is a very first draw and a lot of thinking has to be done to make it actually user friendly. Still, because the light and the model are not moving the "real time" part is not really obvious here... I'll try to make it more fancy in the next demo.</p>
<p><strong>About performances</strong></p>
<p>The framerate counter indicates 20-25 frames per second. The application does not force the framerate so the Flash Player runs it at the default framerate (which is supposed to be 24 frames per second). Then, a 20 to 25 frames per second framerate is actually as smooth as it is supposed to be <img src='http://blog.promethe.net/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  It runs perfectly on my Atom 1.6Ghz processor so I guess any decent computer should run it without any performance issue of any kind.</p>
<p><strong>Known issues</strong></p>
<p>The mouse is not handled properly and its sensitivity will depend on the framerate of the application. If your framerate is to high, looking around <em>might</em> be tricky. I know how to fix that but I'm just to lazy to do it for this first demo <img src='http://blog.promethe.net/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>Z-sorting is not (yet) functional and some glitches might appear. I chose the 3D model carefully so that no major visual defects would occur.</p>
<p>Clipping and frustrum culling are not fully implemented. Major artifacts might appear when the model is rendered is the "back" of the camera.</p>
<p><strong>What's next ?</strong></p>
<p>A MD5 (Doom 3 models) loader is on its way and I will certainly try to load Half Life 2 models too. I am currently working with <strong>Alchemy</strong> v0.5a to build a fast C++ implementation of BSP trees to implement an efficient and reliable z-sorting algorithm. I will definitely post about Alchemy and my whole C/C++ to AS3 work. I will also release a very cool <a href="http://en.wikipedia.org/wiki/Heightmap" target="_blank">heightmap</a> demo soon, with some source code to show how user friendly DirectFlex actually is. Other cool demos will follow... Finally, the official DirectFlex blog will be launched soon!</p>
<p>Do not hesitate to post any ideas and comments about how smooth the demo runs on your computer for example.</p>
<p><strong></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.promethe.net/2008/12/24/display-half-life-3d-models-with-flash-10/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
