<?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: April Sample Online!</title>
	<atom:link href="http://www.catalinzima.com/2008/05/april-sample-online/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.catalinzima.com/2008/05/april-sample-online/</link>
	<description>XNA Tutorials, Samples and Thoughts</description>
	<lastBuildDate>Wed, 01 Feb 2012 17:36:08 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
	<item>
		<title>By: Phil Forbes</title>
		<link>http://www.catalinzima.com/2008/05/april-sample-online/comment-page-1/#comment-15460</link>
		<dc:creator>Phil Forbes</dc:creator>
		<pubDate>Sat, 10 Jan 2009 19:49:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.catalinzima.com/?p=323#comment-15460</guid>
		<description>hi
bgrbt9ga2k0lvz5w
good luck</description>
		<content:encoded><![CDATA[<p>hi<br />
bgrbt9ga2k0lvz5w<br />
good luck</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SiliconMind</title>
		<link>http://www.catalinzima.com/2008/05/april-sample-online/comment-page-1/#comment-10248</link>
		<dc:creator>SiliconMind</dc:creator>
		<pubDate>Thu, 14 Aug 2008 09:51:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.catalinzima.com/?p=323#comment-10248</guid>
		<description>You are probably right. The moment I&#039;d clicked &quot;Post Comment&quot; I&#039;ve realized that when drawing objects on top of a shadow would cause serious problems.
Anyway thank you for your response and keep up the good work :) I hope that some day you will be able to write improved version of your sample, maybe transforming it into tutorial. It seems like quite a lot of people could benefit from that.</description>
		<content:encoded><![CDATA[<p>You are probably right. The moment I&#8217;d clicked &#8220;Post Comment&#8221; I&#8217;ve realized that when drawing objects on top of a shadow would cause serious problems.<br />
Anyway thank you for your response and keep up the good work <img src='http://www.catalinzima.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I hope that some day you will be able to write improved version of your sample, maybe transforming it into tutorial. It seems like quite a lot of people could benefit from that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Catalin Zima</title>
		<link>http://www.catalinzima.com/2008/05/april-sample-online/comment-page-1/#comment-10243</link>
		<dc:creator>Catalin Zima</dc:creator>
		<pubDate>Wed, 13 Aug 2008 21:21:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.catalinzima.com/?p=323#comment-10243</guid>
		<description>To be honest, I&#039;m not really sure. Drawing the object on top of the shadow is not such a good idea, because it may cause shadowed objects to actually be drawn (like object lying in the shadow of other objects, and so on)


What would probably be best on the long run is the idea to also assign a &quot;height&quot; when first processing the shadows, and when drawing the objects, only apply shadows on objects lower than this height. And an object is set to be a little higher than its own shadow. This would probably lead to the best result, where small objects don&#039;t case shadows on objects larger than them. But it would also mean rewriting the way shadows are combined with the scene, adding a bit more shader complexity.</description>
		<content:encoded><![CDATA[<p>To be honest, I&#8217;m not really sure. Drawing the object on top of the shadow is not such a good idea, because it may cause shadowed objects to actually be drawn (like object lying in the shadow of other objects, and so on)</p>
<p>What would probably be best on the long run is the idea to also assign a &#8220;height&#8221; when first processing the shadows, and when drawing the objects, only apply shadows on objects lower than this height. And an object is set to be a little higher than its own shadow. This would probably lead to the best result, where small objects don&#8217;t case shadows on objects larger than them. But it would also mean rewriting the way shadows are combined with the scene, adding a bit more shader complexity.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SiliconMind</title>
		<link>http://www.catalinzima.com/2008/05/april-sample-online/comment-page-1/#comment-10242</link>
		<dc:creator>SiliconMind</dc:creator>
		<pubDate>Wed, 13 Aug 2008 21:13:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.catalinzima.com/?p=323#comment-10242</guid>
		<description>Good to know that my &quot;common sense logic&quot; is not that bad after all :D
Unfortunately there is lots of (and i mean really) lots of work before me until I&#039;ll be able to do it myself. Anyway, could you please share your thoughts and say which way would you go? Would you draw a shadow casting object on top of a shadow itself or would you use a pixel shader to &quot;remove&quot; portions of a shadow that cover the shadow casting object? Or maybe some other way? Any clues?</description>
		<content:encoded><![CDATA[<p>Good to know that my &#8220;common sense logic&#8221; is not that bad after all <img src='http://www.catalinzima.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /><br />
Unfortunately there is lots of (and i mean really) lots of work before me until I&#8217;ll be able to do it myself. Anyway, could you please share your thoughts and say which way would you go? Would you draw a shadow casting object on top of a shadow itself or would you use a pixel shader to &#8220;remove&#8221; portions of a shadow that cover the shadow casting object? Or maybe some other way? Any clues?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Catalin Zima</title>
		<link>http://www.catalinzima.com/2008/05/april-sample-online/comment-page-1/#comment-10239</link>
		<dc:creator>Catalin Zima</dc:creator>
		<pubDate>Wed, 13 Aug 2008 14:50:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.catalinzima.com/?p=323#comment-10239</guid>
		<description>Yes. That&#039;s the best idea I could also come up with :) I just forgot about it until you reminded me.

I decided not to use it in the sample, because I though the extra tinkering needed to remove the artifacts might confuse some people.

But mainly, that&#039;s the way I would go about it, if I were to modify the sample.</description>
		<content:encoded><![CDATA[<p>Yes. That&#8217;s the best idea I could also come up with <img src='http://www.catalinzima.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I just forgot about it until you reminded me.</p>
<p>I decided not to use it in the sample, because I though the extra tinkering needed to remove the artifacts might confuse some people.</p>
<p>But mainly, that&#8217;s the way I would go about it, if I were to modify the sample.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SiliconMind</title>
		<link>http://www.catalinzima.com/2008/05/april-sample-online/comment-page-1/#comment-10238</link>
		<dc:creator>SiliconMind</dc:creator>
		<pubDate>Wed, 13 Aug 2008 12:22:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.catalinzima.com/?p=323#comment-10238</guid>
		<description>Catalin, you are probably right, but since Xbox360 is a DX9 device, waiting for DX10 in XNA would be not much of solution for me :/

But, what if we compute a line that stretches across a polygon that is supposed to cast shadow. This line would connect the two most outer points of that polygon, the ones that are on the edges of your shadow. Then we could use that line for calculating shadow using Manders method. Off course such a shadow would partially cover the shadow casting object itself, but then we could draw that object on top of the shadow layer or maybe use a pixel shader to &quot;remove&quot; parts of a shadow that &quot;intersect&quot; with the shadow casting object itself.

Again this is only a rough idea, based on my &quot;common sense logic&quot; and not a deep knowledge of the XNA and shaders. The knowledge which i unfortunately don&#039;t posses (yet) ;)</description>
		<content:encoded><![CDATA[<p>Catalin, you are probably right, but since Xbox360 is a DX9 device, waiting for DX10 in XNA would be not much of solution for me :/</p>
<p>But, what if we compute a line that stretches across a polygon that is supposed to cast shadow. This line would connect the two most outer points of that polygon, the ones that are on the edges of your shadow. Then we could use that line for calculating shadow using Manders method. Off course such a shadow would partially cover the shadow casting object itself, but then we could draw that object on top of the shadow layer or maybe use a pixel shader to &#8220;remove&#8221; parts of a shadow that &#8220;intersect&#8221; with the shadow casting object itself.</p>
<p>Again this is only a rough idea, based on my &#8220;common sense logic&#8221; and not a deep knowledge of the XNA and shaders. The knowledge which i unfortunately don&#8217;t posses (yet) <img src='http://www.catalinzima.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Catalin Zima</title>
		<link>http://www.catalinzima.com/2008/05/april-sample-online/comment-page-1/#comment-10235</link>
		<dc:creator>Catalin Zima</dc:creator>
		<pubDate>Tue, 12 Aug 2008 22:32:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.catalinzima.com/?p=323#comment-10235</guid>
		<description>Yes, I&#039;m aware of Manders&#039; technique. I though hard about doing all those computations on the GPU myself, but there is a big difference between our samples.
He only has lines for which to draw shadows, while I have polygons with arbitrary number of edges. For a line, no matter of the light&#039;s position relative to it, the shadow always has the same shape. This is not so for a polygon, and depends both on the shape of the polygon and on the position of the light. 

One way to do this would be to draw the shadow volumes for each edge of the polygon, in the same way as Manders draws shadows for his lines, but depending on the level of detail of that polygon, this could result in a great number of Draw calls (order of tens), as opposed to a single Draw call for the whole object&#039;s shadow, as it happens now. These add up, and may actually hurt performance more than benefit it.

This is one area where DirectX10 geometry shaders would come in handy, as they could be used to generate the shadow&#039;s geometry on the GPU, for any convex shape imaginable. But since XNA is DX9 only, for now I&#039;ll have to stick to doing all this on the CPU.

One other idea would be to move these computations on another thread, and use multi-threading, but this is dangerous territory as well.</description>
		<content:encoded><![CDATA[<p>Yes, I&#8217;m aware of Manders&#8217; technique. I though hard about doing all those computations on the GPU myself, but there is a big difference between our samples.<br />
He only has lines for which to draw shadows, while I have polygons with arbitrary number of edges. For a line, no matter of the light&#8217;s position relative to it, the shadow always has the same shape. This is not so for a polygon, and depends both on the shape of the polygon and on the position of the light. </p>
<p>One way to do this would be to draw the shadow volumes for each edge of the polygon, in the same way as Manders draws shadows for his lines, but depending on the level of detail of that polygon, this could result in a great number of Draw calls (order of tens), as opposed to a single Draw call for the whole object&#8217;s shadow, as it happens now. These add up, and may actually hurt performance more than benefit it.</p>
<p>This is one area where DirectX10 geometry shaders would come in handy, as they could be used to generate the shadow&#8217;s geometry on the GPU, for any convex shape imaginable. But since XNA is DX9 only, for now I&#8217;ll have to stick to doing all this on the CPU.</p>
<p>One other idea would be to move these computations on another thread, and use multi-threading, but this is dangerous territory as well.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SiliconMind</title>
		<link>http://www.catalinzima.com/2008/05/april-sample-online/comment-page-1/#comment-10234</link>
		<dc:creator>SiliconMind</dc:creator>
		<pubDate>Tue, 12 Aug 2008 22:16:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.catalinzima.com/?p=323#comment-10234</guid>
		<description>Hey,
first of all - great job! After i&#039;ve finally managed to understand your code (after reading some gamedev.net and others) things are really getting into their places in my head :) This is great material for a full blown tutorial on 2D shadows. I hope you&#039;ll find some time to write it in the future.

The thing that makes me wonder is the optimization of your code. I&#039;m a total noob when it comes to the XNA (although I&#039;d written zillions lines of WinForms code) I wonder if there is a way to get done the heavy lifting by the shaders? I mainly refer to the ConvexHull.DrawShadows(...) method. Mike on his msdn blog draws his 2D shadows using shaders http://blogs.msdn.com/manders/archive/2007/03/14/shadows-in-2d.aspx although for now I can&#039;t make much of his article :(

As I wrote I&#039;m totally new to the XNA and shaders thing, but it seems like this can be done. Maybe you could spare a few words on this? This would make your code sample completely awesome and maybe we all could learn from it something valuable ;)</description>
		<content:encoded><![CDATA[<p>Hey,<br />
first of all &#8211; great job! After i&#8217;ve finally managed to understand your code (after reading some gamedev.net and others) things are really getting into their places in my head <img src='http://www.catalinzima.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  This is great material for a full blown tutorial on 2D shadows. I hope you&#8217;ll find some time to write it in the future.</p>
<p>The thing that makes me wonder is the optimization of your code. I&#8217;m a total noob when it comes to the XNA (although I&#8217;d written zillions lines of WinForms code) I wonder if there is a way to get done the heavy lifting by the shaders? I mainly refer to the ConvexHull.DrawShadows(&#8230;) method. Mike on his msdn blog draws his 2D shadows using shaders <a href="http://blogs.msdn.com/manders/archive/2007/03/14/shadows-in-2d.aspx" rel="nofollow">http://blogs.msdn.com/manders/archive/2007/03/14/shadows-in-2d.aspx</a> although for now I can&#8217;t make much of his article <img src='http://www.catalinzima.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>As I wrote I&#8217;m totally new to the XNA and shaders thing, but it seems like this can be done. Maybe you could spare a few words on this? This would make your code sample completely awesome and maybe we all could learn from it something valuable <img src='http://www.catalinzima.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Catalin Zima</title>
		<link>http://www.catalinzima.com/2008/05/april-sample-online/comment-page-1/#comment-7659</link>
		<dc:creator>Catalin Zima</dc:creator>
		<pubDate>Tue, 03 Jun 2008 15:27:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.catalinzima.com/?p=323#comment-7659</guid>
		<description>I&#039;ll look into it later today and tomorrow, and I&#039;ll let you know.</description>
		<content:encoded><![CDATA[<p>I&#8217;ll look into it later today and tomorrow, and I&#8217;ll let you know.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anton</title>
		<link>http://www.catalinzima.com/2008/05/april-sample-online/comment-page-1/#comment-7657</link>
		<dc:creator>Anton</dc:creator>
		<pubDate>Tue, 03 Jun 2008 14:44:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.catalinzima.com/?p=323#comment-7657</guid>
		<description>First of all forgive me for bad English, I from Ukraine.
I started to learn XNA recently together with C #, therefore many things for me remain not clear. I hope you will help me to solve my problem. The matter is that I want render objects without shadow on it. I.e.only light gradient must be on objects, and shadow must be rendered on background. 
How it is possible to make it?
If i draw objects and light texture on top of rendered scene(shadows and objects) it&#039;s ends up with great performance hit...

P.S. This (http://img237.imageshack.us/my.php?image=shadowsxp7.jpg) picture describe my case.

In advance thanks.</description>
		<content:encoded><![CDATA[<p>First of all forgive me for bad English, I from Ukraine.<br />
I started to learn XNA recently together with C #, therefore many things for me remain not clear. I hope you will help me to solve my problem. The matter is that I want render objects without shadow on it. I.e.only light gradient must be on objects, and shadow must be rendered on background.<br />
How it is possible to make it?<br />
If i draw objects and light texture on top of rendered scene(shadows and objects) it&#8217;s ends up with great performance hit&#8230;</p>
<p>P.S. This (<a href="http://img237.imageshack.us/my.php?image=shadowsxp7.jpg" rel="nofollow">http://img237.imageshack.us/my.php?image=shadowsxp7.jpg</a>) picture describe my case.</p>
<p>In advance thanks.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

