<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Motion Blur</title><link>http://blogs.msdn.com/shawnhar/archive/2007/08/21/motion-blur.aspx</link><description>An interesting challenge in game programming is how to make things seem fast. I've spent a great deal of my career working on this particular problem, and the solutions are relevant for more than just racing games. It is all too common to get a character</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Motion Blur</title><link>http://blogs.msdn.com/shawnhar/archive/2007/08/21/motion-blur.aspx#4502196</link><pubDate>Wed, 22 Aug 2007 04:38:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4502196</guid><dc:creator>JLarkin</dc:creator><description>&lt;p&gt;Excellent tips for implementing such effects. I've seen motion blur done in pixel shaders before, but do they base the code on this same theory?&lt;/p&gt;
</description></item><item><title>re: Motion Blur</title><link>http://blogs.msdn.com/shawnhar/archive/2007/08/21/motion-blur.aspx#4645147</link><pubDate>Thu, 30 Aug 2007 15:48:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4645147</guid><dc:creator>Ultrahead</dc:creator><description>&lt;p&gt;&amp;quot;A more practical approach is to cheat. Don't bother rendering any extra frames: just store the ones you have already drawn, and blend some amount of the previous frames in with the current one ...&amp;quot;&lt;/p&gt;
&lt;p&gt;For my never-finished-Warm-up entry I used that trick -sort of since it was even a cheaper one, not for the whole scene objects, but only for the main ball and you know what? it looked good! (with a nice trail like a comet).&lt;/p&gt;
&lt;p&gt;The difference is the technique you have explained is that you just need one feedback texture ... with the one I used I needed to hold the last 4 positions of the ball and re-render alphablended based on those positions. Since I only wanted the motion feeling for the ball I forgave myself for using this dirty cheap little trick ... behave!&lt;/p&gt;
</description></item><item><title>A bit on "Fake Motion Blur" subject</title><link>http://blogs.msdn.com/shawnhar/archive/2007/08/21/motion-blur.aspx#4680113</link><pubDate>Sat, 01 Sep 2007 05:47:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4680113</guid><dc:creator>Arek Bal</dc:creator><description>&lt;p&gt;I done it, similar way. &lt;/p&gt;
&lt;p&gt;1. Standard start - render scene to backbuffer.&lt;/p&gt;
&lt;p&gt;2. Mix current scene with downsampled last frame(if it's first frame, do not mix) on RT.&lt;/p&gt;
&lt;p&gt;3. Downsample scene(new RT)... and keep it for next frame.&lt;/p&gt;
&lt;p&gt;4. result of point 2, to backbuffer.&lt;/p&gt;
&lt;p&gt;It was fairly easy, so I started to play with mix formula. Normally, you will have something like that in PS:&lt;/p&gt;
&lt;p&gt;finalColor = currentColor * (1 - blurPower) + lastColor * blurPower;&lt;/p&gt;
&lt;p&gt;blurPower keeps in between 0 and 1. So it controls how much of last frame will be seen on current frame.&lt;/p&gt;
&lt;p&gt;It works great... but we can do a bit more with that. By using some simple pow() we can get another halo effect. Hmm... What do I mean? Depending on intensity of currentColor apply more blur... lighter the color = more motion blur. We can do that, like that:&lt;/p&gt;
&lt;p&gt;blurPower = currentColor;&lt;/p&gt;
&lt;p&gt;finalColor = currentColor * (1 - blurPower) + lastColor * blurPower;&lt;/p&gt;
&lt;p&gt;It's simple... and not enough effective... we will get, middle blur, with middle intensity.&lt;/p&gt;
&lt;p&gt;We are looking for mid intensity = low blur relationship. Square give us just that. To make it more tweakable use pow() function.&lt;/p&gt;
&lt;p&gt;So we got:&lt;/p&gt;
&lt;p&gt;blurPower = &lt;/p&gt;
&lt;p&gt;pow(currentcolor, blurColorDynamicsMultiplier); &lt;/p&gt;
&lt;p&gt;finalColor = currentColor * (1 - blurPower) + lastColor * blurPower;&lt;/p&gt;
&lt;p&gt;so... &lt;/p&gt;
&lt;p&gt;&amp;quot;multiplier = 1&amp;quot; - linear curve&lt;/p&gt;
&lt;p&gt;&amp;quot;multiplier &amp;gt; 1&amp;quot; - &amp;quot;low start, high end&amp;quot; curve&lt;/p&gt;
&lt;p&gt;&amp;quot;multiplier &amp;lt; 1&amp;quot; - &amp;quot;high start, low end&amp;quot; curve &lt;/p&gt;
&lt;p&gt;Shawn, you already wrote very good articles about curves. :)&lt;/p&gt;
&lt;p&gt;All right... let's just sum my words with last formula.&lt;/p&gt;
&lt;p&gt;You / We want to keep low motion blur till some high intensity (we want to have low blur on all, and high blur on highlights). We will use threshold (break point, or whatever)to separate interesting dynamics range... and hmm, enough:&lt;/p&gt;
&lt;p&gt;threshold; // less than 1&lt;/p&gt;
&lt;p&gt;blurPower;&lt;/p&gt;
&lt;p&gt;blurColorDynamicsMultiplier;&lt;/p&gt;
&lt;p&gt;morePower = 0;&lt;/p&gt;
&lt;p&gt;if(currentColor &amp;gt; threshold)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp;colorInGivenRange = &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//color value&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;(currentColor - threshold) / //relational &amp;nbsp;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;(1 - threshold); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //to our &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //upper range&lt;/p&gt;
&lt;p&gt; &amp;nbsp;morePower = &lt;/p&gt;
&lt;p&gt; &amp;nbsp;pow(colorInGivenRange, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; blurColorDynamicsMultiplier); &lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;blurPower = &lt;/p&gt;
&lt;p&gt;pow(currentcolor, blurColorDynamicsMultiplier) + morePower; &lt;/p&gt;
&lt;p&gt;finalColor = currentColor * (1 - blurPower) + lastColor * blurPower;&lt;/p&gt;
&lt;p&gt;I am sorry Shawn for such a ..yhym.. tutorial in comments (just a moment of concentration on subject). If you feel it's somewhat improper just delete it. :)&lt;/p&gt;
</description></item><item><title>re: Motion Blur</title><link>http://blogs.msdn.com/shawnhar/archive/2007/08/21/motion-blur.aspx#4691154</link><pubDate>Sat, 01 Sep 2007 21:37:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4691154</guid><dc:creator>Ultrahead</dc:creator><description>&lt;p&gt;Interesting.&lt;/p&gt;</description></item><item><title>re: Motion Blur</title><link>http://blogs.msdn.com/shawnhar/archive/2007/08/21/motion-blur.aspx#4695682</link><pubDate>Sun, 02 Sep 2007 03:12:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4695682</guid><dc:creator>Arek Bal</dc:creator><description>&lt;p&gt;And, with small bugs in last example. Hmm, maybe I will rewrite it heavily, and send it to ziggyware for contest. maybe... ^^&lt;/p&gt;
</description></item><item><title>Vrrroom! Whoosh!</title><link>http://blogs.msdn.com/shawnhar/archive/2007/08/21/motion-blur.aspx#4776036</link><pubDate>Thu, 06 Sep 2007 05:24:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4776036</guid><dc:creator>Shawn Hargreaves Blog</dc:creator><description>&lt;p&gt;Only four posts in the whole of August! I do apologize. I have clearly been slacking :-) Continuing on&lt;/p&gt;
</description></item><item><title>Cops And Robbers: An XNA framework game demo</title><link>http://blogs.msdn.com/shawnhar/archive/2007/08/21/motion-blur.aspx#4850404</link><pubDate>Mon, 10 Sep 2007 06:36:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4850404</guid><dc:creator>George Clingerman</dc:creator><description>&lt;p&gt;Cops And Robbers: An XNA framework game demo&lt;/p&gt;
</description></item><item><title>Motion blur appendix</title><link>http://blogs.msdn.com/shawnhar/archive/2007/08/21/motion-blur.aspx#4867958</link><pubDate>Tue, 11 Sep 2007 20:14:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4867958</guid><dc:creator>Shawn Hargreaves Blog</dc:creator><description>&lt;p&gt;Ok, I'm done talking about speed effects. Before I go, here are a couple of external links on the subject.&lt;/p&gt;
</description></item><item><title>re: Motion Blur</title><link>http://blogs.msdn.com/shawnhar/archive/2007/08/21/motion-blur.aspx#9934782</link><pubDate>Wed, 09 Dec 2009 20:03:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9934782</guid><dc:creator>Warren</dc:creator><description>&lt;p&gt;I've done something similar in my game prior to reading this entry but I was wondering what would happen if these things moved too fast on the screen. Let's say for example frame 1 its on the far left side of the screen and frame 2 its on the far right side of the screen. Would this method still produce nice results?&lt;/p&gt;</description></item></channel></rss>