<?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>decker labs &#187; Experiments</title>
	<atom:link href="http://labs.eric-decker.com/category/experiments/feed/" rel="self" type="application/rss+xml" />
	<link>http://labs.eric-decker.com</link>
	<description></description>
	<lastBuildDate>Fri, 20 Aug 2010 13:32:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>NanoTween</title>
		<link>http://labs.eric-decker.com/2010/07/nanotween/</link>
		<comments>http://labs.eric-decker.com/2010/07/nanotween/#comments</comments>
		<pubDate>Fri, 30 Jul 2010 13:56:15 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Source Code]]></category>
		<category><![CDATA[NanoTween]]></category>
		<category><![CDATA[tween]]></category>

		<guid isPermaLink="false">http://labs.eric-decker.com/?p=423</guid>
		<description><![CDATA[Recently I was working on preloader for a project and needed to use a tweening engine. (We have an internally developed one at Firstborn that is based off of the syntax of Tweener). I wanted to see if I could write my own that would be super small. I wasn&#8217;t as concerned with performance &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I was working on preloader for a project and needed to use a tweening engine. (We have an internally developed one at Firstborn that is based off of the syntax of Tweener). I wanted to see if I could write my own that would be super small. I wasn&#8217;t as concerned with performance &#8211; meaning being able to tween thousands of objects at once, a highly unlikely scenario anyways. I wanted to keep compiled file size down, as well as number of classes. So I created a NanoTween class that is a super simple tweening utility. When compiled on it&#8217;s own, it only consist of about 1.3 Kb.</p>
<p>NanoTween is only one class. Each tween is created as it&#8217;s own more or less independent object. They are however synchronized to a central enter frame event dispatcher, which is kept as a static instance. Instead of providing callback functions and parameters for events such as onComplete and onUpdate (as is the case with some tween engines) NanoTween instead dispatches native Event.COMPLETE and Event.ENTER_FRAME. Additionally, the Robert Penner easing functions are externalized into separate classes to keep filesize down. Special properties such as brightness are not included, but can easily be achieved though an external proxy object.</p>
<p>The syntax looks like this:<br />
var tween:NanoTween = new NanoTween(myMovieClip, 1.5, {x:100, y:200}, Quad.easeOut);<br />
tween.addEventListener(Event.COMPLETE, hndlTweenComplete);<br />
tween.start(1);</p>
<p>The previous example will tween myMovieClip to the position (100,200) over the period of 1.5 seconds using the ease out Quad function, and is delayed by 1 second. Upon completion of the tween the hndlTweenComplete will be called. Likewise, the syntax can also be &#8216;condensed&#8217; for simple tweens:<br />
new NanoTween(myMovieClip, 1, {alpha:0}).start();</p>
<p>Anyhow, I thought it might be useful to other people, and I wanted to try out Google Code so you can grab it from the project page at: <a title="NanoTween on Google Code" href="https://code.google.com/p/nanotween/" target="_blank">https://code.google.com/p/nanotween/</a>. Once again, the purpose of this is not to replace mammoth tween engines such as gTween, TweenMax, or Tweener. Rather, it is intended for special cases where size is the main importance such as preloaders and banner ads.</p>
<p><span id="more-423"></span></p>
<p><script type="text/javascript" src="http://labs.eric-decker.com/wp-content/plugins/pb-embedflash/js/swfobject.js"></script><span class="embedflash" id="swfidc6afd8b26f9b0dea17836d53238e958c"><small>(Please open the article to see the flash file or player.)</small></span><script type="text/javascript">
				var flashvars = {}; var params = {}; var attributes = {};params.allowfullscreen = "true"; params.allowscriptaccess = "always";
				swfobject.embedSWF("http://testing.eric-decker.com/nanoTween/example01.swf","swfidc6afd8b26f9b0dea17836d53238e958c","550","400","9.0.0","http://labs.eric-decker.com/wp-content/plugins/pb-embedflash/swf/expressInstall.swf",flashvars,params,attributes);
		</script></p>
]]></content:encoded>
			<wfw:commentRss>http://labs.eric-decker.com/2010/07/nanotween/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Time Displacement Experiment (part II)</title>
		<link>http://labs.eric-decker.com/2010/03/time-displacement-experiment-part-ii/</link>
		<comments>http://labs.eric-decker.com/2010/03/time-displacement-experiment-part-ii/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 17:19:13 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Pixel Bender]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://labs.eric-decker.com/?p=398</guid>
		<description><![CDATA[I made some updates to my time displacement experiments. I lumped them all into one nice little app, as well as give some options to toggle the effect. I also added the option to choose video source, so it doesn&#8217;t have to be with a webcam anymore. I added the option to tint what area [...]]]></description>
			<content:encoded><![CDATA[<p>I made some updates to my time displacement experiments. I lumped them all into one nice little app, as well as give some options to toggle the effect. I also added the option to choose video source, so it doesn&#8217;t have to be with a webcam anymore. I added the option to tint what area is being effected, as well as experimented with frame blending to try to lessen hard edges. Like the previous post, I&#8217;m still using Pixel Bender to apply the displacement.</p>
<p><a href="http://experiments.eric-decker.com/time_displacement/" target="_blank">experiments.eric-decker.com/time_displacement</a></p>
<p><img class="alignnone size-full wp-image-402" title="thumb01" src="http://labs.eric-decker.com/wp-content/uploads/2010/03/thumb011.jpg" alt="" width="600" height="528" /></p>
<p><span id="more-398"></span><img class="alignnone size-full wp-image-403" title="thumb02" src="http://labs.eric-decker.com/wp-content/uploads/2010/03/thumb021.jpg" alt="" width="600" height="528" /></p>
<p><img class="alignnone size-full wp-image-404" title="thumb03" src="http://labs.eric-decker.com/wp-content/uploads/2010/03/thumb031.jpg" alt="" width="600" height="528" /></p>
]]></content:encoded>
			<wfw:commentRss>http://labs.eric-decker.com/2010/03/time-displacement-experiment-part-ii/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>More Time Displacement Experiments: Now with Pixel Bender</title>
		<link>http://labs.eric-decker.com/2010/03/more-time-displacement-experiments-now-with-pixel-bender/</link>
		<comments>http://labs.eric-decker.com/2010/03/more-time-displacement-experiments-now-with-pixel-bender/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 13:35:07 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Pixel Bender]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://labs.eric-decker.com/?p=391</guid>
		<description><![CDATA[I decided to try using Pixel Bender to do the time displacement in the recent experiments I&#8217;ve been doing, as I was hoping it would perform better. It actually seems to, but there still is a significant lag. However, I&#8217;m pretty sure this is because of having to make a huge sprite sheet first.
I basically [...]]]></description>
			<content:encoded><![CDATA[<p>I decided to try using Pixel Bender to do the time displacement in the recent experiments I&#8217;ve been doing, as I was hoping it would perform better. It actually seems to, but there still is a significant lag. However, I&#8217;m pretty sure this is because of having to make a huge sprite sheet first.</p>
<p>I basically make a huge sprite sheet of all the frames I have saved. Since Flash 10 lets you have bigger bitmaps (16,777,215 pixels total, max dimension at 8,191 <a title="Bit-101" href="http://www.bit-101.com/blog/?p=1426" target="_blank">src</a>) I can create a large image that tiles all the frames I currently have saved. I can have a max of 12 frames across (at 640) and 4 frames down (at 480). So after I create/update this giant bitmap, I send it to a pixel bender filter that is currently applied to a gray scale image. The Pixel Bender filter then looks at each pixel, evaluates the brightness and interpolates it to what frame it needs to update from, then replaces the current pixel with the appropriate one from the selected frame.</p>
<p>These experiments are still a little rough, but I&#8217;ll post &#8216;em anyways. No videos yet, I need to find some time to do screen recordings. The ticker is obviously by <a title="Mr. Doob" href="http://mrdoob.com/blog/post/582" target="_blank">Mr. Doob</a>. You&#8217;ll need a webcam for all of these, sorry.</p>
<ul>
<li><a href="http://experiments.eric-decker.com/video_time_displacement_pb/brightness.html" target="_blank">brightness</a>: Displacement based off of brightness of current frame.</li>
<li><a href="http://experiments.eric-decker.com/video_time_displacement_pb/movement.html" target="_blank">movement</a>: Displacement based off of movement (difference between frames)</li>
<li><a href="http://experiments.eric-decker.com/video_time_displacement_pb/paint.html" target="_blank">painting</a>: Displacement based off area pained by user, as in previous post (inspired by Smudge City).</li>
<li><a href="http://experiments.eric-decker.com/video_time_displacement_pb/noise.html" target="_blank">noise</a>: Displacement based off of perlin noise.</li>
<li><a href="http://experiments.eric-decker.com/video_time_displacement_pb/filmstrip.html" target="_blank">filmstrip</a>: Displacement based off of titled blocks.</li>
</ul>
<p>In any of these experiments, you can right-click to show the source that is controlling the displacement.</p>
]]></content:encoded>
			<wfw:commentRss>http://labs.eric-decker.com/2010/03/more-time-displacement-experiments-now-with-pixel-bender/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Video Time Painting Experiment</title>
		<link>http://labs.eric-decker.com/2010/03/video-time-painting-experiment/</link>
		<comments>http://labs.eric-decker.com/2010/03/video-time-painting-experiment/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 15:06:04 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://labs.eric-decker.com/?p=376</guid>
		<description><![CDATA[I started playing around with doing some experiments with video and time delay. When showing the previously mentioned JPEG video experiment to my coworker Roushey, he mentioned how just the effect of the time delay was interesting. I was thinking about neat things to do with, and the first idea I had was to offset [...]]]></description>
			<content:encoded><![CDATA[<p>I started playing around with doing some experiments with video and time delay. When showing the previously mentioned JPEG video experiment to my coworker <a title="Roushey's Blog" href="http://mroushey.com/blog/" target="_blank">Roushey</a>, he mentioned how just the effect of the time delay was interesting. I was thinking about neat things to do with, and the first idea I had was to offset each frame as one row or column of pixels. So in a 640 x 480 video, the left-most column of pixels would be from the current frame, and the last rightmost column would be from 639 frames ago. The<a title="Time Waves experiment" href="http://experiments.eric-decker.com/webcam_delay_wave/" target="_blank"> experiment is live here</a>, and there&#8217;s a <a title="Video Wave recoring" href="http://www.youtube.com/watch?v=PVR2rUmMVEQ" target="_blank">video of it on YouTube</a>.</p>
<p>I had remember seeing a video (I think it was at FITC &#8216;07) of some really cool video Processing experiments by James Seo (see <a title="Lossless" href="http://www.lossless.net/projects/asynchrony/" target="_blank">Asynchrony Smudge City</a>). He had made an experiment where you could paint a time remap on video. This experiment has always stuck with me, as I always thought it was really well done. So after doing the previous experiment, I thought I would like to try what he had done too, except I choose to do it in Flash (which, I imagine, would make it perform worse than Processing).</p>
<p>It ended up being a fun little project. First, I just paint into a hidden canvas and capture that bitmap data. Then, depending on the number of frames recorded, I break out multiple version of the painting each with a different threshold. I then use this image as an alpha mask via the Layer blend mode to mask out the frame. Lastly, I draw each one to the resulting bitmap, which is displayed. Additionally, since the threshold method is 0 and 1 there are hard edges around each threshold, so I also apply a blur filter (16 x 16, quality 1) to help them blend a little more. This ends up being very taxing, and causes for a lot of slow down. In the demo, you can right-click and toggle this on and off to see the difference for yourself. I also did a version with PixelBender which I need to tweak a little bit, but the performance doesn&#8217;t seem to be that great (although I might be able to optimize it still).</p>
<p>Play with it here: <a title="Webcam Time Painting" href="http://experiments.eric-decker.com/time_remap_painting/" target="_blank">Webcam Time Painting</a>. There are also some video recordings below.</p>
<p><script type="text/javascript" src="http://labs.eric-decker.com/wp-content/plugins/pb-embedflash/js/swfobject.js"></script><span class="embedflash" id="swfidc1b00efade30e19aa279a612e1b781e8"><small>(Please open the article to see the flash file or player.)</small></span><script type="text/javascript">
				var flashvars = {}; var params = {}; var attributes = {};params.allowfullscreen = "true"; params.allowscriptaccess = "always";
				swfobject.embedSWF("http://www.youtube.com/v/8UJwkgFl84Y","swfidc1b00efade30e19aa279a612e1b781e8","425","355","9.0.0","http://labs.eric-decker.com/wp-content/plugins/pb-embedflash/swf/expressInstall.swf",flashvars,params,attributes);
		</script></p>
<p><script type="text/javascript" src="http://labs.eric-decker.com/wp-content/plugins/pb-embedflash/js/swfobject.js"></script><span class="embedflash" id="swfid5010117246c1516b92cd92b7c1674ab7"><small>(Please open the article to see the flash file or player.)</small></span><script type="text/javascript">
				var flashvars = {}; var params = {}; var attributes = {};params.allowfullscreen = "true"; params.allowscriptaccess = "always";
				swfobject.embedSWF("http://www.youtube.com/v/zmMfWK6CaRg","swfid5010117246c1516b92cd92b7c1674ab7","425","355","9.0.0","http://labs.eric-decker.com/wp-content/plugins/pb-embedflash/swf/expressInstall.swf",flashvars,params,attributes);
		</script></p>
]]></content:encoded>
			<wfw:commentRss>http://labs.eric-decker.com/2010/03/video-time-painting-experiment/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>&#8216;Encoding&#8217; Video as JPEG real time in AS3</title>
		<link>http://labs.eric-decker.com/2010/03/encoding-video-as-jpef-real-time-in-as3/</link>
		<comments>http://labs.eric-decker.com/2010/03/encoding-video-as-jpef-real-time-in-as3/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 03:23:33 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://labs.eric-decker.com/?p=371</guid>
		<description><![CDATA[A few days ago I was thinking if there was a way to reproduce the effect of JPEG compression real time in flash. I figured the best way would be to literally encode the image with the native AS3 JPEGEncoder class. The problem there was that the returned ByteArray could not be interpreted as an [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago I was thinking if there was a way to reproduce the effect of JPEG compression real time in flash. I figured the best way would be to literally encode the image with the native AS3 JPEGEncoder class. The problem there was that the returned ByteArray could not be interpreted as an image anymore. However, the Loader class does allow for loading a ByteArray and converting it to a Bitmap. And luckily, the loadBytes method let us load the ByteArray right from Flash (as opposed to having to save out a file and load it externally).</p>
<p>So, applied to a webcam video on an interval, a bitmap data snapshot is taken of the current video frame. Then it is encoded as a JPEG and returned as a ByteArray. The ByteArray is then loaded back into Flash though the loader, which takes a one frame delay, which I imagine is because the loader object probably needs to initialize. Then, the bitmap is extracted from the loader the same way any image is, and the bitmapdata is copied to a display bitmap on the stage, and the cycle loops again.</p>
<p>You&#8217;ll notice a pretty significant delay on the demo. The delay comes from the encoding of the image, not the loading. You can play with the example here: <a href="http://experiments.eric-decker.com/JPEG_compression_webcam/" target="_blank">JPEG Video Experiment</a>. No webcam? There&#8217;s a prerecorded video below.</p>
<p><script type="text/javascript" src="http://labs.eric-decker.com/wp-content/plugins/pb-embedflash/js/swfobject.js"></script><span class="embedflash" id="swfid1edebe037af460e7d17723958dcb7bb5"><small>(Please open the article to see the flash file or player.)</small></span><script type="text/javascript">
				var flashvars = {}; var params = {}; var attributes = {};params.allowfullscreen = "true"; params.allowscriptaccess = "always";
				swfobject.embedSWF("http://www.youtube.com/v/SYvlTaXW9NE","swfid1edebe037af460e7d17723958dcb7bb5","425","355","9.0.0","http://labs.eric-decker.com/wp-content/plugins/pb-embedflash/swf/expressInstall.swf",flashvars,params,attributes);
		</script></p>
]]></content:encoded>
			<wfw:commentRss>http://labs.eric-decker.com/2010/03/encoding-video-as-jpef-real-time-in-as3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Webcam Snapshot Tool</title>
		<link>http://labs.eric-decker.com/2010/02/webcam-snapshot-tool/</link>
		<comments>http://labs.eric-decker.com/2010/02/webcam-snapshot-tool/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 17:04:46 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Photography]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://labs.eric-decker.com/?p=363</guid>
		<description><![CDATA[Every once and a while, I find that I need to just take a quick snapshot with my webcam at work. Since I&#8217;m on a PC, so I don&#8217;t have Apple&#8217;s pre-installed Photobooth app, or any other simple program (that I&#8217;m at least aware of). I also didn&#8217;t want to install any bulky 3rd party [...]]]></description>
			<content:encoded><![CDATA[<p>Every once and a while, I find that I need to just take a quick snapshot with my webcam at work. Since I&#8217;m on a PC, so I don&#8217;t have Apple&#8217;s pre-installed Photobooth app, or any other simple program (that I&#8217;m at least aware of). I also didn&#8217;t want to install any bulky 3rd party software that might come with the webcam that I&#8217;m using, since all I need in order for it to work is the driver, which more or less Windows installed all by itself. Photoshop has an option to capture from webcam, but the util is pretty limited as it only lets me capture a very small thumbnail size image.</p>
<p>So I decided to make a really simple webcam capture utility using Flash. Even if there was some really simple app out there, as I am sure there is, the developer urge inside me just wanted to create one anyways. I figure this way is pretty cool, since all you need is the webcam driver (so that the webcam actually works) and Flash Player 10 installed (which is current at 94% penetration). It&#8217;s just a simple little tool, you can re-size the image and save it as a jpeg. That&#8217;s really all the functionality that I needed from it.</p>
<p>Anyways, you can check it out here:<br />
<a title="Webcam Snapshot Util" href="http://experiments.eric-decker.com/webcam_snapshot/" target="_blank">experiments.eric-decker.com/webcam_snapshot</a></p>
<p>I&#8217;ve also used it to take some macro snapshot, as apparently my webcam can focus insanely close on things, and I&#8217;ve uploaded them to my flickr account:<br />
<a title="Flickr Webcam Macro Shots" href="http://www.flickr.com/photos/ericdecker/sets/72157623403965642/" target="_blank">flickr.com/photos/ericdecker/sets/72157623403965642</a></p>
<p><a href="http://www.flickr.com/photos/ericdecker/sets/72157623403965642/"><img class="alignnone size-full wp-image-368" title="macro_thumbnails" src="http://labs.eric-decker.com/wp-content/uploads/2010/02/macro_thumbnails.png" alt="Macro Thumbnails" width="465" height="231" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://labs.eric-decker.com/2010/02/webcam-snapshot-tool/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Video Processing Tests</title>
		<link>http://labs.eric-decker.com/2009/11/video-processing-tests/</link>
		<comments>http://labs.eric-decker.com/2009/11/video-processing-tests/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 15:14:43 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://labs.eric-decker.com/?p=344</guid>
		<description><![CDATA[Recently I did some playing around with video and thresholds, mostly just for fun. I first experimented with just changing the threshold of the video, essentially converting it to black and white. Then I tried comparing the current frame threshold and the previous frame threshold to get the difference. The result looks like an outline/edge [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I did some playing around with video and thresholds, mostly just for fun. I first experimented with just changing the threshold of the video, essentially converting it to black and white. Then I tried comparing the current frame threshold and the previous frame threshold to get the difference. The result looks like an outline/edge effect. It&#8217;s an interesting way to visualize movement. Then, just for kicks, I decided to display the previous comparison and the current one, colorizing the current difference as red and the previous as cyan. The result is a very pseudo-3D outline effect. This fake 3D technique can also be applied to to straight up video, showing the previous frame as cyan and the current as red and screening the two. Since this all based on movement and the idea that objects closer to the camera appear to move greater distances due to their perspective, it&#8217;s very easy for it to display incorrectly.</p>
<p><img class="alignnone size-full wp-image-346" title="video_test_threshold" src="http://labs.eric-decker.com/wp-content/uploads/2009/11/video_test_threshold.jpg" alt="video_test_threshold" width="320" height="240" /> <img class="alignnone size-full wp-image-347" title="video_test_3d_outlines" src="http://labs.eric-decker.com/wp-content/uploads/2009/11/video_test_3d_outlines.jpg" alt="video_test_3d_outlines" width="320" height="240" /></p>
<p>Check out the<a title="Video Test #1" href="http://testing.eric-decker.com/video_test_1/" target="_blank"> first demo</a>. You&#8217;ll need a webcam. Click on the video to change the mode, and the two scroll bars control the threshold level and amount of blur applied to the video before any image processing.</p>
<p>I then noticed that while changing the threshold, it almost seemed like it was displaying different depth passes on the video. Of course, this has nothing to do with depth, but rather brightness. Still, I wanted to see what it would look like if I broke out multiple thresholds of the same frame and layered them in 3D. The result, although unpractical, still looks pretty cool.</p>
<p><img class="alignnone size-full wp-image-348" title="video_3d_1" src="http://labs.eric-decker.com/wp-content/uploads/2009/11/video_3d_1.jpg" alt="video_3d_1" width="404" height="335" /><img class="alignnone size-full wp-image-349" title="video_3d_2" src="http://labs.eric-decker.com/wp-content/uploads/2009/11/video_3d_2.jpg" alt="video_3d_2" width="404" height="335" /></p>
<p>Check out the<a title="Video Test #2" href="http://testing.eric-decker.com/video_test_2/" target="_blank"> second demo</a>. There&#8217;s different options on the left and two scroll bars at the bottom that control layer transparency and amount of blur applied to the video before any image processing.</p>
]]></content:encoded>
			<wfw:commentRss>http://labs.eric-decker.com/2009/11/video-processing-tests/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>3D Engine Update 3: Shading improvements</title>
		<link>http://labs.eric-decker.com/2009/08/3d-engine-update-3-shading-improvements/</link>
		<comments>http://labs.eric-decker.com/2009/08/3d-engine-update-3-shading-improvements/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 14:22:38 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[3D]]></category>
		<category><![CDATA[3D Engine]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://labs.eric-decker.com/?p=277</guid>
		<description><![CDATA[So over the last week or so, I restructured my 3D engine. Nothing that would be visibly noticeable, but I feel better about where it is at right now. What I like about it, though, is that it is still not what would be probably considered &#8220;the right way&#8221; to do it. The reason I [...]]]></description>
			<content:encoded><![CDATA[<p>So over the last week or so, I restructured my 3D engine. Nothing that would be visibly noticeable, but I feel better about where it is at right now. What I like about it, though, is that it is still not what would be probably considered &#8220;the right way&#8221; to do it. The reason I am happy about this is that it makes it my own, and I understand exactly why and how it works. Once I have a really solid understanding, then I can move towards doing it the &#8220;correct way,&#8221; but for now, my little hacked together experiment makes me happy.</p>
<p>One of the changes I did make is to the shaders. I added a PseudoGouraudShader, which uses gradients to draw each polygon face to try and smooth out the hard lines created by using a flat shader. I doubt this method would ever produce 100% accurate results that are identical to a gouraud shader, but it makes for interesting results. The method I am using is pretty slow, as it needs to draw each face four times, three of them being gradient fills. Each vertex&#8217;s normal is calculated from the sum of all the faces it is a part of, and that brightness value is used to draw a radial gradient on that face, the center point being the vertex. (Two examples: <a href="http://testing.eric-decker.com/3d_engine/016/" target="_blank">RGB example</a> and <a href="http://testing.eric-decker.com/3d_engine/017/" target="_blank">dot example</a>, the circle areas are &#8216;painted&#8217; on via gradient fill) This can produce some <a href="http://testing.eric-decker.com/3d_engine/015/" target="_blank">fun effects</a> too when played with.</p>
<p>I had an example of the PseudoGouraudShader last week, but it was off, it looked like alternating faces had different brightness values. Just playing around last night I found the issue, it lies with how I was calculating my normal.  When getting the cross product of the vectors, it is better to normalize the result instead of normalizing the vector before. The example below shows the two results and code snippets:</p>
<p><a href="http://testing.eric-decker.com/3d_engine/img/normal_result.jpg"><img class="alignnone" src="http://testing.eric-decker.com/3d_engine/img/normal_result.jpg" alt="" width="600" height="446" /></a></p>
<p>Still not perfect, but I&#8217;m not sure how close I can get using this method. I think there might still be some slight errors in the core math, which could be producing the results that look similar to the image on the left (although less intense). You can check out the<a href="http://testing.eric-decker.com/3d_engine/014/" target="_blank"> live demo here</a>.</p>
<p>On a last note, calculating normals and centroid over and over again for rendering can get pretty intense. In the case like this, the same normal gets calculated multiple times a render even though it hasn&#8217;t changed (because each vertex needs to get the normal of each face it is connect to). In order to boost speed, I created a caching system. When the normal is calculated, it saves it to a &#8220;stale normal&#8221; and updates an object (which I called the cached face) that tracks the position of each vertex in the face. Then, the next time the normal is called, if that cached face is not different then the real one, it just uses the stale normal instead of re-calculating.</p>
]]></content:encoded>
			<wfw:commentRss>http://labs.eric-decker.com/2009/08/3d-engine-update-3-shading-improvements/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using RGB Channels to Compress Multiple Grayscale Images</title>
		<link>http://labs.eric-decker.com/2009/08/using-rgb-channels-to-compress-multiple-grayscale-images/</link>
		<comments>http://labs.eric-decker.com/2009/08/using-rgb-channels-to-compress-multiple-grayscale-images/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 04:26:58 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://labs.eric-decker.com/?p=257</guid>
		<description><![CDATA[Another experiment recently did was compress three grayscale images into one file. The reason for this would be of course file size and load time. A real-case scenario where you might need to load 3 grayscale images of the same size is loading textures for a 3D app. For instance, your model might be color [...]]]></description>
			<content:encoded><![CDATA[<p>Another experiment recently did was compress three grayscale images into one file. The reason for this would be of course file size and load time. A real-case scenario where you might need to load 3 grayscale images of the same size is loading textures for a 3D app. For instance, your model might be color dynamically, but you need to load a diffuse map, a specular map, and a bump map &#8211; all of these would be the same dimension and would be black  and white.</p>
<p>So all you need to do is take your three grayscale images into photoshop and layer them on top of one another. Then use the gradient map image adjustment to have each image range from red, green, or blue to black. Have the base layer be flat black, and set each of the three layers to screen. Then, once that image is loaded into Flash, you can extract each color channel and set it back to black and white with the ColorMatrixFilter. You just need to set the matrix so that each of the R,G,B rows are [0,0,0,0,255] and the last row (the alpha) is [1,0,0,0,0] for red, [0,1,0,0,0] for green, or [0,0,1,0,0] for blue. The just smoosh that transparent white image into a black bitmap, and you&#8217;re set.</p>
<p>Again, not entirely useful for every day cases, and it does cut down on how easy and dynamic the loaded content is, but if you&#8217;re hurting due to file size and load time, this could be something to keep in mind. In case you&#8217;re wondering – the layered color image I used in my example is 188 KB, and the blue channel saved as its own grayscale file is 132 KB.</p>
<div id="attachment_259" class="wp-caption alignnone" style="width: 430px"><a href="http://testing.eric-decker.com/rgb/" target="_blank"><img class="size-full wp-image-259" title="rgb" src="http://labs.eric-decker.com/wp-content/uploads/2009/08/rgb.jpg" alt="RGB layered image and the 3 channels as their own grayscale image" width="420" height="420" /></a><p class="wp-caption-text">RGB layered image and the 3 channels as their own grayscale image</p></div>
]]></content:encoded>
			<wfw:commentRss>http://labs.eric-decker.com/2009/08/using-rgb-channels-to-compress-multiple-grayscale-images/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Text to Image Transcoding</title>
		<link>http://labs.eric-decker.com/2009/08/text-to-image-transcoding/</link>
		<comments>http://labs.eric-decker.com/2009/08/text-to-image-transcoding/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 02:10:30 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://labs.eric-decker.com/?p=249</guid>
		<description><![CDATA[Playing around in Flash making a &#8216;image encoder&#8217; that converts text into image, or String into BitmapData. Basically, I wanted to convert each character into binary, and then represent it as an image. So the first thing I did was have each character assigned a number, and then convert that into binary. Since I wanted [...]]]></description>
			<content:encoded><![CDATA[<p>Playing around in Flash making a &#8216;image encoder&#8217; that converts text into image, or String into BitmapData. Basically, I wanted to convert each character into binary, and then represent it as an image. So the first thing I did was have each character assigned a number, and then convert that into binary. Since I wanted to control what characters could be encoded, I created an array of the characters I wanted (instead of using the charCode) and used the index of the character as it&#8217;s id. Each character is converted into a 7-digit binary value (this value was based off of the array length) and then each digit is written to bitmap data, 0 as black and 1 as white.</p>
<p>I tried the same thing, but except with a color image. Instead of having 7 pixels representing a character, I used one pixel per character, converting each charCode into a hex value. The result is that the image is all blue, as the common used character codes are all under 255. Not a very useful exercise, but it was still sort of fun, as was converting a number into binary &#8220;manually.&#8221; (It involves a lot of use of modulo. )</p>
<p>The image bellow is the first chapter of Lewis Carroll&#8217;s Alice in Wonderland encoded into an image. Note: I chose Alice in Wonderland because it is copyright free, not because of the new trailer for Tim Burton movie. There&#8217;s a <a href="http://testing.eric-decker.com/alice/" target="_blank">larger example</a> here with the color image as well.</p>
<p><img class="alignnone size-full wp-image-250" title="alice" src="http://labs.eric-decker.com/wp-content/uploads/2009/08/alice.jpg" alt="alice" width="600" height="132" /></p>
]]></content:encoded>
			<wfw:commentRss>http://labs.eric-decker.com/2009/08/text-to-image-transcoding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
