<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Energy Conservation In Games</title>
	<atom:link href="http://www.rorydriscoll.com/2009/01/25/energy-conservation-in-games/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rorydriscoll.com/2009/01/25/energy-conservation-in-games/</link>
	<description></description>
	<lastBuildDate>Wed, 07 Jul 2010 17:36:07 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: rory</title>
		<link>http://www.rorydriscoll.com/2009/01/25/energy-conservation-in-games/comment-page-1/#comment-138</link>
		<dc:creator>rory</dc:creator>
		<pubDate>Thu, 05 Nov 2009 21:48:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.rorydriscoll.com/?p=262#comment-138</guid>
		<description>Right you are! I&#039;m assuming that&#039;s a typo when I was copying the math over from paper, since like you say, it doesn&#039;t make sense. Thanks for pointing that one out.</description>
		<content:encoded><![CDATA[<p>Right you are! I&#8217;m assuming that&#8217;s a typo when I was copying the math over from paper, since like you say, it doesn&#8217;t make sense. Thanks for pointing that one out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert D</title>
		<link>http://www.rorydriscoll.com/2009/01/25/energy-conservation-in-games/comment-page-1/#comment-137</link>
		<dc:creator>Robert D</dc:creator>
		<pubDate>Thu, 05 Nov 2009 20:01:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.rorydriscoll.com/?p=262#comment-137</guid>
		<description>Nice piece of work - and good images to show the results - definitely worth implementing !

I did notice however that your intermediate integral is wrong (although actually you still got the right answer for the next stage by ignoring the error)

-1/2 cos (2 theta) is :

theta = 0 : -1/2 x 1 = -0.5

theta = pi/2 : -1/2 x -1 = +0.5

so the integral is 0.5 - (-0.5) = 1.0

of course then your next integral starts to make sense as the integral of one with respect to phi is indeed phi.  (the integral of zero is zero over all ranges, so clearly otherwise this makes no sense)</description>
		<content:encoded><![CDATA[<p>Nice piece of work &#8211; and good images to show the results &#8211; definitely worth implementing !</p>
<p>I did notice however that your intermediate integral is wrong (although actually you still got the right answer for the next stage by ignoring the error)</p>
<p>-1/2 cos (2 theta) is :</p>
<p>theta = 0 : -1/2 x 1 = -0.5</p>
<p>theta = pi/2 : -1/2 x -1 = +0.5</p>
<p>so the integral is 0.5 &#8211; (-0.5) = 1.0</p>
<p>of course then your next integral starts to make sense as the integral of one with respect to phi is indeed phi.  (the integral of zero is zero over all ranges, so clearly otherwise this makes no sense)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: level of detail &#187; Blog Archive &#187; Energy Conservation</title>
		<link>http://www.rorydriscoll.com/2009/01/25/energy-conservation-in-games/comment-page-1/#comment-124</link>
		<dc:creator>level of detail &#187; Blog Archive &#187; Energy Conservation</dc:creator>
		<pubDate>Sat, 25 Jul 2009 20:24:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.rorydriscoll.com/?p=262#comment-124</guid>
		<description>[...] Driscoll had a good post in his blog a few months ago reminding everyone about energy conservation in lighting models.  [...]</description>
		<content:encoded><![CDATA[<p>[...] Driscoll had a good post in his blog a few months ago reminding everyone about energy conservation in lighting models.  [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Naty Hoffman</title>
		<link>http://www.rorydriscoll.com/2009/01/25/energy-conservation-in-games/comment-page-1/#comment-100</link>
		<dc:creator>Naty Hoffman</dc:creator>
		<pubDate>Thu, 09 Apr 2009 17:20:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.rorydriscoll.com/?p=262#comment-100</guid>
		<description>About the approximation we chose, we were not trying to be strictly conservative (that is important for multi-bounce GI solutions to converge, but not for rasterization). We were trying to choose a cheap approximation which is close to 1, and we thought it more important to be close for low specular powers. Low specular powers have highlights that cover a lot of pixels and are unlikely to be saturating past 1.</description>
		<content:encoded><![CDATA[<p>About the approximation we chose, we were not trying to be strictly conservative (that is important for multi-bounce GI solutions to converge, but not for rasterization). We were trying to choose a cheap approximation which is close to 1, and we thought it more important to be close for low specular powers. Low specular powers have highlights that cover a lot of pixels and are unlikely to be saturating past 1.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rory</title>
		<link>http://www.rorydriscoll.com/2009/01/25/energy-conservation-in-games/comment-page-1/#comment-99</link>
		<dc:creator>rory</dc:creator>
		<pubDate>Tue, 07 Apr 2009 16:43:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.rorydriscoll.com/?p=262#comment-99</guid>
		<description>I did manage to talk to Naty about this at GDC. He said that a few people have asked him about the derivation of the specular factor in the book, and that he had gone through it himself and got the exact same answer as Fabian. The value they mention in the book is just an approximation of that result.</description>
		<content:encoded><![CDATA[<p>I did manage to talk to Naty about this at GDC. He said that a few people have asked him about the derivation of the specular factor in the book, and that he had gone through it himself and got the exact same answer as Fabian. The value they mention in the book is just an approximation of that result.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rory</title>
		<link>http://www.rorydriscoll.com/2009/01/25/energy-conservation-in-games/comment-page-1/#comment-91</link>
		<dc:creator>rory</dc:creator>
		<pubDate>Mon, 23 Mar 2009 01:31:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.rorydriscoll.com/?p=262#comment-91</guid>
		<description>Ah yes. I forgot that the constants weren&#039;t the result of the integral, but the inverse. So I mistakenly thought that numbers above one indicated a conservative approximation, when it&#039;s the exact opposite.

(n + 6) / (8 * pi) seems good since it is conservative and is within 5% of your normalization constant for n &gt;= 10, but the error ramps up to 25% at n = 0. It looks like it produces a better error on average (n between 0 and 100) than ( n + 8 ) / (8 * pi), but a worse worst case. I suppose the effect of using this would mean duller than expected specular reflections at very low specular powers.

I&#039;ll update the link to your derivation. Thanks for the help.</description>
		<content:encoded><![CDATA[<p>Ah yes. I forgot that the constants weren&#8217;t the result of the integral, but the inverse. So I mistakenly thought that numbers above one indicated a conservative approximation, when it&#8217;s the exact opposite.</p>
<p>(n + 6) / (8 * pi) seems good since it is conservative and is within 5% of your normalization constant for n >= 10, but the error ramps up to 25% at n = 0. It looks like it produces a better error on average (n between 0 and 100) than ( n + 8 ) / (8 * pi), but a worse worst case. I suppose the effect of using this would mean duller than expected specular reflections at very low specular powers.</p>
<p>I&#8217;ll update the link to your derivation. Thanks for the help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fabian "ryg" Giesen</title>
		<link>http://www.rorydriscoll.com/2009/01/25/energy-conservation-in-games/comment-page-1/#comment-90</link>
		<dc:creator>Fabian "ryg" Giesen</dc:creator>
		<pubDate>Sun, 22 Mar 2009 23:59:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.rorydriscoll.com/?p=262#comment-90</guid>
		<description>(n+2)(n+4) = n² + 6n + 8, so for medium-large n a more accurate cheap approximation would be (n+6)/8pi, not (n+8)/8pi. Also, (n+8)/8pi is not conservative; after all, it makes the BRDF integrate to more than 1, not less. I would however still very much like to know how it was derived.

The L=N variant is really the only special case of Blinn-Phong that&#039;s reasonably easy to write down in terms of angles analytically. For general L, the plane spanned by L and V (which contains H) doesn&#039;t contain N, so there&#039;s no easy way to write (N.H) in terms of the angles you know; I&#039;d like to see the (n+8)/8pi derivation because I&#039;d very much like to see how that issue is treated there.

Feel free to link to my derivation; however, I clean out my /stuff directory more or less regularly, so this is not a good candidate for a permanent link. I&#039;ve put up a copy of the derivation at (same URL)/articles/phong.pdf where it&#039;s safe.</description>
		<content:encoded><![CDATA[<p>(n+2)(n+4) = n² + 6n + 8, so for medium-large n a more accurate cheap approximation would be (n+6)/8pi, not (n+8)/8pi. Also, (n+8)/8pi is not conservative; after all, it makes the BRDF integrate to more than 1, not less. I would however still very much like to know how it was derived.</p>
<p>The L=N variant is really the only special case of Blinn-Phong that&#8217;s reasonably easy to write down in terms of angles analytically. For general L, the plane spanned by L and V (which contains H) doesn&#8217;t contain N, so there&#8217;s no easy way to write (N.H) in terms of the angles you know; I&#8217;d like to see the (n+8)/8pi derivation because I&#8217;d very much like to see how that issue is treated there.</p>
<p>Feel free to link to my derivation; however, I clean out my /stuff directory more or less regularly, so this is not a good candidate for a permanent link. I&#8217;ve put up a copy of the derivation at (same URL)/articles/phong.pdf where it&#8217;s safe.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rory</title>
		<link>http://www.rorydriscoll.com/2009/01/25/energy-conservation-in-games/comment-page-1/#comment-89</link>
		<dc:creator>rory</dc:creator>
		<pubDate>Sun, 22 Mar 2009 20:07:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.rorydriscoll.com/?p=262#comment-89</guid>
		<description>That&#039;s really interesting. I followed it through and it all makes sense to me. I doubt I would have come up with that myself, so thanks for showing the complete derivation. 

I wonder about the explanation of (n+8/8pi) even more now. I&#039;d be interested in hearing what Naty says about this when he gets back to you. I expect I&#039;ll meet him at GDC since we&#039;re both Activision employees now, so I&#039;ll try and bug him about this if I don&#039;t hear anything.

I used Maxima to graph the difference between the two functions ((n+8)/8pi)/((n+2)(n+4) / (8pi * (2^(-n/2) + n))), and it seems like it peaks very early (n = 8, error is 7.5%) and then asymptotes 0% error. It takes a long time to get down to anything close to 0% error though, so even at n=100, the difference is still 1.8%.

I wonder if the n+8/8*pi normalization factor is just a relatively cheap-to-compute conservative approximation of the version you derived?

I&#039;ll update my initial post with a link to your derivation if you don&#039;t mind.</description>
		<content:encoded><![CDATA[<p>That&#8217;s really interesting. I followed it through and it all makes sense to me. I doubt I would have come up with that myself, so thanks for showing the complete derivation. </p>
<p>I wonder about the explanation of (n+8/8pi) even more now. I&#8217;d be interested in hearing what Naty says about this when he gets back to you. I expect I&#8217;ll meet him at GDC since we&#8217;re both Activision employees now, so I&#8217;ll try and bug him about this if I don&#8217;t hear anything.</p>
<p>I used Maxima to graph the difference between the two functions ((n+8)/8pi)/((n+2)(n+4) / (8pi * (2^(-n/2) + n))), and it seems like it peaks very early (n = 8, error is 7.5%) and then asymptotes 0% error. It takes a long time to get down to anything close to 0% error though, so even at n=100, the difference is still 1.8%.</p>
<p>I wonder if the n+8/8*pi normalization factor is just a relatively cheap-to-compute conservative approximation of the version you derived?</p>
<p>I&#8217;ll update my initial post with a link to your derivation if you don&#8217;t mind.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fabian "ryg" Giesen</title>
		<link>http://www.rorydriscoll.com/2009/01/25/energy-conservation-in-games/comment-page-1/#comment-88</link>
		<dc:creator>Fabian "ryg" Giesen</dc:creator>
		<pubDate>Sun, 22 Mar 2009 03:51:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.rorydriscoll.com/?p=262#comment-88</guid>
		<description>Okay, I&#039;ve updated the PDF with a half-complete derivation of the Blinn-Phong normalization factor; this includes the complete evaluation of the integral, but is (currently) without a proof that the maximum amount of reflected energy occurs when L=N. There&#039;s probably an elegant way to prove this, but I didn&#039;t find it, and showing it directly from the integral seemed to messy to seriously pursue it. I did however do some numerical experiments and it does seem to check out.

The actual integration proceeds in a pretty straightforward fashion - one substitution (which yields a surprisingly neat term), one integration by parts to calculate the valuee (which turns it into a big mess), and then a bunch of algebra to simplify it down again (I&#039;ve kept more intermediate steps of algebraic simplifications than I normally would in a printed document, but after all the whole point of this exercise was to have a complete derivation).

Anyway, the whole story&#039;s got a punchline: the normalization factor I got is (n+2)(n+4) / (8pi * (2^(-n/2) + n)), not (n+8)/8pi. If you plot this factor against n, you&#039;ll notice that it really is close to linear in n, but not quite there.

I was pretty surprised about this result to say the least. I cross-checked the integral with Mathematica, and I also wrote a small test program that computes integrals of functions over the hemisphere using stratified Monte Carlo integration to be sure; I didn&#039;t want to rely on the analytical angle-based formulations too much, since it&#039;s very easy to mess up and accidentally take the wrong angle.

The result, using both analytical computations and the Monte Carlo integration test program, were that with n=16, the overall amount of reflected energy with L=N and the (n+8)/8pi normalization term is about 1.06 times L_i, while the (n+2)(n+4)/... variant derived in the PDF is 1.0 to within integration accuracy. Other values of n yield the same qualitative result: (n+8)/8pi is slightly too large.

After finding this out last weekend, I wrote a mail to Naty Hoffman (who apparently did the derivation for Real-Time Rendering 3rd Ed.), but I didn&#039;t get an answer yet, and I wanted to put this online before I lose my notes with the derivation, so here goes. :)</description>
		<content:encoded><![CDATA[<p>Okay, I&#8217;ve updated the PDF with a half-complete derivation of the Blinn-Phong normalization factor; this includes the complete evaluation of the integral, but is (currently) without a proof that the maximum amount of reflected energy occurs when L=N. There&#8217;s probably an elegant way to prove this, but I didn&#8217;t find it, and showing it directly from the integral seemed to messy to seriously pursue it. I did however do some numerical experiments and it does seem to check out.</p>
<p>The actual integration proceeds in a pretty straightforward fashion &#8211; one substitution (which yields a surprisingly neat term), one integration by parts to calculate the valuee (which turns it into a big mess), and then a bunch of algebra to simplify it down again (I&#8217;ve kept more intermediate steps of algebraic simplifications than I normally would in a printed document, but after all the whole point of this exercise was to have a complete derivation).</p>
<p>Anyway, the whole story&#8217;s got a punchline: the normalization factor I got is (n+2)(n+4) / (8pi * (2^(-n/2) + n)), not (n+8)/8pi. If you plot this factor against n, you&#8217;ll notice that it really is close to linear in n, but not quite there.</p>
<p>I was pretty surprised about this result to say the least. I cross-checked the integral with Mathematica, and I also wrote a small test program that computes integrals of functions over the hemisphere using stratified Monte Carlo integration to be sure; I didn&#8217;t want to rely on the analytical angle-based formulations too much, since it&#8217;s very easy to mess up and accidentally take the wrong angle.</p>
<p>The result, using both analytical computations and the Monte Carlo integration test program, were that with n=16, the overall amount of reflected energy with L=N and the (n+8)/8pi normalization term is about 1.06 times L_i, while the (n+2)(n+4)/&#8230; variant derived in the PDF is 1.0 to within integration accuracy. Other values of n yield the same qualitative result: (n+8)/8pi is slightly too large.</p>
<p>After finding this out last weekend, I wrote a mail to Naty Hoffman (who apparently did the derivation for Real-Time Rendering 3rd Ed.), but I didn&#8217;t get an answer yet, and I wanted to put this online before I lose my notes with the derivation, so here goes. <img src='http://www.rorydriscoll.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rory</title>
		<link>http://www.rorydriscoll.com/2009/01/25/energy-conservation-in-games/comment-page-1/#comment-85</link>
		<dc:creator>rory</dc:creator>
		<pubDate>Sat, 14 Mar 2009 17:38:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.rorydriscoll.com/?p=262#comment-85</guid>
		<description>Thanks for clearing that one up! I had to approve those comments with the links apparently. 

That derivation was simpler than I thought it was going to be. I didn&#039;t realise it was just for the original Phong model though. It still bugs me that the n+8/8pi hasn&#039;t been explained though.</description>
		<content:encoded><![CDATA[<p>Thanks for clearing that one up! I had to approve those comments with the links apparently. </p>
<p>That derivation was simpler than I thought it was going to be. I didn&#8217;t realise it was just for the original Phong model though. It still bugs me that the n+8/8pi hasn&#8217;t been explained though.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
