<?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: Deferred Cascaded Shadow Maps</title>
	<atom:link href="http://aras-p.info/blog/2009/11/04/deferred-cascaded-shadow-maps/feed/" rel="self" type="application/rss+xml" />
	<link>http://aras-p.info/blog/2009/11/04/deferred-cascaded-shadow-maps/</link>
	<description>Random thoughts of a triangle pusher</description>
	<lastBuildDate>Thu, 09 Feb 2012 07:56:51 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Szymon Swistun</title>
		<link>http://aras-p.info/blog/2009/11/04/deferred-cascaded-shadow-maps/comment-page-1/#comment-78566</link>
		<dc:creator>Szymon Swistun</dc:creator>
		<pubDate>Wed, 30 Mar 2011 02:32:25 +0000</pubDate>
		<guid isPermaLink="false">http://aras-p.info/blog/?p=434#comment-78566</guid>
		<description>@Aras Sorry, I just re-read your code snippet, initially I thought it was a weighted blur when I skimmed it now realize that&#039;s the code for selecting the uv&#039;s from the atlas, very clever (will actually &quot;read&quot; fully next time).</description>
		<content:encoded><![CDATA[<p>@Aras Sorry, I just re-read your code snippet, initially I thought it was a weighted blur when I skimmed it now realize that&#8217;s the code for selecting the uv&#8217;s from the atlas, very clever (will actually &#8220;read&#8221; fully next time).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Szymon Swistun</title>
		<link>http://aras-p.info/blog/2009/11/04/deferred-cascaded-shadow-maps/comment-page-1/#comment-78502</link>
		<dc:creator>Szymon Swistun</dc:creator>
		<pubDate>Tue, 29 Mar 2011 20:07:36 +0000</pubDate>
		<guid isPermaLink="false">http://aras-p.info/blog/?p=434#comment-78502</guid>
		<description>@Aras I imagined: render a volume for each cascade slice, and create a rejection mask in stencil for everything but the first cascade you want to compute.  Then run full quad with the right shadow matrix and texture uploaded, will only operate on pixels for that cascade.  Update stencil to mask away that cascade, and allow new cascade to be updated.  Repeat, full quad new matrix, new texture etc...  That way only running minimal pixel operations full screen for arbitrary number of cascades (computing only 1 uv per pixel), with exception of grabbing the depth once per pixel to do shadow test.

One way to create blur mask: box down sample full screen shadow mask to quarter rez by sampling 4 corners of 16 pixel block and average.  That&#039;s it.  Sample that smaller texture at full-screen, write to stencil where you alpha test based on whether bi linear sampled texture has any value not 0 or 1.  If it has a gradient i.e. blurred from box down sample, then it is a natural edge and naturally got dilated by the down sample.</description>
		<content:encoded><![CDATA[<p>@Aras I imagined: render a volume for each cascade slice, and create a rejection mask in stencil for everything but the first cascade you want to compute.  Then run full quad with the right shadow matrix and texture uploaded, will only operate on pixels for that cascade.  Update stencil to mask away that cascade, and allow new cascade to be updated.  Repeat, full quad new matrix, new texture etc&#8230;  That way only running minimal pixel operations full screen for arbitrary number of cascades (computing only 1 uv per pixel), with exception of grabbing the depth once per pixel to do shadow test.</p>
<p>One way to create blur mask: box down sample full screen shadow mask to quarter rez by sampling 4 corners of 16 pixel block and average.  That&#8217;s it.  Sample that smaller texture at full-screen, write to stencil where you alpha test based on whether bi linear sampled texture has any value not 0 or 1.  If it has a gradient i.e. blurred from box down sample, then it is a natural edge and naturally got dilated by the down sample.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aras Pranckevičius</title>
		<link>http://aras-p.info/blog/2009/11/04/deferred-cascaded-shadow-maps/comment-page-1/#comment-78493</link>
		<dc:creator>Aras Pranckevičius</dc:creator>
		<pubDate>Tue, 29 Mar 2011 19:25:17 +0000</pubDate>
		<guid isPermaLink="false">http://aras-p.info/blog/?p=434#comment-78493</guid>
		<description>@Szymon: what would stencil masking save in selecting the cascade? Per pixel, it just computes the final UV (couple compares &amp; several multiply-adds), see the code above.

But yeah, for blurring something could be done. IIRC, ATI had a technique on that back in the days. Not sure if they used stencil or just dynamic branching (might be latter, as it was to show off dynamic branching in Radeon X1xxx).

How do you create the mask? I&#039;d imagine you either need to sample shadowmap once, detect edges &amp; dilate them (into stencil... somehow); or sample shadowmap with a small amount of samples but quite widespread, and hope you won&#039;t miss some very thin shadows?</description>
		<content:encoded><![CDATA[<p>@Szymon: what would stencil masking save in selecting the cascade? Per pixel, it just computes the final UV (couple compares &#038; several multiply-adds), see the code above.</p>
<p>But yeah, for blurring something could be done. IIRC, ATI had a technique on that back in the days. Not sure if they used stencil or just dynamic branching (might be latter, as it was to show off dynamic branching in Radeon X1xxx).</p>
<p>How do you create the mask? I&#8217;d imagine you either need to sample shadowmap once, detect edges &#038; dilate them (into stencil&#8230; somehow); or sample shadowmap with a small amount of samples but quite widespread, and hope you won&#8217;t miss some very thin shadows?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Szymon Swistun</title>
		<link>http://aras-p.info/blog/2009/11/04/deferred-cascaded-shadow-maps/comment-page-1/#comment-78490</link>
		<dc:creator>Szymon Swistun</dc:creator>
		<pubDate>Tue, 29 Mar 2011 19:11:56 +0000</pubDate>
		<guid isPermaLink="false">http://aras-p.info/blog/?p=434#comment-78490</guid>
		<description>Yup, this is industry standard at this point.  Are you using Early-Stencil mask to get your &quot;each pixel selects correct map without branches&quot;? 

You can take a bit further by creating another screen space Early-Stencil edge mask ( actually very quickly, I got mine to ~0.5ms on PS3 ) and running your screen space blur pass only on the edges of the shadow mask.  I realized this couple of years ago, don&#039;t need to run a blur operation on all white or all black pixels, won&#039;t do anything, only need it along edges of the shadows that the mask creates. This should cut the cost of the blur to about 20% - 60% of total depending on shadow complexity in the screen at that time.</description>
		<content:encoded><![CDATA[<p>Yup, this is industry standard at this point.  Are you using Early-Stencil mask to get your &#8220;each pixel selects correct map without branches&#8221;? </p>
<p>You can take a bit further by creating another screen space Early-Stencil edge mask ( actually very quickly, I got mine to ~0.5ms on PS3 ) and running your screen space blur pass only on the edges of the shadow mask.  I realized this couple of years ago, don&#8217;t need to run a blur operation on all white or all black pixels, won&#8217;t do anything, only need it along edges of the shadows that the mask creates. This should cut the cost of the blur to about 20% &#8211; 60% of total depending on shadow complexity in the screen at that time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aras Pranckevičius</title>
		<link>http://aras-p.info/blog/2009/11/04/deferred-cascaded-shadow-maps/comment-page-1/#comment-78489</link>
		<dc:creator>Aras Pranckevičius</dc:creator>
		<pubDate>Tue, 29 Mar 2011 19:04:57 +0000</pubDate>
		<guid isPermaLink="false">http://aras-p.info/blog/?p=434#comment-78489</guid>
		<description>@Wolf: yeah, very well might be ;) I think I read your article halfway through Unity&#039;s shadow system development, and IIRC the trick of gathering shadow from cascades without branches came from there. But it&#039;s all quite hazy now, feels like ages ago!</description>
		<content:encoded><![CDATA[<p>@Wolf: yeah, very well might be ;) I think I read your article halfway through Unity&#8217;s shadow system development, and IIRC the trick of gathering shadow from cascades without branches came from there. But it&#8217;s all quite hazy now, feels like ages ago!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wolfgang Engel</title>
		<link>http://aras-p.info/blog/2009/11/04/deferred-cascaded-shadow-maps/comment-page-1/#comment-78468</link>
		<dc:creator>Wolfgang Engel</dc:creator>
		<pubDate>Tue, 29 Mar 2011 16:53:01 +0000</pubDate>
		<guid isPermaLink="false">http://aras-p.info/blog/?p=434#comment-78468</guid>
		<description>I think I coined the term Deferred Cascaded Shadow Maps and the term shadow collector in 2005 in my ShaderX article ...</description>
		<content:encoded><![CDATA[<p>I think I coined the term Deferred Cascaded Shadow Maps and the term shadow collector in 2005 in my ShaderX article &#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aras Pranckevičius</title>
		<link>http://aras-p.info/blog/2009/11/04/deferred-cascaded-shadow-maps/comment-page-1/#comment-29892</link>
		<dc:creator>Aras Pranckevičius</dc:creator>
		<pubDate>Wed, 07 Apr 2010 18:46:47 +0000</pubDate>
		<guid isPermaLink="false">http://aras-p.info/blog/?p=434#comment-29892</guid>
		<description>@CodingCat: thanks for sharing!</description>
		<content:encoded><![CDATA[<p>@CodingCat: thanks for sharing!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: CodingCat</title>
		<link>http://aras-p.info/blog/2009/11/04/deferred-cascaded-shadow-maps/comment-page-1/#comment-29884</link>
		<dc:creator>CodingCat</dc:creator>
		<pubDate>Wed, 07 Apr 2010 14:28:54 +0000</pubDate>
		<guid isPermaLink="false">http://aras-p.info/blog/?p=434#comment-29884</guid>
		<description>So I continued working on this topic and finally seem to have come to a solution. In case anyone is still interested, I just published a rather lengthy article on this whole AA matter: http://www.alphanew.net/index.php?section=articles&amp;site=multisampling

Summed up in one sentence, I am now shifting the shadow mask look-up coordinate away from polygon edges towards the polygon center on edge pixels, thus rather elegantly circumventing wrongly shadowed pixels.</description>
		<content:encoded><![CDATA[<p>So I continued working on this topic and finally seem to have come to a solution. In case anyone is still interested, I just published a rather lengthy article on this whole AA matter: <a href="http://www.alphanew.net/index.php?section=articles&#038;site=multisampling" rel="nofollow">http://www.alphanew.net/index.php?section=articles&#038;site=multisampling</a></p>
<p>Summed up in one sentence, I am now shifting the shadow mask look-up coordinate away from polygon edges towards the polygon center on edge pixels, thus rather elegantly circumventing wrongly shadowed pixels.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aras Pranckevičius</title>
		<link>http://aras-p.info/blog/2009/11/04/deferred-cascaded-shadow-maps/comment-page-1/#comment-23045</link>
		<dc:creator>Aras Pranckevičius</dc:creator>
		<pubDate>Sun, 22 Nov 2009 12:00:38 +0000</pubDate>
		<guid isPermaLink="false">http://aras-p.info/blog/?p=434#comment-23045</guid>
		<description>@CodingCat: I just ignored the whole AA issue. So yes, when AA is used the shadow term is sometimes wrong on edges. So far I haven&#039;t heard lots of complaints from Unity users, so I assume everyone is fine with that :)</description>
		<content:encoded><![CDATA[<p>@CodingCat: I just ignored the whole AA issue. So yes, when AA is used the shadow term is sometimes wrong on edges. So far I haven&#8217;t heard lots of complaints from Unity users, so I assume everyone is fine with that :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: CodingCat</title>
		<link>http://aras-p.info/blog/2009/11/04/deferred-cascaded-shadow-maps/comment-page-1/#comment-23042</link>
		<dc:creator>CodingCat</dc:creator>
		<pubDate>Sun, 22 Nov 2009 10:11:38 +0000</pubDate>
		<guid isPermaLink="false">http://aras-p.info/blog/?p=434#comment-23042</guid>
		<description>I&#039;m doing this pretty much the same way, but I had a very hard time making this work with anti-aliasing (DirectX 9). In the end, I added a resolve pass that tries to fill invalid gaps with some approximate shadow value (the darkest of all neighbors after applying some validity and continuity heuristics) to get rid of all the wrongly lit edges. This has artifacts of its own, but at least it doesn&#039;t look totally wrong. The big drawback here is that this resolve pass is not separable and quite expensive.

Any experience on this issue?</description>
		<content:encoded><![CDATA[<p>I&#8217;m doing this pretty much the same way, but I had a very hard time making this work with anti-aliasing (DirectX 9). In the end, I added a resolve pass that tries to fill invalid gaps with some approximate shadow value (the darkest of all neighbors after applying some validity and continuity heuristics) to get rid of all the wrongly lit edges. This has artifacts of its own, but at least it doesn&#8217;t look totally wrong. The big drawback here is that this resolve pass is not separable and quite expensive.</p>
<p>Any experience on this issue?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aras Pranckevičius</title>
		<link>http://aras-p.info/blog/2009/11/04/deferred-cascaded-shadow-maps/comment-page-1/#comment-22726</link>
		<dc:creator>Aras Pranckevičius</dc:creator>
		<pubDate>Tue, 10 Nov 2009 06:30:25 +0000</pubDate>
		<guid isPermaLink="false">http://aras-p.info/blog/?p=434#comment-22726</guid>
		<description>@Alex: nice!</description>
		<content:encoded><![CDATA[<p>@Alex: nice!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://aras-p.info/blog/2009/11/04/deferred-cascaded-shadow-maps/comment-page-1/#comment-22724</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Tue, 10 Nov 2009 04:34:48 +0000</pubDate>
		<guid isPermaLink="false">http://aras-p.info/blog/?p=434#comment-22724</guid>
		<description>For the weights calculation, I used this formulation:
    float4 weights = ( z &gt; _LightSplitsNear );
    weights.xyz -= weights.yzw;
The rest is the same.
_LightSplitsNear has to be ordered from nearest to furthest, the cascades should overlap, and if it&#039;s past the furthest cascade&#039;s far then &#039;weights&#039; doesn&#039;t return to all zeroes.</description>
		<content:encoded><![CDATA[<p>For the weights calculation, I used this formulation:<br />
    float4 weights = ( z &gt; _LightSplitsNear );<br />
    weights.xyz -= weights.yzw;<br />
The rest is the same.<br />
_LightSplitsNear has to be ordered from nearest to furthest, the cascades should overlap, and if it&#8217;s past the furthest cascade&#8217;s far then &#8216;weights&#8217; doesn&#8217;t return to all zeroes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon Kozlov</title>
		<link>http://aras-p.info/blog/2009/11/04/deferred-cascaded-shadow-maps/comment-page-1/#comment-22530</link>
		<dc:creator>Simon Kozlov</dc:creator>
		<pubDate>Thu, 05 Nov 2009 09:05:11 +0000</pubDate>
		<guid isPermaLink="false">http://aras-p.info/blog/?p=434#comment-22530</guid>
		<description>I did that around 2003 in my trucks game. Unfortunately Geforce3 didn&#039;t allow me to do fancy blur scheme so it was just blurring outward with semi-acceptable radius.

Can still see artifacts on recent screenshots though :(</description>
		<content:encoded><![CDATA[<p>I did that around 2003 in my trucks game. Unfortunately Geforce3 didn&#8217;t allow me to do fancy blur scheme so it was just blurring outward with semi-acceptable radius.</p>
<p>Can still see artifacts on recent screenshots though :(</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom</title>
		<link>http://aras-p.info/blog/2009/11/04/deferred-cascaded-shadow-maps/comment-page-1/#comment-22523</link>
		<dc:creator>Tom</dc:creator>
		<pubDate>Wed, 04 Nov 2009 22:20:28 +0000</pubDate>
		<guid isPermaLink="false">http://aras-p.info/blog/?p=434#comment-22523</guid>
		<description>CryEngine 2 did something similar but stored the shadows for 4 different lights into the 4 channels of the screen space shadow buffer.</description>
		<content:encoded><![CDATA[<p>CryEngine 2 did something similar but stored the shadows for 4 different lights into the 4 channels of the screen space shadow buffer.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: steve</title>
		<link>http://aras-p.info/blog/2009/11/04/deferred-cascaded-shadow-maps/comment-page-1/#comment-22495</link>
		<dc:creator>steve</dc:creator>
		<pubDate>Wed, 04 Nov 2009 16:03:44 +0000</pubDate>
		<guid isPermaLink="false">http://aras-p.info/blog/?p=434#comment-22495</guid>
		<description>Yep, definitely deferred shadowing :) The variable sized filter and depth discontinuity discards are staples in SSAO too. Nice work!</description>
		<content:encoded><![CDATA[<p>Yep, definitely deferred shadowing :) The variable sized filter and depth discontinuity discards are staples in SSAO too. Nice work!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ste</title>
		<link>http://aras-p.info/blog/2009/11/04/deferred-cascaded-shadow-maps/comment-page-1/#comment-22494</link>
		<dc:creator>Ste</dc:creator>
		<pubDate>Wed, 04 Nov 2009 14:52:00 +0000</pubDate>
		<guid isPermaLink="false">http://aras-p.info/blog/?p=434#comment-22494</guid>
		<description>This is very similar to one of Wolf Engel&#039;s techniques in ShaderX5 i think :). Not sure if you&#039;ve seen that or not.</description>
		<content:encoded><![CDATA[<p>This is very similar to one of Wolf Engel&#8217;s techniques in ShaderX5 i think :). Not sure if you&#8217;ve seen that or not.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: repi</title>
		<link>http://aras-p.info/blog/2009/11/04/deferred-cascaded-shadow-maps/comment-page-1/#comment-22493</link>
		<dc:creator>repi</dc:creator>
		<pubDate>Wed, 04 Nov 2009 14:47:44 +0000</pubDate>
		<guid isPermaLink="false">http://aras-p.info/blog/?p=434#comment-22493</guid>
		<description>Good post, and I like the term &quot;deferred shadowing&quot; for this as well!</description>
		<content:encoded><![CDATA[<p>Good post, and I like the term &#8220;deferred shadowing&#8221; for this as well!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

