<?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>Smart-Page.net &#187; AFX</title>
	<atom:link href="http://www.smart-page.net/blog/tag/afx/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.smart-page.net/blog</link>
	<description>C++ / C# / Py / Actionscript ... &#039;My God. It&#039;s full of stars!&#039;</description>
	<lastBuildDate>Thu, 23 Jun 2011 00:14:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Realtime SSAO with After Effects and Pixel Bender</title>
		<link>http://www.smart-page.net/blog/2009/10/05/realtime-ssao-with-after-effects-and-pixel-bender/</link>
		<comments>http://www.smart-page.net/blog/2009/10/05/realtime-ssao-with-after-effects-and-pixel-bender/#comments</comments>
		<pubDate>Mon, 05 Oct 2009 07:00:58 +0000</pubDate>
		<dc:creator>flashgordon</dc:creator>
				<category><![CDATA[3D]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[After Effects]]></category>
		<category><![CDATA[AFX]]></category>
		<category><![CDATA[AO]]></category>
		<category><![CDATA[Pixel Bender]]></category>
		<category><![CDATA[Screen Space Ambient Occlusion]]></category>
		<category><![CDATA[Smart SSAO]]></category>
		<category><![CDATA[SSAO]]></category>

		<guid isPermaLink="false">http://www.smart-page.net/blog/?p=471</guid>
		<description><![CDATA[<a href="http://www.smart-page.net/blog/2009/10/05/realtime-ssao-with-after-effects-and-pixel-bender/" title="Realtime SSAO with After Effects and Pixel Bender"><img src="http://www.smart-page.net/blog/wp-content/plugins/yet-another-photoblog/YapbThumbnailer.php?post_id=471&amp;w=200&amp;h=150&amp;zc=1" width="200" height="150" alt="Realtime SSAO with After Effects and Pixel Bender" style="float:left;padding:0 10px 10px 0;" ></a>Screen Space Ambient Occlusion or SSAO is a method to compute an approximated AO pass in real-time! This is done by using the depth information of a 3D object or scene that has been stored from the Z-(depth) buffer of the renderer. Go ahead and try the interactive demo or see a video example! The [...]]]></description>
			<content:encoded><![CDATA[<a href="http://www.smart-page.net/blog/2009/10/05/realtime-ssao-with-after-effects-and-pixel-bender/" title="Realtime SSAO with After Effects and Pixel Bender"><img src="http://www.smart-page.net/blog/wp-content/plugins/yet-another-photoblog/YapbThumbnailer.php?post_id=471&amp;w=200&amp;h=150&amp;zc=1" width="200" height="150" alt="Realtime SSAO with After Effects and Pixel Bender" style="float:left;padding:0 10px 10px 0;" ></a><p>Screen Space Ambient Occlusion or <a href="http://en.wikipedia.org/wiki/Screen_Space_Ambient_Occlusion" target="_blank">SSAO</a> is a method to compute an approximated <a href="http://en.wikipedia.org/wiki/Ambient_occlusion" target="_blank">AO</a> pass in real-time! </p>
<p>This is done by using the depth information of a 3D object or scene that has been stored from the Z-(depth) buffer of the renderer.</p>
<p><b>Go ahead and try the <a href="http://www.smart-page.net/as3/sp_smartssao">interactive demo</a> or see a <a href="http://www.vconverter.de/?file=smartssao" target="_blank">video example!</a></b><br />
<br/><br />
<span id="more-471"></span></p>
<p>The technique was introduced 2007 at Siggraph by <a href="http://www.crytek.com/" target="_blank">Crytek Studios</a> and is becoming an often used feature within next generation live-3d engines or cg/video post applications.</p>
<p>After playing with the ray traced inside-out AO and having to realize that it´s not quite doable with Pixel Blender, I turned to SSAO and quickly got some nice results.</p>
<p>In short it´s all about importance sampling. </p>
<p>SmartSSAO looks up the depth information of 12 surrounding samples and checks if they get occluded to average the AO value.<br />
<img style="margin-top:10px; margin-bottom:5px;" src="http://www.smart-page.net/blog/wp-content/uploads/2009/10/sp_ssao3.jpg" alt="sp_ssao3" title="sp_ssao3" width="680" height="142" class="alignnone size-full wp-image-680" /></p>
<p>The disadvantages lie in the nature of SSAO being &#8220;screen spaced&#8221; which means that it can´t take objects from the off into account, and the result has to be blurred to reduce the inevitable noise.<br />
Also there is no ray bouncing, so classic AO is visually superior &#8211; but hey&#8230; who can argue with &#8220;real-time&#8221;?</p>
<p><strong><a href="http://www.vconverter.de/?file=smartssao2" target="_blank">View another video</a></strong> of the buffer and the solo SSAO pass without/with blurring.<br />
<span style="color: #ff6600;"><em>Please note that those strange looking anomalies on the buddahs arms originate from the badly ranged zmap I produced in a hurry.</em></span><br />
<br/><br />
<strong>To sum it all up:</strong></p>
<p>SSAO makes it possible to have AO in places where it normally isn´t possible &#8211; e.g. real-time engines (yes &#8211; even for Flash/Papervision), or within a video post process.</p>
<p>All that’s needed is the Zbuffer of a 3D rendering.<br />
<br/></p>
<p><strong>You can download the Shader <a href="http://www.smart-page.net/as3/sp_smartssao/SmartSSAO.zip" target="_blank">here </a>or get it packed with an <a href="http://www.smart-page.net/as3/sp_smartssao/SmartSSAO_example.zip" target="_blank">AFX example</a>.<br />
</strong><br/><br />
<i>Hint: As said before, the SSAO pass needs to be blurred in order to clear out the emerging noise &#8211; but don´t overdo it, as the blurring will &#8220;bleed&#8221; the result over to unwanted areas.<br />
This could be targeted by a special SSAO blur filter that would again have to take the depth map into account. </i><br />
<br/><br />
<em><a href="http://www.vconverter.de/?file=smartssao2" target="_blank">Click here to see this screenshot as video</a></em><br/><br />
<strong><img class="alignnone size-full wp-image-504" title="sp_ssao2" src="http://www.smart-page.net/blog/wp-content/uploads/2009/10/sp_ssao2.jpg" alt="sp_ssao2" width="700" height="401" /><br />
</strong></p>
<p><strong><span style="color: #ff6600;"><em><br />
Update:</em></span></strong></p>
<p>I feel like I should adress the X,Y-offset params of the filter which can be used to tweak the &#8220;shadow direction&#8221;.<br />
&#8220;Shadow direction&#8221; in quotes as (SS)AO is all about indirect lightning so this is a real &#8220;tweak&#8221; or an unrealistic param &#8211; which I thought might come in handy in some cases.</p>
<p>I was asked if the shader was performant enaugh for flash &#8211; and even if it looks a bit ugly codewise as I had to get rid of a loop &#8211; it surely is.</p>
<p>So I updated the package and made this small <a href="http://www.smart-page.net/as3/sp_smartssao" target="_blank"><strong>interactive flex demo</strong></a> :</p>
<p><embed style="margin-left:50px;" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" width="570" height="500" src="http://www.smart-page.net/as3/sp_smartssao/SmartSSAO_Shadertest.swf" /><br />
Be sure to try unchecking &#8220;color SSAO?&#8221; and &#8220;show SSAO?&#8221; to get an impression.</p>
<p>You can grab the source <strong><a href="http://www.smart-page.net/as3/sp_smartssao/srcview/index.html" target="_blank">here</a></strong>.</p>
<p><strong><span style="color: #ff6600;"><em><br />
Update 2:</em></span></strong></p>
<p>The filter now features an additional sampling radius parameter which controls the dispersion and allows to adjust it to the desired level of detail &#8211; this should also make it more useable for papervision.</p>
<p>I hope this little experiment will be of use to somebody out there and would love to hear any suggestions.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.smart-page.net/blog/2009/10/05/realtime-ssao-with-after-effects-and-pixel-bender/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

