<?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>Game Rendering &#187; Special Effects</title>
	<atom:link href="http://www.gamerendering.com/tag/special-effects/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gamerendering.com</link>
	<description></description>
	<lastBuildDate>Thu, 21 Jan 2010 01:32:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Wavelet Turbulence for Fluid Simulation</title>
		<link>http://www.gamerendering.com/2009/03/26/wavelet-turbulence-for-fluid-simulation/</link>
		<comments>http://www.gamerendering.com/2009/03/26/wavelet-turbulence-for-fluid-simulation/#comments</comments>
		<pubDate>Thu, 26 Mar 2009 00:03:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Smoke]]></category>
		<category><![CDATA[Realtime]]></category>
		<category><![CDATA[Simulation]]></category>
		<category><![CDATA[Special]]></category>
		<category><![CDATA[Special Effects]]></category>

		<guid isPermaLink="false">http://www.gamerendering.com/?p=606</guid>
		<description><![CDATA[This is a new and interesting way to add more detail to simulated fluids like smoke. Even if it&#8217;s far from realtime, some idea´s might be useful in games too.

 The link to the paper:
http://www.cs.cornell.edu/~tedkim/WTURB/wavelet_turbulence.pdf



Please share:


	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	


]]></description>
			<content:encoded><![CDATA[<p>This is a new and interesting way to add more detail to simulated fluids like smoke. Even if it&#8217;s far from realtime, some idea´s might be useful in games too.</p>
<div class="mceTemp"><a href="http://www.cs.cornell.edu/~tedkim/WTURB/sphere.jpg"><img class=" " title="Smoke Simulation" src="http://www.cs.cornell.edu/~tedkim/WTURB/sphere.jpg" alt="Smoke Simulation" width="480" height="360" /></a></div>
<p> The link to the paper:</p>
<p><a href="http://www.cs.cornell.edu/~tedkim/WTURB/wavelet_turbulence.pdf">http://www.cs.cornell.edu/~tedkim/WTURB/wavelet_turbulence.pdf</a></p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Please share:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow" id="print" href="javascript:window.location='http%3A%2F%2Fwww.printfriendly.com%2Fprint%3Furl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2009%252F03%252F26%252Fwavelet-turbulence-for-fluid-simulation%252F%26amp%3Bpartner%3Dsociable';" title="Print this article!"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print this article!" alt="Print this article!" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="digg" href="javascript:window.location='http%3A%2F%2Fdigg.com%2Fsubmit%3Fphase%3D2%26amp%3Burl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2009%252F03%252F26%252Fwavelet-turbulence-for-fluid-simulation%252F%26amp%3Btitle%3DWavelet%2520Turbulence%2520for%2520Fluid%2520Simulation%2520%26amp%3Bbodytext%3DThis%2520is%2520a%2520new%2520and%2520interesting%2520way%2520to%2520add%2520more%2520detail%2520to%2520simulated%2520fluids%2520like%2520smoke.%2520Even%2520if%2520it%2527s%2520far%2520from%2520realtime%252C%2520some%2520idea%25C2%25B4s%2520might%2520be%2520useful%2520in%2520games%2520too.%250D%250A%250D%250A%25C2%25A0The%2520link%2520to%2520the%2520paper%253A%250D%250A%250D%250Ahttp%253A%252F%252Fwww.cs.cornell.edu%252F%257Etedkim%252FWTURB%252Fwavelet_turbulence.';" title="Digg"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="sphinn" href="javascript:window.location='http%3A%2F%2Fsphinn.com%2Findex.php%3Fc%3Dpost%26m%3Dsubmit%26link%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2009%252F03%252F26%252Fwavelet-turbulence-for-fluid-simulation%252F';" title="Sphinn"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="del.icio.us" href="javascript:window.location='http%3A%2F%2Fdelicious.com%2Fpost%3Furl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2009%252F03%252F26%252Fwavelet-turbulence-for-fluid-simulation%252F%26amp%3Btitle%3DWavelet%2520Turbulence%2520for%2520Fluid%2520Simulation%2520%26amp%3Bnotes%3DThis%2520is%2520a%2520new%2520and%2520interesting%2520way%2520to%2520add%2520more%2520detail%2520to%2520simulated%2520fluids%2520like%2520smoke.%2520Even%2520if%2520it%2527s%2520far%2520from%2520realtime%252C%2520some%2520idea%25C2%25B4s%2520might%2520be%2520useful%2520in%2520games%2520too.%250D%250A%250D%250A%25C2%25A0The%2520link%2520to%2520the%2520paper%253A%250D%250A%250D%250Ahttp%253A%252F%252Fwww.cs.cornell.edu%252F%257Etedkim%252FWTURB%252Fwavelet_turbulence.';" title="del.icio.us"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="facebook" href="javascript:window.location='http%3A%2F%2Fwww.facebook.com%2Fshare.php%3Fu%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2009%252F03%252F26%252Fwavelet-turbulence-for-fluid-simulation%252F%26amp%3Bt%3DWavelet%2520Turbulence%2520for%2520Fluid%2520Simulation%2520';" title="Facebook"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="mixx" href="javascript:window.location='http%3A%2F%2Fwww.mixx.com%2Fsubmit%3Fpage_url%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2009%252F03%252F26%252Fwavelet-turbulence-for-fluid-simulation%252F%26amp%3Btitle%3DWavelet%2520Turbulence%2520for%2520Fluid%2520Simulation%2520';" title="Mixx"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="google" href="javascript:window.location='http%3A%2F%2Fwww.google.com%2Fbookmarks%2Fmark%3Fop%3Dedit%26amp%3Bbkmk%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2009%252F03%252F26%252Fwavelet-turbulence-for-fluid-simulation%252F%26amp%3Btitle%3DWavelet%2520Turbulence%2520for%2520Fluid%2520Simulation%2520%26amp%3Bannotation%3DThis%2520is%2520a%2520new%2520and%2520interesting%2520way%2520to%2520add%2520more%2520detail%2520to%2520simulated%2520fluids%2520like%2520smoke.%2520Even%2520if%2520it%2527s%2520far%2520from%2520realtime%252C%2520some%2520idea%25C2%25B4s%2520might%2520be%2520useful%2520in%2520games%2520too.%250D%250A%250D%250A%25C2%25A0The%2520link%2520to%2520the%2520paper%253A%250D%250A%250D%250Ahttp%253A%252F%252Fwww.cs.cornell.edu%252F%257Etedkim%252FWTURB%252Fwavelet_turbulence.';" title="Google Bookmarks"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="current" href="javascript:window.location='http%3A%2F%2Fcurrent.com%2Fclipper.htm%3Furl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2009%252F03%252F26%252Fwavelet-turbulence-for-fluid-simulation%252F%26amp%3Btitle%3DWavelet%2520Turbulence%2520for%2520Fluid%2520Simulation%2520';" title="Current"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/current.png" title="Current" alt="Current" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="linkedin" href="javascript:window.location='http%3A%2F%2Fwww.linkedin.com%2FshareArticle%3Fmini%3Dtrue%26amp%3Burl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2009%252F03%252F26%252Fwavelet-turbulence-for-fluid-simulation%252F%26amp%3Btitle%3DWavelet%2520Turbulence%2520for%2520Fluid%2520Simulation%2520%26amp%3Bsource%3DGame%2BRendering%2B%26amp%3Bsummary%3DThis%2520is%2520a%2520new%2520and%2520interesting%2520way%2520to%2520add%2520more%2520detail%2520to%2520simulated%2520fluids%2520like%2520smoke.%2520Even%2520if%2520it%2527s%2520far%2520from%2520realtime%252C%2520some%2520idea%25C2%25B4s%2520might%2520be%2520useful%2520in%2520games%2520too.%250D%250A%250D%250A%25C2%25A0The%2520link%2520to%2520the%2520paper%253A%250D%250A%250D%250Ahttp%253A%252F%252Fwww.cs.cornell.edu%252F%257Etedkim%252FWTURB%252Fwavelet_turbulence.';" title="LinkedIn"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="live" href="javascript:window.location='https%3A%2F%2Ffavorites.live.com%2Fquickadd.aspx%3Fmarklet%3D1%26amp%3Burl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2009%252F03%252F26%252Fwavelet-turbulence-for-fluid-simulation%252F%26amp%3Btitle%3DWavelet%2520Turbulence%2520for%2520Fluid%2520Simulation%2520';" title="Live"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="myspace" href="javascript:window.location='http%3A%2F%2Fwww.myspace.com%2FModules%2FPostTo%2FPages%2F%3Fu%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2009%252F03%252F26%252Fwavelet-turbulence-for-fluid-simulation%252F%26amp%3Bt%3DWavelet%2520Turbulence%2520for%2520Fluid%2520Simulation%2520';" title="MySpace"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="netvibes" href="javascript:window.location='http%3A%2F%2Fwww.netvibes.com%2Fshare%3Ftitle%3DWavelet%2520Turbulence%2520for%2520Fluid%2520Simulation%2520%26amp%3Burl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2009%252F03%252F26%252Fwavelet-turbulence-for-fluid-simulation%252F';" title="Netvibes"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="stumbleupon" href="javascript:window.location='http%3A%2F%2Fwww.stumbleupon.com%2Fsubmit%3Furl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2009%252F03%252F26%252Fwavelet-turbulence-for-fluid-simulation%252F%26amp%3Btitle%3DWavelet%2520Turbulence%2520for%2520Fluid%2520Simulation%2520';" title="StumbleUpon"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="twitter" href="javascript:window.location='http%3A%2F%2Ftwitter.com%2Fhome%3Fstatus%3DWavelet%2520Turbulence%2520for%2520Fluid%2520Simulation%2520%2520-%2520http%253A%252F%252Fwww.gamerendering.com%252F2009%252F03%252F26%252Fwavelet-turbulence-for-fluid-simulation%252F';" title="Twitter"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="reddit" href="javascript:window.location='http%3A%2F%2Freddit.com%2Fsubmit%3Furl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2009%252F03%252F26%252Fwavelet-turbulence-for-fluid-simulation%252F%26amp%3Btitle%3DWavelet%2520Turbulence%2520for%2520Fluid%2520Simulation%2520';" title="Reddit"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="technorati" href="javascript:window.location='http%3A%2F%2Ftechnorati.com%2Ffaves%3Fadd%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2009%252F03%252F26%252Fwavelet-turbulence-for-fluid-simulation%252F';" title="Technorati"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow" id="yahoo! bookmarks" href="javascript:window.location='http%3A%2F%2Fbookmarks.yahoo.com%2Ftoolbar%2Fsavebm%3Fu%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2009%252F03%252F26%252Fwavelet-turbulence-for-fluid-simulation%252F%26amp%3Bt%3DWavelet%2520Turbulence%2520for%2520Fluid%2520Simulation%2520%26opener%3Dbm%26amp%3Bei%3DUTF-8%26amp%3Bd%3DThis%2520is%2520a%2520new%2520and%2520interesting%2520way%2520to%2520add%2520more%2520detail%2520to%2520simulated%2520fluids%2520like%2520smoke.%2520Even%2520if%2520it%2527s%2520far%2520from%2520realtime%252C%2520some%2520idea%25C2%25B4s%2520might%2520be%2520useful%2520in%2520games%2520too.%250D%250A%250D%250A%25C2%25A0The%2520link%2520to%2520the%2520paper%253A%250D%250A%250D%250Ahttp%253A%252F%252Fwww.cs.cornell.edu%252F%257Etedkim%252FWTURB%252Fwavelet_turbulence.';" title="Yahoo! Bookmarks"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="Yahoo! Bookmarks" alt="Yahoo! Bookmarks" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.gamerendering.com/2009/03/26/wavelet-turbulence-for-fluid-simulation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSAO</title>
		<link>http://www.gamerendering.com/2009/01/14/ssao/</link>
		<comments>http://www.gamerendering.com/2009/01/14/ssao/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 19:55:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SSAO]]></category>
		<category><![CDATA[Screen Space]]></category>
		<category><![CDATA[Screen Space Ambient Occlusion]]></category>
		<category><![CDATA[Special Effects]]></category>

		<guid isPermaLink="false">http://www.gamerendering.com/?p=569</guid>
		<description><![CDATA[This is my SSAO (Screen Space Ambient Occlusion) implementation and it&#8217;s both fast and gives good result. It&#8217;s inspired by the Crysis SSAO algorithm but also the Starcraft II implementation and a little from Nvidia&#8217;s implementation.
To use the SSAO shader, render a fullscreen quad with the SSAO shader applied to it. This shader will trace 10-16 [...]]]></description>
			<content:encoded><![CDATA[<p>This is my SSAO (Screen Space Ambient Occlusion) implementation and it&#8217;s both fast and gives good result. It&#8217;s inspired by the Crysis SSAO algorithm but also the Starcraft II implementation and a little from Nvidia&#8217;s implementation.</p>
<p class="western" lang="en-GB">To use the SSAO shader, render a fullscreen quad with the SSAO shader applied to it. This shader will trace 10-16 rays for every fragment (pixel when there are no multi-sampling) on the screen. The rays are shot in a random direction in a hemisphere around the normal of the current fragment. By doing texture lookups, the depth and the normals are compared between the current fragment and the traced ones. The comparison is a simple step-formula and from the result a SSAO term can be evaluated. This SSAO term is saved to the red channel to the texture. This result must be blurred before combined with the original scene render. The blur can for example be a bilateral blur. Both the SSAO term, and the blurring can be done in a much lower resolution (half or fourth the size) than the screen to save some clock cycles. Then after blurring, one can upsample it to full screen size and get a some blur for free.</p>
<p class="western" lang="en-GB">The combination with the original screen can be as simple as just multiplying this AO term with the already rendered screen.</p>
<p><a href="http://www.gamerendering.com/wp-content/uploads/ssaocomp.jpg"><img class="size-medium wp-image-570" title="SSAO enabled on the left, SSAO disabled on the right" src="http://www.gamerendering.com/wp-content/uploads/ssaocomp-400x148.jpg" alt="SSAO enabled on the left, SSAO disabled on the right" width="400" height="148" /></a></p>
<div class="mceTemp">The shader is written to save the AO in the red channel so render it to a single-channel texture to save memory.</div>
<div class="mceTemp">
<div class="mceTemp"><a href="http://www.gamerendering.com/wp-content/uploads/myred.jpg"><img class="size-medium wp-image-583" title="The SSAO term is saved only in the red channel" src="http://www.gamerendering.com/wp-content/uploads/myred-400x301.jpg" alt="The SSAO term is saved only in the red channel" width="400" height="301" /></a></div>
<div class="mceTemp">The shader requires that the normalMap sampler holds a renderable texture with the normals of the scene in screen space in the RGB channels, and the linear depth (scaled to 0..1) in the A-channel. NOTE: These maps are not the same maps as when doing deferred lighting. For example, the normals should be pure face normals rendered to the screen (no normalmapping).</div>
<div class="mceTemp">The rnm sampler should hold a texture with random normals in the RGB-channel, and can for example be the picture below.</div>
<div class="mceTemp">
<div class="mceTemp"><a href="http://www.gamerendering.com/wp-content/uploads/noise.png"><img class="size-medium wp-image-585" title="Random normals" src="http://www.gamerendering.com/wp-content/uploads/noise.png" alt="Random normals" width="64" height="64" /></a></div>
</div>
</div>
<p>These are the properties that worked well for me (but it&#8217;s different from setup to setup what gives best result):</p>

<div class="wp_codebox"><table width="100%" ><tr id="p5695"><td class="code" id="p569code5"><pre class="c" style="font-family:monospace;">uniform <span style="color: #993333;">float</span> totStrength <span style="color: #339933;">=</span> <span style="color:#800080;">1.38</span><span style="color: #339933;">;</span>
uniform <span style="color: #993333;">float</span> strength <span style="color: #339933;">=</span> <span style="color:#800080;">0.07</span><span style="color: #339933;">;</span>
uniform <span style="color: #993333;">float</span> offset <span style="color: #339933;">=</span> <span style="color:#800080;">18.0</span><span style="color: #339933;">;</span>
uniform <span style="color: #993333;">float</span> falloff <span style="color: #339933;">=</span> <span style="color:#800080;">0.000002</span><span style="color: #339933;">;</span>
uniform <span style="color: #993333;">float</span> rad <span style="color: #339933;">=</span> <span style="color:#800080;">0.006</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Here&#8217;s the SSAO GLSL fragment shader:</p>

<div class="wp_codebox"><table width="100%" ><tr id="p5696"><td class="code" id="p569code6"><pre class="c" style="font-family:monospace;">uniform sampler2D rnm<span style="color: #339933;">;</span>
uniform sampler2D normalMap<span style="color: #339933;">;</span>
varying vec2 uv<span style="color: #339933;">;</span>
uniform <span style="color: #993333;">float</span> totStrength<span style="color: #339933;">;</span>
uniform <span style="color: #993333;">float</span> strength<span style="color: #339933;">;</span>
uniform <span style="color: #993333;">float</span> offset<span style="color: #339933;">;</span>
uniform <span style="color: #993333;">float</span> falloff<span style="color: #339933;">;</span>
uniform <span style="color: #993333;">float</span> rad<span style="color: #339933;">;</span>
<span style="color: #339933;">#define SAMPLES 16 // 10 is good</span>
<span style="color: #993333;">const</span> <span style="color: #993333;">float</span> invSamples <span style="color: #339933;">=</span> <span style="color:#800080;">1.0</span><span style="color: #339933;">/</span><span style="color:#800080;">16.0</span><span style="color: #339933;">;</span>
<span style="color: #993333;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;">// these are the random vectors inside a unit sphere</span>
vec3 pSphere<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">16</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> vec3<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#40;</span>vec3<span style="color: #009900;">&#40;</span><span style="color:#800080;">0.53812504</span><span style="color: #339933;">,</span> <span style="color:#800080;">0.18565957</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color:#800080;">0.43192</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>vec3<span style="color: #009900;">&#40;</span><span style="color:#800080;">0.13790712</span><span style="color: #339933;">,</span> <span style="color:#800080;">0.24864247</span><span style="color: #339933;">,</span> <span style="color:#800080;">0.44301823</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>vec3<span style="color: #009900;">&#40;</span><span style="color:#800080;">0.33715037</span><span style="color: #339933;">,</span> <span style="color:#800080;">0.56794053</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color:#800080;">0.005789503</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>vec3<span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span><span style="color:#800080;">0.6999805</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color:#800080;">0.04511441</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color:#800080;">0.0019965635</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>vec3<span style="color: #009900;">&#40;</span><span style="color:#800080;">0.06896307</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color:#800080;">0.15983082</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color:#800080;">0.85477847</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>vec3<span style="color: #009900;">&#40;</span><span style="color:#800080;">0.056099437</span><span style="color: #339933;">,</span> <span style="color:#800080;">0.006954967</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color:#800080;">0.1843352</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>vec3<span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span><span style="color:#800080;">0.014653638</span><span style="color: #339933;">,</span> <span style="color:#800080;">0.14027752</span><span style="color: #339933;">,</span> <span style="color:#800080;">0.0762037</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>vec3<span style="color: #009900;">&#40;</span><span style="color:#800080;">0.010019933</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color:#800080;">0.1924225</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color:#800080;">0.034443386</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>vec3<span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span><span style="color:#800080;">0.35775623</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color:#800080;">0.5301969</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color:#800080;">0.43581226</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>vec3<span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span><span style="color:#800080;">0.3169221</span><span style="color: #339933;">,</span> <span style="color:#800080;">0.106360726</span><span style="color: #339933;">,</span> <span style="color:#800080;">0.015860917</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>vec3<span style="color: #009900;">&#40;</span><span style="color:#800080;">0.010350345</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color:#800080;">0.58698344</span><span style="color: #339933;">,</span> <span style="color:#800080;">0.0046293875</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>vec3<span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span><span style="color:#800080;">0.08972908</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color:#800080;">0.49408212</span><span style="color: #339933;">,</span> <span style="color:#800080;">0.3287904</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>vec3<span style="color: #009900;">&#40;</span><span style="color:#800080;">0.7119986</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color:#800080;">0.0154690035</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color:#800080;">0.09183723</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>vec3<span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span><span style="color:#800080;">0.053382345</span><span style="color: #339933;">,</span> <span style="color:#800080;">0.059675813</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color:#800080;">0.5411899</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>vec3<span style="color: #009900;">&#40;</span><span style="color:#800080;">0.035267662</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color:#800080;">0.063188605</span><span style="color: #339933;">,</span> <span style="color:#800080;">0.54602677</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>vec3<span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span><span style="color:#800080;">0.47761092</span><span style="color: #339933;">,</span> <span style="color:#800080;">0.2847911</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color:#800080;">0.0271716</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//const vec3 pSphere[8] = vec3[](vec3(0.24710192, 0.6445882, 0.033550154),vec3(0.00991752, -0.21947019, 0.7196721),vec3(0.25109035, -0.1787317, -0.011580509),vec3(-0.08781511, 0.44514698, 0.56647956),vec3(-0.011737816, -0.0643377, 0.16030222),vec3(0.035941467, 0.04990871, -0.46533614),vec3(-0.058801126, 0.7347013, -0.25399926),vec3(-0.24799341, -0.022052078, -0.13399573));</span>
<span style="color: #666666; font-style: italic;">//const vec3 pSphere[12] = vec3[](vec3(-0.13657719, 0.30651027, 0.16118456),vec3(-0.14714938, 0.33245975, -0.113095455),vec3(0.030659059, 0.27887347, -0.7332209),vec3(0.009913514, -0.89884496, 0.07381549),vec3(0.040318526, 0.40091, 0.6847858),vec3(0.22311053, -0.3039437, -0.19340435),vec3(0.36235332, 0.21894878, -0.05407306),vec3(-0.15198798, -0.38409665, -0.46785462),vec3(-0.013492276, -0.5345803, 0.11307949),vec3(-0.4972847, 0.037064247, -0.4381323),vec3(-0.024175806, -0.008928787, 0.17719103),vec3(0.694014, -0.122672155, 0.33098832));</span>
<span style="color: #666666; font-style: italic;">//const vec3 pSphere[10] = vec3[](vec3(-0.010735935, 0.01647018, 0.0062425877),vec3(-0.06533369, 0.3647007, -0.13746321),vec3(-0.6539235, -0.016726388, -0.53000957),vec3(0.40958285, 0.0052428036, -0.5591124),vec3(-0.1465366, 0.09899267, 0.15571679),vec3(-0.44122112, -0.5458797, 0.04912532),vec3(0.03755566, -0.10961345, -0.33040273),vec3(0.019100213, 0.29652783, 0.066237666),vec3(0.8765323, 0.011236004, 0.28265962),vec3(0.29264435, -0.40794238, 0.15964167));</span>
   <span style="color: #666666; font-style: italic;">// grab a normal for reflecting the sample rays later on</span>
   vec3 fres <span style="color: #339933;">=</span> normalize<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>texture2D<span style="color: #009900;">&#40;</span>rnm<span style="color: #339933;">,</span>uv<span style="color: #339933;">*</span>offset<span style="color: #009900;">&#41;</span>.<span style="color: #202020;">xyz</span><span style="color: #339933;">*</span><span style="color:#800080;">2.0</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> vec3<span style="color: #009900;">&#40;</span><span style="color:#800080;">1.0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   vec4 currentPixelSample <span style="color: #339933;">=</span> texture2D<span style="color: #009900;">&#40;</span>normalMap<span style="color: #339933;">,</span>uv<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #993333;">float</span> currentPixelDepth <span style="color: #339933;">=</span> currentPixelSample.<span style="color: #202020;">a</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #666666; font-style: italic;">// current fragment coords in screen space</span>
   vec3 ep <span style="color: #339933;">=</span> vec3<span style="color: #009900;">&#40;</span>uv.<span style="color: #202020;">xy</span><span style="color: #339933;">,</span>currentPixelDepth<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #666666; font-style: italic;">// get the normal of current fragment</span>
   vec3 norm <span style="color: #339933;">=</span> currentPixelSample.<span style="color: #202020;">xyz</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #993333;">float</span> bl <span style="color: #339933;">=</span> <span style="color:#800080;">0.0</span><span style="color: #339933;">;</span>
   <span style="color: #666666; font-style: italic;">// adjust for the depth ( not shure if this is good..)</span>
   <span style="color: #993333;">float</span> radD <span style="color: #339933;">=</span> rad<span style="color: #339933;">/</span>currentPixelDepth<span style="color: #339933;">;</span>
&nbsp;
   vec3 ray<span style="color: #339933;">,</span> se<span style="color: #339933;">,</span> occNorm<span style="color: #339933;">;</span>
   <span style="color: #993333;">float</span> occluderDepth<span style="color: #339933;">,</span> depthDifference<span style="color: #339933;">,</span> normDiff<span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> i<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>SAMPLES<span style="color: #339933;">;++</span>i<span style="color: #009900;">&#41;</span>
   <span style="color: #009900;">&#123;</span>
      <span style="color: #666666; font-style: italic;">// get a vector (randomized inside of a sphere with radius 1.0) from a texture and reflect it</span>
      ray <span style="color: #339933;">=</span> radD<span style="color: #339933;">*</span>reflect<span style="color: #009900;">&#40;</span>pSphere<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>fres<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #666666; font-style: italic;">// if the ray is outside the hemisphere then change direction</span>
      se <span style="color: #339933;">=</span> ep <span style="color: #339933;">+</span> sign<span style="color: #009900;">&#40;</span>dot<span style="color: #009900;">&#40;</span>ray<span style="color: #339933;">,</span>norm<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span>ray<span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #666666; font-style: italic;">// get the depth of the occluder fragment</span>
      vec4 occluderFragment <span style="color: #339933;">=</span> texture2D<span style="color: #009900;">&#40;</span>normalMap<span style="color: #339933;">,</span>se.<span style="color: #202020;">xy</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #666666; font-style: italic;">// get the normal of the occluder fragment</span>
      occNorm <span style="color: #339933;">=</span> occluderFragment.<span style="color: #202020;">xyz</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #666666; font-style: italic;">// if depthDifference is negative = occluder is behind current fragment</span>
      depthDifference <span style="color: #339933;">=</span> currentPixelDepth<span style="color: #339933;">-</span>occluderFragment.<span style="color: #202020;">a</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #666666; font-style: italic;">// calculate the difference between the normals as a weight</span>
&nbsp;
      normDiff <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color:#800080;">1.0</span><span style="color: #339933;">-</span>dot<span style="color: #009900;">&#40;</span>occNorm<span style="color: #339933;">,</span>norm<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #666666; font-style: italic;">// the falloff equation, starts at falloff and is kind of 1/x^2 falling</span>
      bl <span style="color: #339933;">+=</span> step<span style="color: #009900;">&#40;</span>falloff<span style="color: #339933;">,</span>depthDifference<span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span>normDiff<span style="color: #339933;">*</span><span style="color: #009900;">&#40;</span><span style="color:#800080;">1.0</span><span style="color: #339933;">-</span>smoothstep<span style="color: #009900;">&#40;</span>falloff<span style="color: #339933;">,</span>strength<span style="color: #339933;">,</span>depthDifference<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
&nbsp;
   <span style="color: #666666; font-style: italic;">// output the result</span>
   <span style="color: #993333;">float</span> ao <span style="color: #339933;">=</span> <span style="color:#800080;">1.0</span><span style="color: #339933;">-</span>totStrength<span style="color: #339933;">*</span>bl<span style="color: #339933;">*</span>invSamples<span style="color: #339933;">;</span>
   gl_FragColor.<span style="color: #202020;">r</span> <span style="color: #339933;">=</span> ao<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>This is an optimized version of the same shader, but a little harder to read and understand</p>

<div class="wp_codebox"><table width="100%" ><tr id="p5697"><td class="code" id="p569code7"><pre class="c" style="font-family:monospace;">uniform sampler2D rnm<span style="color: #339933;">;</span>
uniform sampler2D normalMap<span style="color: #339933;">;</span>
varying vec2 uv<span style="color: #339933;">;</span>
<span style="color: #993333;">const</span> <span style="color: #993333;">float</span> totStrength <span style="color: #339933;">=</span> <span style="color:#800080;">1.38</span><span style="color: #339933;">;</span>
<span style="color: #993333;">const</span> <span style="color: #993333;">float</span> strength <span style="color: #339933;">=</span> <span style="color:#800080;">0.07</span><span style="color: #339933;">;</span>
<span style="color: #993333;">const</span> <span style="color: #993333;">float</span> offset <span style="color: #339933;">=</span> <span style="color:#800080;">18.0</span><span style="color: #339933;">;</span>
<span style="color: #993333;">const</span> <span style="color: #993333;">float</span> falloff <span style="color: #339933;">=</span> <span style="color:#800080;">0.000002</span><span style="color: #339933;">;</span>
<span style="color: #993333;">const</span> <span style="color: #993333;">float</span> rad <span style="color: #339933;">=</span> <span style="color:#800080;">0.006</span><span style="color: #339933;">;</span>
<span style="color: #339933;">#define SAMPLES 10 // 10 is good</span>
<span style="color: #993333;">const</span> <span style="color: #993333;">float</span> invSamples <span style="color: #339933;">=</span> <span style="color: #339933;">-</span><span style="color:#800080;">1.38</span><span style="color: #339933;">/</span><span style="color:#800080;">10.0</span><span style="color: #339933;">;</span>
<span style="color: #993333;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;">// these are the random vectors inside a unit sphere</span>
vec3 pSphere<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">10</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> vec3<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#40;</span>vec3<span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span><span style="color:#800080;">0.010735935</span><span style="color: #339933;">,</span> <span style="color:#800080;">0.01647018</span><span style="color: #339933;">,</span> <span style="color:#800080;">0.0062425877</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>vec3<span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span><span style="color:#800080;">0.06533369</span><span style="color: #339933;">,</span> <span style="color:#800080;">0.3647007</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color:#800080;">0.13746321</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>vec3<span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span><span style="color:#800080;">0.6539235</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color:#800080;">0.016726388</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color:#800080;">0.53000957</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>vec3<span style="color: #009900;">&#40;</span><span style="color:#800080;">0.40958285</span><span style="color: #339933;">,</span> <span style="color:#800080;">0.0052428036</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color:#800080;">0.5591124</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>vec3<span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span><span style="color:#800080;">0.1465366</span><span style="color: #339933;">,</span> <span style="color:#800080;">0.09899267</span><span style="color: #339933;">,</span> <span style="color:#800080;">0.15571679</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>vec3<span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span><span style="color:#800080;">0.44122112</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color:#800080;">0.5458797</span><span style="color: #339933;">,</span> <span style="color:#800080;">0.04912532</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>vec3<span style="color: #009900;">&#40;</span><span style="color:#800080;">0.03755566</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color:#800080;">0.10961345</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color:#800080;">0.33040273</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>vec3<span style="color: #009900;">&#40;</span><span style="color:#800080;">0.019100213</span><span style="color: #339933;">,</span> <span style="color:#800080;">0.29652783</span><span style="color: #339933;">,</span> <span style="color:#800080;">0.066237666</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>vec3<span style="color: #009900;">&#40;</span><span style="color:#800080;">0.8765323</span><span style="color: #339933;">,</span> <span style="color:#800080;">0.011236004</span><span style="color: #339933;">,</span> <span style="color:#800080;">0.28265962</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>vec3<span style="color: #009900;">&#40;</span><span style="color:#800080;">0.29264435</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color:#800080;">0.40794238</span><span style="color: #339933;">,</span> <span style="color:#800080;">0.15964167</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #666666; font-style: italic;">// grab a normal for reflecting the sample rays later on</span>
   vec3 fres <span style="color: #339933;">=</span> normalize<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>texture2D<span style="color: #009900;">&#40;</span>rnm<span style="color: #339933;">,</span>uv<span style="color: #339933;">*</span>offset<span style="color: #009900;">&#41;</span>.<span style="color: #202020;">xyz</span><span style="color: #339933;">*</span><span style="color:#800080;">2.0</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> vec3<span style="color: #009900;">&#40;</span><span style="color:#800080;">1.0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   vec4 currentPixelSample <span style="color: #339933;">=</span> texture2D<span style="color: #009900;">&#40;</span>normalMap<span style="color: #339933;">,</span>uv<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #993333;">float</span> currentPixelDepth <span style="color: #339933;">=</span> currentPixelSample.<span style="color: #202020;">a</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #666666; font-style: italic;">// current fragment coords in screen space</span>
   vec3 ep <span style="color: #339933;">=</span> vec3<span style="color: #009900;">&#40;</span>uv.<span style="color: #202020;">xy</span><span style="color: #339933;">,</span>currentPixelDepth<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #666666; font-style: italic;">// get the normal of current fragment</span>
   vec3 norm <span style="color: #339933;">=</span> currentPixelSample.<span style="color: #202020;">xyz</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #993333;">float</span> bl <span style="color: #339933;">=</span> <span style="color:#800080;">0.0</span><span style="color: #339933;">;</span>
   <span style="color: #666666; font-style: italic;">// adjust for the depth ( not shure if this is good..)</span>
   <span style="color: #993333;">float</span> radD <span style="color: #339933;">=</span> rad<span style="color: #339933;">/</span>currentPixelDepth<span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #666666; font-style: italic;">//vec3 ray, se, occNorm;</span>
   <span style="color: #993333;">float</span> occluderDepth<span style="color: #339933;">,</span> depthDifference<span style="color: #339933;">;</span>
   vec4 occluderFragment<span style="color: #339933;">;</span>
   vec3 ray<span style="color: #339933;">;</span>
   <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> i<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>SAMPLES<span style="color: #339933;">;++</span>i<span style="color: #009900;">&#41;</span>
   <span style="color: #009900;">&#123;</span>
      <span style="color: #666666; font-style: italic;">// get a vector (randomized inside of a sphere with radius 1.0) from a texture and reflect it</span>
      ray <span style="color: #339933;">=</span> radD<span style="color: #339933;">*</span>reflect<span style="color: #009900;">&#40;</span>pSphere<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>fres<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #666666; font-style: italic;">// get the depth of the occluder fragment</span>
      occluderFragment <span style="color: #339933;">=</span> texture2D<span style="color: #009900;">&#40;</span>normalMap<span style="color: #339933;">,</span>ep.<span style="color: #202020;">xy</span> <span style="color: #339933;">+</span> sign<span style="color: #009900;">&#40;</span>dot<span style="color: #009900;">&#40;</span>ray<span style="color: #339933;">,</span>norm<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span>ray.<span style="color: #202020;">xy</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #666666; font-style: italic;">// if depthDifference is negative = occluder is behind current fragment</span>
      depthDifference <span style="color: #339933;">=</span> currentPixelDepth<span style="color: #339933;">-</span>occluderFragment.<span style="color: #202020;">a</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #666666; font-style: italic;">// calculate the difference between the normals as a weight</span>
 <span style="color: #666666; font-style: italic;">// the falloff equation, starts at falloff and is kind of 1/x^2 falling</span>
      bl <span style="color: #339933;">+=</span> step<span style="color: #009900;">&#40;</span>falloff<span style="color: #339933;">,</span>depthDifference<span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span><span style="color: #009900;">&#40;</span><span style="color:#800080;">1.0</span><span style="color: #339933;">-</span>dot<span style="color: #009900;">&#40;</span>occluderFragment.<span style="color: #202020;">xyz</span><span style="color: #339933;">,</span>norm<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span><span style="color: #009900;">&#40;</span><span style="color:#800080;">1.0</span><span style="color: #339933;">-</span>smoothstep<span style="color: #009900;">&#40;</span>falloff<span style="color: #339933;">,</span>strength<span style="color: #339933;">,</span>depthDifference<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
&nbsp;
   <span style="color: #666666; font-style: italic;">// output the result</span>
   gl_FragColor.<span style="color: #202020;">r</span> <span style="color: #339933;">=</span> <span style="color:#800080;">1.0</span><span style="color: #339933;">+</span>bl<span style="color: #339933;">*</span>invSamples<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>To use the SSAO effect. Render a fullscreen quad over the screen with the following vertex shader and the previous SSAO fragment shader.</p>

<div class="wp_codebox"><table width="100%" ><tr id="p5698"><td class="code" id="p569code8"><pre class="c" style="font-family:monospace;">varying vec2  uv<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #993333;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
gl_Position <span style="color: #339933;">=</span> ftransform<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
gl_Position <span style="color: #339933;">=</span> sign<span style="color: #009900;">&#40;</span> gl_Position <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Texture coordinate for screen aligned (in correct range):</span>
uv <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>vec2<span style="color: #009900;">&#40;</span> gl_Position.<span style="color: #202020;">x</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span> gl_Position.<span style="color: #202020;">y</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> vec2<span style="color: #009900;">&#40;</span> <span style="color:#800080;">1.0</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color:#800080;">0.5</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Here&#8217;s the source for a school project we did in six weeks (halftime work). It&#8217;s a simple FPS game, but does demonstrate the SSAO. Use the &#8220;O&#8221;-button to toggle the different SSAO modes. This source is unfortunately hard to build since it uses a lot of third party libraries (Ogre3D, boost, fmod, ode &#8230;)</p>
<p><a title="Source" href="http://sourceforge.net/svn/?group_id=244295">http://sourceforge.net/svn/?group_id=244295</a></p>
<p>And here&#8217;s the compiled version. Just unzip it and run the exe.</p>
<p><a title="Compiled Engine" href="http://www.gamerendering.com/uploads/release.zip">Download zip</a></p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Please share:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow" id="print" href="javascript:window.location='http%3A%2F%2Fwww.printfriendly.com%2Fprint%3Furl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2009%252F01%252F14%252Fssao%252F%26amp%3Bpartner%3Dsociable';" title="Print this article!"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print this article!" alt="Print this article!" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="digg" href="javascript:window.location='http%3A%2F%2Fdigg.com%2Fsubmit%3Fphase%3D2%26amp%3Burl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2009%252F01%252F14%252Fssao%252F%26amp%3Btitle%3DSSAO%26amp%3Bbodytext%3DThis%2520is%2520my%2520SSAO%2520%2528Screen%2520Space%2520Ambient%2520Occlusion%2529%25C2%25A0implementation%2520and%2520it%2527s%2520both%2520fast%2520and%2520gives%2520good%2520result.%2520It%2527s%2520inspired%2520by%2520the%2520Crysis%2520SSAO%2520algorithm%2520but%2520also%2520the%2520Starcraft%2520II%2520implementation%2520and%2520a%2520little%2520from%2520Nvidia%2527s%2520implementation.%250D%250ATo%2520use%2520the%2520SSAO';" title="Digg"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="sphinn" href="javascript:window.location='http%3A%2F%2Fsphinn.com%2Findex.php%3Fc%3Dpost%26m%3Dsubmit%26link%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2009%252F01%252F14%252Fssao%252F';" title="Sphinn"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="del.icio.us" href="javascript:window.location='http%3A%2F%2Fdelicious.com%2Fpost%3Furl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2009%252F01%252F14%252Fssao%252F%26amp%3Btitle%3DSSAO%26amp%3Bnotes%3DThis%2520is%2520my%2520SSAO%2520%2528Screen%2520Space%2520Ambient%2520Occlusion%2529%25C2%25A0implementation%2520and%2520it%2527s%2520both%2520fast%2520and%2520gives%2520good%2520result.%2520It%2527s%2520inspired%2520by%2520the%2520Crysis%2520SSAO%2520algorithm%2520but%2520also%2520the%2520Starcraft%2520II%2520implementation%2520and%2520a%2520little%2520from%2520Nvidia%2527s%2520implementation.%250D%250ATo%2520use%2520the%2520SSAO';" title="del.icio.us"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="facebook" href="javascript:window.location='http%3A%2F%2Fwww.facebook.com%2Fshare.php%3Fu%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2009%252F01%252F14%252Fssao%252F%26amp%3Bt%3DSSAO';" title="Facebook"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="mixx" href="javascript:window.location='http%3A%2F%2Fwww.mixx.com%2Fsubmit%3Fpage_url%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2009%252F01%252F14%252Fssao%252F%26amp%3Btitle%3DSSAO';" title="Mixx"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="google" href="javascript:window.location='http%3A%2F%2Fwww.google.com%2Fbookmarks%2Fmark%3Fop%3Dedit%26amp%3Bbkmk%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2009%252F01%252F14%252Fssao%252F%26amp%3Btitle%3DSSAO%26amp%3Bannotation%3DThis%2520is%2520my%2520SSAO%2520%2528Screen%2520Space%2520Ambient%2520Occlusion%2529%25C2%25A0implementation%2520and%2520it%2527s%2520both%2520fast%2520and%2520gives%2520good%2520result.%2520It%2527s%2520inspired%2520by%2520the%2520Crysis%2520SSAO%2520algorithm%2520but%2520also%2520the%2520Starcraft%2520II%2520implementation%2520and%2520a%2520little%2520from%2520Nvidia%2527s%2520implementation.%250D%250ATo%2520use%2520the%2520SSAO';" title="Google Bookmarks"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="current" href="javascript:window.location='http%3A%2F%2Fcurrent.com%2Fclipper.htm%3Furl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2009%252F01%252F14%252Fssao%252F%26amp%3Btitle%3DSSAO';" title="Current"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/current.png" title="Current" alt="Current" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="linkedin" href="javascript:window.location='http%3A%2F%2Fwww.linkedin.com%2FshareArticle%3Fmini%3Dtrue%26amp%3Burl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2009%252F01%252F14%252Fssao%252F%26amp%3Btitle%3DSSAO%26amp%3Bsource%3DGame%2BRendering%2B%26amp%3Bsummary%3DThis%2520is%2520my%2520SSAO%2520%2528Screen%2520Space%2520Ambient%2520Occlusion%2529%25C2%25A0implementation%2520and%2520it%2527s%2520both%2520fast%2520and%2520gives%2520good%2520result.%2520It%2527s%2520inspired%2520by%2520the%2520Crysis%2520SSAO%2520algorithm%2520but%2520also%2520the%2520Starcraft%2520II%2520implementation%2520and%2520a%2520little%2520from%2520Nvidia%2527s%2520implementation.%250D%250ATo%2520use%2520the%2520SSAO';" title="LinkedIn"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="live" href="javascript:window.location='https%3A%2F%2Ffavorites.live.com%2Fquickadd.aspx%3Fmarklet%3D1%26amp%3Burl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2009%252F01%252F14%252Fssao%252F%26amp%3Btitle%3DSSAO';" title="Live"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="myspace" href="javascript:window.location='http%3A%2F%2Fwww.myspace.com%2FModules%2FPostTo%2FPages%2F%3Fu%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2009%252F01%252F14%252Fssao%252F%26amp%3Bt%3DSSAO';" title="MySpace"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="netvibes" href="javascript:window.location='http%3A%2F%2Fwww.netvibes.com%2Fshare%3Ftitle%3DSSAO%26amp%3Burl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2009%252F01%252F14%252Fssao%252F';" title="Netvibes"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="stumbleupon" href="javascript:window.location='http%3A%2F%2Fwww.stumbleupon.com%2Fsubmit%3Furl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2009%252F01%252F14%252Fssao%252F%26amp%3Btitle%3DSSAO';" title="StumbleUpon"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="twitter" href="javascript:window.location='http%3A%2F%2Ftwitter.com%2Fhome%3Fstatus%3DSSAO%2520-%2520http%253A%252F%252Fwww.gamerendering.com%252F2009%252F01%252F14%252Fssao%252F';" title="Twitter"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="reddit" href="javascript:window.location='http%3A%2F%2Freddit.com%2Fsubmit%3Furl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2009%252F01%252F14%252Fssao%252F%26amp%3Btitle%3DSSAO';" title="Reddit"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="technorati" href="javascript:window.location='http%3A%2F%2Ftechnorati.com%2Ffaves%3Fadd%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2009%252F01%252F14%252Fssao%252F';" title="Technorati"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow" id="yahoo! bookmarks" href="javascript:window.location='http%3A%2F%2Fbookmarks.yahoo.com%2Ftoolbar%2Fsavebm%3Fu%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2009%252F01%252F14%252Fssao%252F%26amp%3Bt%3DSSAO%26opener%3Dbm%26amp%3Bei%3DUTF-8%26amp%3Bd%3DThis%2520is%2520my%2520SSAO%2520%2528Screen%2520Space%2520Ambient%2520Occlusion%2529%25C2%25A0implementation%2520and%2520it%2527s%2520both%2520fast%2520and%2520gives%2520good%2520result.%2520It%2527s%2520inspired%2520by%2520the%2520Crysis%2520SSAO%2520algorithm%2520but%2520also%2520the%2520Starcraft%2520II%2520implementation%2520and%2520a%2520little%2520from%2520Nvidia%2527s%2520implementation.%250D%250ATo%2520use%2520the%2520SSAO';" title="Yahoo! Bookmarks"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="Yahoo! Bookmarks" alt="Yahoo! Bookmarks" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.gamerendering.com/2009/01/14/ssao/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Real-Time Volumetric Smoke</title>
		<link>http://www.gamerendering.com/2008/10/09/real-time-volumetric-smoke/</link>
		<comments>http://www.gamerendering.com/2008/10/09/real-time-volumetric-smoke/#comments</comments>
		<pubDate>Thu, 09 Oct 2008 16:12:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Smoke]]></category>
		<category><![CDATA[3D Textures]]></category>
		<category><![CDATA[DirectX10]]></category>
		<category><![CDATA[Nvidia]]></category>
		<category><![CDATA[Special Effects]]></category>

		<guid isPermaLink="false">http://www.gamerendering.com/?p=282</guid>
		<description><![CDATA[This approach to render volumetric smoke uses the new feature of DirectX10 that enables rendering to 3D textures. It uses voxelization of the geometry to enable the smoke to flow around and react to the geometry in a realistic way.
 
All details can be found in this paper by Nvidia.
http://developer.download.nvidia.com/presentations/2007/gdc/RealTimeFluids.pdf



Please share:


	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	


]]></description>
			<content:encoded><![CDATA[<p>This approach to render volumetric smoke uses the new feature of DirectX10 that enables rendering to 3D textures. It uses voxelization of the geometry to enable the smoke to flow around and react to the geometry in a realistic way.</p>
<p> <a href="http://www.gamerendering.com/wp-content/uploads/volumetricsmoke.jpg"><img class="size-medium wp-image-283" title="Volumetric Smoke Rendering" src="http://www.gamerendering.com/wp-content/uploads/volumetricsmoke.jpg" alt="Volumetric Smoke Rendering" width="390" height="372" /></a></p>
<p>All details can be found in this paper by Nvidia.<br />
<a href="http://developer.download.nvidia.com/presentations/2007/gdc/RealTimeFluids.pdf">http://developer.download.nvidia.com/presentations/2007/gdc/RealTimeFluids.pdf</a></p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Please share:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow" id="print" href="javascript:window.location='http%3A%2F%2Fwww.printfriendly.com%2Fprint%3Furl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2008%252F10%252F09%252Freal-time-volumetric-smoke%252F%26amp%3Bpartner%3Dsociable';" title="Print this article!"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print this article!" alt="Print this article!" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="digg" href="javascript:window.location='http%3A%2F%2Fdigg.com%2Fsubmit%3Fphase%3D2%26amp%3Burl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2008%252F10%252F09%252Freal-time-volumetric-smoke%252F%26amp%3Btitle%3DReal-Time%2520Volumetric%2520Smoke%26amp%3Bbodytext%3DThis%2520approach%2520to%2520render%2520volumetric%2520smoke%2520uses%2520the%2520new%2520feature%2520of%2520DirectX10%2520that%2520enables%2520rendering%2520to%25203D%2520textures.%2520It%2520uses%2520voxelization%2520of%2520the%2520geometry%2520to%2520enable%2520the%2520smoke%2520to%2520flow%2520around%2520and%2520react%2520to%25C2%25A0the%2520geometry%2520in%2520a%2520realistic%2520way.%250D%250A%250D%250A%25C2%25A0%250D%250A%250D%250AAll%2520deta';" title="Digg"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="sphinn" href="javascript:window.location='http%3A%2F%2Fsphinn.com%2Findex.php%3Fc%3Dpost%26m%3Dsubmit%26link%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2008%252F10%252F09%252Freal-time-volumetric-smoke%252F';" title="Sphinn"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="del.icio.us" href="javascript:window.location='http%3A%2F%2Fdelicious.com%2Fpost%3Furl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2008%252F10%252F09%252Freal-time-volumetric-smoke%252F%26amp%3Btitle%3DReal-Time%2520Volumetric%2520Smoke%26amp%3Bnotes%3DThis%2520approach%2520to%2520render%2520volumetric%2520smoke%2520uses%2520the%2520new%2520feature%2520of%2520DirectX10%2520that%2520enables%2520rendering%2520to%25203D%2520textures.%2520It%2520uses%2520voxelization%2520of%2520the%2520geometry%2520to%2520enable%2520the%2520smoke%2520to%2520flow%2520around%2520and%2520react%2520to%25C2%25A0the%2520geometry%2520in%2520a%2520realistic%2520way.%250D%250A%250D%250A%25C2%25A0%250D%250A%250D%250AAll%2520deta';" title="del.icio.us"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="facebook" href="javascript:window.location='http%3A%2F%2Fwww.facebook.com%2Fshare.php%3Fu%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2008%252F10%252F09%252Freal-time-volumetric-smoke%252F%26amp%3Bt%3DReal-Time%2520Volumetric%2520Smoke';" title="Facebook"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="mixx" href="javascript:window.location='http%3A%2F%2Fwww.mixx.com%2Fsubmit%3Fpage_url%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2008%252F10%252F09%252Freal-time-volumetric-smoke%252F%26amp%3Btitle%3DReal-Time%2520Volumetric%2520Smoke';" title="Mixx"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="google" href="javascript:window.location='http%3A%2F%2Fwww.google.com%2Fbookmarks%2Fmark%3Fop%3Dedit%26amp%3Bbkmk%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2008%252F10%252F09%252Freal-time-volumetric-smoke%252F%26amp%3Btitle%3DReal-Time%2520Volumetric%2520Smoke%26amp%3Bannotation%3DThis%2520approach%2520to%2520render%2520volumetric%2520smoke%2520uses%2520the%2520new%2520feature%2520of%2520DirectX10%2520that%2520enables%2520rendering%2520to%25203D%2520textures.%2520It%2520uses%2520voxelization%2520of%2520the%2520geometry%2520to%2520enable%2520the%2520smoke%2520to%2520flow%2520around%2520and%2520react%2520to%25C2%25A0the%2520geometry%2520in%2520a%2520realistic%2520way.%250D%250A%250D%250A%25C2%25A0%250D%250A%250D%250AAll%2520deta';" title="Google Bookmarks"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="current" href="javascript:window.location='http%3A%2F%2Fcurrent.com%2Fclipper.htm%3Furl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2008%252F10%252F09%252Freal-time-volumetric-smoke%252F%26amp%3Btitle%3DReal-Time%2520Volumetric%2520Smoke';" title="Current"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/current.png" title="Current" alt="Current" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="linkedin" href="javascript:window.location='http%3A%2F%2Fwww.linkedin.com%2FshareArticle%3Fmini%3Dtrue%26amp%3Burl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2008%252F10%252F09%252Freal-time-volumetric-smoke%252F%26amp%3Btitle%3DReal-Time%2520Volumetric%2520Smoke%26amp%3Bsource%3DGame%2BRendering%2B%26amp%3Bsummary%3DThis%2520approach%2520to%2520render%2520volumetric%2520smoke%2520uses%2520the%2520new%2520feature%2520of%2520DirectX10%2520that%2520enables%2520rendering%2520to%25203D%2520textures.%2520It%2520uses%2520voxelization%2520of%2520the%2520geometry%2520to%2520enable%2520the%2520smoke%2520to%2520flow%2520around%2520and%2520react%2520to%25C2%25A0the%2520geometry%2520in%2520a%2520realistic%2520way.%250D%250A%250D%250A%25C2%25A0%250D%250A%250D%250AAll%2520deta';" title="LinkedIn"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="live" href="javascript:window.location='https%3A%2F%2Ffavorites.live.com%2Fquickadd.aspx%3Fmarklet%3D1%26amp%3Burl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2008%252F10%252F09%252Freal-time-volumetric-smoke%252F%26amp%3Btitle%3DReal-Time%2520Volumetric%2520Smoke';" title="Live"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="myspace" href="javascript:window.location='http%3A%2F%2Fwww.myspace.com%2FModules%2FPostTo%2FPages%2F%3Fu%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2008%252F10%252F09%252Freal-time-volumetric-smoke%252F%26amp%3Bt%3DReal-Time%2520Volumetric%2520Smoke';" title="MySpace"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="netvibes" href="javascript:window.location='http%3A%2F%2Fwww.netvibes.com%2Fshare%3Ftitle%3DReal-Time%2520Volumetric%2520Smoke%26amp%3Burl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2008%252F10%252F09%252Freal-time-volumetric-smoke%252F';" title="Netvibes"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="stumbleupon" href="javascript:window.location='http%3A%2F%2Fwww.stumbleupon.com%2Fsubmit%3Furl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2008%252F10%252F09%252Freal-time-volumetric-smoke%252F%26amp%3Btitle%3DReal-Time%2520Volumetric%2520Smoke';" title="StumbleUpon"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="twitter" href="javascript:window.location='http%3A%2F%2Ftwitter.com%2Fhome%3Fstatus%3DReal-Time%2520Volumetric%2520Smoke%2520-%2520http%253A%252F%252Fwww.gamerendering.com%252F2008%252F10%252F09%252Freal-time-volumetric-smoke%252F';" title="Twitter"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="reddit" href="javascript:window.location='http%3A%2F%2Freddit.com%2Fsubmit%3Furl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2008%252F10%252F09%252Freal-time-volumetric-smoke%252F%26amp%3Btitle%3DReal-Time%2520Volumetric%2520Smoke';" title="Reddit"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="technorati" href="javascript:window.location='http%3A%2F%2Ftechnorati.com%2Ffaves%3Fadd%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2008%252F10%252F09%252Freal-time-volumetric-smoke%252F';" title="Technorati"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow" id="yahoo! bookmarks" href="javascript:window.location='http%3A%2F%2Fbookmarks.yahoo.com%2Ftoolbar%2Fsavebm%3Fu%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2008%252F10%252F09%252Freal-time-volumetric-smoke%252F%26amp%3Bt%3DReal-Time%2520Volumetric%2520Smoke%26opener%3Dbm%26amp%3Bei%3DUTF-8%26amp%3Bd%3DThis%2520approach%2520to%2520render%2520volumetric%2520smoke%2520uses%2520the%2520new%2520feature%2520of%2520DirectX10%2520that%2520enables%2520rendering%2520to%25203D%2520textures.%2520It%2520uses%2520voxelization%2520of%2520the%2520geometry%2520to%2520enable%2520the%2520smoke%2520to%2520flow%2520around%2520and%2520react%2520to%25C2%25A0the%2520geometry%2520in%2520a%2520realistic%2520way.%250D%250A%250D%250A%25C2%25A0%250D%250A%250D%250AAll%2520deta';" title="Yahoo! Bookmarks"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="Yahoo! Bookmarks" alt="Yahoo! Bookmarks" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.gamerendering.com/2008/10/09/real-time-volumetric-smoke/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Improved Alpha-Testing</title>
		<link>http://www.gamerendering.com/2008/09/29/improved-alpha-testing/</link>
		<comments>http://www.gamerendering.com/2008/09/29/improved-alpha-testing/#comments</comments>
		<pubDate>Mon, 29 Sep 2008 21:43:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Image Enhancements]]></category>
		<category><![CDATA[Alpha-Testing- Alpha Killing]]></category>
		<category><![CDATA[Decaling]]></category>
		<category><![CDATA[Decals]]></category>
		<category><![CDATA[Magnification]]></category>
		<category><![CDATA[Precision]]></category>
		<category><![CDATA[Rendering]]></category>
		<category><![CDATA[Special Effects]]></category>
		<category><![CDATA[Textures]]></category>
		<category><![CDATA[Vector]]></category>

		<guid isPermaLink="false">http://www.gamerendering.com/?p=145</guid>
		<description><![CDATA[The full title of this paper is improved &#8220;Alpha-Tested Magnification for Vector Textures and Special Effects&#8221;. It&#8217;s about a technique to use vector textures when decaling for improved precision when magnificating. This kind of decal is useful for signs and such things that contains text or symbols because they can easily be represented as vector [...]]]></description>
			<content:encoded><![CDATA[<p>The full title of this paper is improved &#8220;Alpha-Tested Magnification for Vector Textures and Special Effects&#8221;. It&#8217;s about a technique to use vector textures when decaling for improved precision when magnificating. This kind of decal is useful for signs and such things that contains text or symbols because they can easily be represented as vector graphics. The left image below shows standard Alpha-Testing and the image on the right shows the improved version.</p>
<div class="mceTemp"><a href="http://www.gamerendering.com/wp-content/uploads/improveddecaling.jpg"><img class="size-medium wp-image-146" title="Improved Alpha-Testing for Decaling" src="http://www.gamerendering.com/wp-content/uploads/improveddecaling-400x182.jpg" alt="Improved Alpha-Testing for Decaling" width="400" height="182" /></a></div>
<p>Link to the paper:<br />
<a href="http://www.valvesoftware.com/publications/2007/SIGGRAPH2007_AlphaTestedMagnification.pdf">http://www.valvesoftware.com/publications/2007/SIGGRAPH2007_AlphaTestedMagnification.pdf</a></p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Please share:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow" id="print" href="javascript:window.location='http%3A%2F%2Fwww.printfriendly.com%2Fprint%3Furl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2008%252F09%252F29%252Fimproved-alpha-testing%252F%26amp%3Bpartner%3Dsociable';" title="Print this article!"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print this article!" alt="Print this article!" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="digg" href="javascript:window.location='http%3A%2F%2Fdigg.com%2Fsubmit%3Fphase%3D2%26amp%3Burl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2008%252F09%252F29%252Fimproved-alpha-testing%252F%26amp%3Btitle%3DImproved%2520Alpha-Testing%26amp%3Bbodytext%3DThe%2520full%2520title%2520of%2520this%2520paper%2520is%2520improved%2520%2522Alpha-Tested%2520Magnification%2520for%2520Vector%2520Textures%2520and%2520Special%2520Effects%2522.%2520It%2527s%2520about%2520a%2520technique%2520to%2520use%2520vector%2520textures%2520when%2520decaling%2520for%2520improved%2520precision%2520when%2520magnificating.%2520This%2520kind%2520of%2520decal%2520is%2520useful%2520for%2520sig';" title="Digg"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="sphinn" href="javascript:window.location='http%3A%2F%2Fsphinn.com%2Findex.php%3Fc%3Dpost%26m%3Dsubmit%26link%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2008%252F09%252F29%252Fimproved-alpha-testing%252F';" title="Sphinn"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="del.icio.us" href="javascript:window.location='http%3A%2F%2Fdelicious.com%2Fpost%3Furl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2008%252F09%252F29%252Fimproved-alpha-testing%252F%26amp%3Btitle%3DImproved%2520Alpha-Testing%26amp%3Bnotes%3DThe%2520full%2520title%2520of%2520this%2520paper%2520is%2520improved%2520%2522Alpha-Tested%2520Magnification%2520for%2520Vector%2520Textures%2520and%2520Special%2520Effects%2522.%2520It%2527s%2520about%2520a%2520technique%2520to%2520use%2520vector%2520textures%2520when%2520decaling%2520for%2520improved%2520precision%2520when%2520magnificating.%2520This%2520kind%2520of%2520decal%2520is%2520useful%2520for%2520sig';" title="del.icio.us"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="facebook" href="javascript:window.location='http%3A%2F%2Fwww.facebook.com%2Fshare.php%3Fu%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2008%252F09%252F29%252Fimproved-alpha-testing%252F%26amp%3Bt%3DImproved%2520Alpha-Testing';" title="Facebook"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="mixx" href="javascript:window.location='http%3A%2F%2Fwww.mixx.com%2Fsubmit%3Fpage_url%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2008%252F09%252F29%252Fimproved-alpha-testing%252F%26amp%3Btitle%3DImproved%2520Alpha-Testing';" title="Mixx"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="google" href="javascript:window.location='http%3A%2F%2Fwww.google.com%2Fbookmarks%2Fmark%3Fop%3Dedit%26amp%3Bbkmk%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2008%252F09%252F29%252Fimproved-alpha-testing%252F%26amp%3Btitle%3DImproved%2520Alpha-Testing%26amp%3Bannotation%3DThe%2520full%2520title%2520of%2520this%2520paper%2520is%2520improved%2520%2522Alpha-Tested%2520Magnification%2520for%2520Vector%2520Textures%2520and%2520Special%2520Effects%2522.%2520It%2527s%2520about%2520a%2520technique%2520to%2520use%2520vector%2520textures%2520when%2520decaling%2520for%2520improved%2520precision%2520when%2520magnificating.%2520This%2520kind%2520of%2520decal%2520is%2520useful%2520for%2520sig';" title="Google Bookmarks"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="current" href="javascript:window.location='http%3A%2F%2Fcurrent.com%2Fclipper.htm%3Furl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2008%252F09%252F29%252Fimproved-alpha-testing%252F%26amp%3Btitle%3DImproved%2520Alpha-Testing';" title="Current"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/current.png" title="Current" alt="Current" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="linkedin" href="javascript:window.location='http%3A%2F%2Fwww.linkedin.com%2FshareArticle%3Fmini%3Dtrue%26amp%3Burl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2008%252F09%252F29%252Fimproved-alpha-testing%252F%26amp%3Btitle%3DImproved%2520Alpha-Testing%26amp%3Bsource%3DGame%2BRendering%2B%26amp%3Bsummary%3DThe%2520full%2520title%2520of%2520this%2520paper%2520is%2520improved%2520%2522Alpha-Tested%2520Magnification%2520for%2520Vector%2520Textures%2520and%2520Special%2520Effects%2522.%2520It%2527s%2520about%2520a%2520technique%2520to%2520use%2520vector%2520textures%2520when%2520decaling%2520for%2520improved%2520precision%2520when%2520magnificating.%2520This%2520kind%2520of%2520decal%2520is%2520useful%2520for%2520sig';" title="LinkedIn"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="live" href="javascript:window.location='https%3A%2F%2Ffavorites.live.com%2Fquickadd.aspx%3Fmarklet%3D1%26amp%3Burl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2008%252F09%252F29%252Fimproved-alpha-testing%252F%26amp%3Btitle%3DImproved%2520Alpha-Testing';" title="Live"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="myspace" href="javascript:window.location='http%3A%2F%2Fwww.myspace.com%2FModules%2FPostTo%2FPages%2F%3Fu%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2008%252F09%252F29%252Fimproved-alpha-testing%252F%26amp%3Bt%3DImproved%2520Alpha-Testing';" title="MySpace"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="netvibes" href="javascript:window.location='http%3A%2F%2Fwww.netvibes.com%2Fshare%3Ftitle%3DImproved%2520Alpha-Testing%26amp%3Burl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2008%252F09%252F29%252Fimproved-alpha-testing%252F';" title="Netvibes"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="stumbleupon" href="javascript:window.location='http%3A%2F%2Fwww.stumbleupon.com%2Fsubmit%3Furl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2008%252F09%252F29%252Fimproved-alpha-testing%252F%26amp%3Btitle%3DImproved%2520Alpha-Testing';" title="StumbleUpon"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="twitter" href="javascript:window.location='http%3A%2F%2Ftwitter.com%2Fhome%3Fstatus%3DImproved%2520Alpha-Testing%2520-%2520http%253A%252F%252Fwww.gamerendering.com%252F2008%252F09%252F29%252Fimproved-alpha-testing%252F';" title="Twitter"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="reddit" href="javascript:window.location='http%3A%2F%2Freddit.com%2Fsubmit%3Furl%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2008%252F09%252F29%252Fimproved-alpha-testing%252F%26amp%3Btitle%3DImproved%2520Alpha-Testing';" title="Reddit"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" id="technorati" href="javascript:window.location='http%3A%2F%2Ftechnorati.com%2Ffaves%3Fadd%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2008%252F09%252F29%252Fimproved-alpha-testing%252F';" title="Technorati"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow" id="yahoo! bookmarks" href="javascript:window.location='http%3A%2F%2Fbookmarks.yahoo.com%2Ftoolbar%2Fsavebm%3Fu%3Dhttp%253A%252F%252Fwww.gamerendering.com%252F2008%252F09%252F29%252Fimproved-alpha-testing%252F%26amp%3Bt%3DImproved%2520Alpha-Testing%26opener%3Dbm%26amp%3Bei%3DUTF-8%26amp%3Bd%3DThe%2520full%2520title%2520of%2520this%2520paper%2520is%2520improved%2520%2522Alpha-Tested%2520Magnification%2520for%2520Vector%2520Textures%2520and%2520Special%2520Effects%2522.%2520It%2527s%2520about%2520a%2520technique%2520to%2520use%2520vector%2520textures%2520when%2520decaling%2520for%2520improved%2520precision%2520when%2520magnificating.%2520This%2520kind%2520of%2520decal%2520is%2520useful%2520for%2520sig';" title="Yahoo! Bookmarks"><img src="http://www.gamerendering.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="Yahoo! Bookmarks" alt="Yahoo! Bookmarks" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.gamerendering.com/2008/09/29/improved-alpha-testing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
