<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.xna.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>General</title><link>http://forums.xna.com/forums/32.aspx</link><description>Don't know where to post your question? Post it here!</description><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 0.0)</generator><item><title>Re: Premultiplied Alpha - How to implement in XNA?</title><link>http://forums.xna.com/forums/thread/88765.aspx</link><pubDate>Tue, 09 Sep 2008 19:35:24 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:88765</guid><dc:creator>simiansoup</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/88765.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=32&amp;PostID=88765</wfw:commentRss><description>Thank you very much for you help!</description></item><item><title>Re: Premultiplied Alpha - How to implement in XNA?</title><link>http://forums.xna.com/forums/thread/88760.aspx</link><pubDate>Tue, 09 Sep 2008 19:13:45 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:88760</guid><dc:creator>Shawn Hargreaves</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/88760.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=32&amp;PostID=88760</wfw:commentRss><description>If you have a tool that supports multiple layers (Photoshop, Gimp, Paint.NET, etc) you can make a copy of your alpha channel on a second layer, then set this to multiply with the main layer.&lt;br /&gt;
&lt;p&gt;If I was making a game that used a lot of premultiplied alpha, I&amp;#39;d probably automate this using a custom content processor though. This would be a great use for a custom processor: it would be trivial to make one that premultiplies the texture RGB by the alpha, thus saving the need to manually do this inside your paint program.&lt;/p&gt;</description></item><item><title>Re: Premultiplied Alpha - How to implement in XNA?</title><link>http://forums.xna.com/forums/thread/88743.aspx</link><pubDate>Tue, 09 Sep 2008 18:39:20 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:88743</guid><dc:creator>simiansoup</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/88743.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=32&amp;PostID=88743</wfw:commentRss><description>&lt;p&gt;Hello ,&lt;/p&gt;
&lt;p&gt;I would like to play about with pre-multiplied alpha but I&amp;#39;m a bit confused on how you pre-multipy the alpha channel with the source image.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve got paint shop pro and&amp;nbsp;gimp and was wondering if some one could point me in the right direction on how you would pre-multiply (prem0.png) with (prem1.png) to obtain (prem3.png)&lt;/p&gt;
&lt;p&gt;In case anyone was wondering the png I&amp;#39;m refrencing are the ones in the post above.&lt;/p&gt;
&lt;p&gt;Thank you.&lt;/p&gt;
&lt;p&gt;phill&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Premultiplied Alpha - How to implement in XNA?</title><link>http://forums.xna.com/forums/thread/88606.aspx</link><pubDate>Tue, 09 Sep 2008 03:46:00 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:88606</guid><dc:creator>StatusUnknown</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/88606.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=32&amp;PostID=88606</wfw:commentRss><description>&lt;p&gt;It&amp;#39;s nothing to do with the code, it&amp;#39;s what you do to the source image...&lt;/p&gt;
&lt;p&gt;For example, given the following image:&lt;/p&gt;
&lt;img src="http://hungryspoon.com/random/prem0.png" alt="" /&gt;
&lt;p&gt;With the following Alpha Channel:&lt;/p&gt;
&lt;img src="http://hungryspoon.com/random/prem1.png" alt="" /&gt;
&lt;p&gt;Then, the pre-mulitplied version has the RGB premultiplied by alpha:&lt;/p&gt;
&lt;img src="http://hungryspoon.com/random/prem2.png" alt="" /&gt;
&lt;p&gt;The image retains the alpha channel, it&amp;#39;s just the RGB changes.&lt;/p&gt;</description></item><item><title>Re: Premultiplied Alpha - How to implement in XNA?</title><link>http://forums.xna.com/forums/thread/88418.aspx</link><pubDate>Mon, 08 Sep 2008 14:17:13 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:88418</guid><dc:creator>Onions</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/88418.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=32&amp;PostID=88418</wfw:commentRss><description>&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="http://forums.xna.com//Themes/default/images/icon-quote.gif"&gt; &lt;strong&gt;StatusUnknown:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;
&lt;p&gt;Premultiplied alpha requires an extra step to work correctly:&lt;/p&gt;
&lt;p&gt;That step is premultiplying your texture by it&amp;#39;s alpha channel. :-)&lt;/p&gt;
&lt;p&gt;..&lt;/p&gt;
&lt;p&gt;In other words, the areas of the texture that have an alpha of zero should also have a colour of zero. Alpha of 0.5 should have colours half their normal brightness, etc. The screenshot you show seems to suggest you are not changing your texture.&lt;/p&gt;
&lt;p&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Would you mind, then, showing me some sample code that would get the result I&amp;#39;m wanting? I&amp;#39;d appreciate it if so.&lt;/p&gt;</description></item><item><title>Re: Premultiplied Alpha - How to implement in XNA?</title><link>http://forums.xna.com/forums/thread/88307.aspx</link><pubDate>Mon, 08 Sep 2008 01:54:28 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:88307</guid><dc:creator>StatusUnknown</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/88307.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=32&amp;PostID=88307</wfw:commentRss><description>&lt;p&gt;Premultiplied alpha requires an extra step to work correctly:&lt;/p&gt;
&lt;p&gt;That step is premultiplying your texture by it&amp;#39;s alpha channel. :-)&lt;/p&gt;
&lt;p&gt;..&lt;/p&gt;

&lt;p&gt;In other words, the areas of the texture that have an alpha of zero should also have a colour of zero. Alpha of 0.5 should have colours half their normal brightness, etc. The screenshot you show seems to suggest you are not changing your texture.&lt;/p&gt;</description></item><item><title>Re: Premultiplied Alpha - How to implement in XNA?</title><link>http://forums.xna.com/forums/thread/88226.aspx</link><pubDate>Sun, 07 Sep 2008 19:16:42 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:88226</guid><dc:creator>Shawn Hargreaves</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/88226.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=32&amp;PostID=88226</wfw:commentRss><description>PIX is part of the DirectX SDK.
&lt;p&gt;&lt;a href="http://blogs.msdn.com/manders/archive/2006/12/15/a-painless-introduction-to-pix-for-windows.aspx"&gt;http://blogs.msdn.com/manders/archive/2006/12/15/a-painless-introduction-to-pix-for-windows.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://bittermanandy.wordpress.com/2008/09/01/tools-of-the-trade-part-four-pix/"&gt;http://bittermanandy.wordpress.com/2008/09/01/tools-of-the-trade-part-four-pix/&lt;/a&gt;&lt;/p&gt;
&lt;br /&gt;</description></item><item><title>Re: Premultiplied Alpha - How to implement in XNA?</title><link>http://forums.xna.com/forums/thread/88067.aspx</link><pubDate>Sat, 06 Sep 2008 18:43:04 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:88067</guid><dc:creator>Onions</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/88067.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=32&amp;PostID=88067</wfw:commentRss><description>&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="http://forums.xna.com//Themes/default/images/icon-quote.gif"&gt; &lt;strong&gt;Shawn Hargreaves:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;What format are your rendertargets?
&lt;p&gt;As I said before, PIX is by far the best way to debug this kind of thing. You can work through on paper what result you would expect for each blending operation you are applying, then look in PIX to see what result you actually got, and pretty quickly hone in one wherever your program is deviating from what you expected.&lt;/p&gt;
&lt;p&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am using SurfaceFormat.Color.&lt;/p&gt;
&lt;p&gt;And I will look into this PIX you speak of. Is this a seperate program, or part of XNA/GameStudio?&lt;/p&gt;</description></item><item><title>Re: Premultiplied Alpha - How to implement in XNA?</title><link>http://forums.xna.com/forums/thread/88037.aspx</link><pubDate>Sat, 06 Sep 2008 16:02:46 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:88037</guid><dc:creator>Shawn Hargreaves</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/88037.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=32&amp;PostID=88037</wfw:commentRss><description>What format are your rendertargets?
&lt;p&gt;As I said before, PIX is by far the best way to debug this kind of thing. You can work through on paper what result you would expect for each blending operation you are applying, then look in PIX to see what result you actually got, and pretty quickly hone in one wherever your program is deviating from what you expected.&lt;/p&gt;
&lt;br /&gt;</description></item><item><title>Re: Premultiplied Alpha - How to implement in XNA?</title><link>http://forums.xna.com/forums/thread/87959.aspx</link><pubDate>Sat, 06 Sep 2008 01:32:48 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:87959</guid><dc:creator>Onions</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/87959.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=32&amp;PostID=87959</wfw:commentRss><description>&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="http://forums.xna.com//Themes/default/images/icon-quote.gif"&gt; &lt;strong&gt;Shawn Hargreaves:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
Wild guess: are you clearing your rendertargets properly? What color do you clear them to?&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I either clear them like such &amp;quot;&lt;font size="2"&gt;GraphicsDevice.Clear(&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;Color&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.TransparentBlack)&amp;quot; (if I don&amp;#39;t want to clear the screen), or like so &amp;quot;&lt;font size="2"&gt;GraphicsDevice.Clear(BG_Color)&amp;quot; (where BG_Color is any color I specifiy).&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;In the two screenshots I showed, I first rendered&amp;nbsp;to a rendertarget a blank cleared screen&amp;nbsp;using the color red. I then rendered everything else you&amp;nbsp;see in the screenshots (2 PNG images) to a rendertarget&amp;nbsp;clearing the screen with TransparentBlack. After that I then render the two render targets (now texture2Ds) to my main buffer - first the red screen, then the 2 PNG images.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;EDIT: And yes, I did read over Tom Forsyth&amp;#39;s article - however, I&amp;#39;m unsure how to implement what he said into XNA...&lt;font size="2"&gt;&lt;/p&gt;
&lt;/font&gt;&lt;/font&gt;</description></item><item><title>Re: Premultiplied Alpha - How to implement in XNA?</title><link>http://forums.xna.com/forums/thread/87957.aspx</link><pubDate>Sat, 06 Sep 2008 01:18:10 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:87957</guid><dc:creator>Shawn Hargreaves</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/87957.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=32&amp;PostID=87957</wfw:commentRss><description>&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="http://forums.xna.com//Themes/default/images/icon-quote.gif"&gt; &lt;strong&gt;Onions:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;
&lt;p&gt;What I&amp;#39;m doing is rendering images&amp;nbsp;(or just cleared screens) to&amp;nbsp;render targets, then rendering the images made from the render targets to the main buffer.&lt;/p&gt;
&lt;/div&gt;&lt;/BLOCKQUOTE&gt;
&lt;p&gt;Gotcha - I missed the part about you using rendertargets.&lt;/p&gt;
&lt;p&gt;Have you read &lt;a href="http://home.comcast.net/%7Etom_forsyth/blog.wiki.html#%5B%5BPremultiplied%20alpha%5D%5D"&gt;Tom Forsyth&amp;#39;s&lt;/a&gt; article about premultipled alpha? What you&amp;#39;re doing here is what he describe as compositing translucent layers. You can work through the math he presents for the various blending stages to see where you are going wrong. The best way to debug this kind of thing is using PIX: take a single frame capture and use the debug-this-pixel option to examine all the drawing passes, blending operations, inputs, and outputs and understand why your colors are ending up the way they are.&lt;br /&gt;
&lt;br /&gt;
Wild guess: are you clearing your rendertargets properly? What color do you clear them to?&lt;/p&gt;</description></item><item><title>Re: Premultiplied Alpha - How to implement in XNA?</title><link>http://forums.xna.com/forums/thread/87951.aspx</link><pubDate>Sat, 06 Sep 2008 00:30:31 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:87951</guid><dc:creator>Onions</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/87951.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=32&amp;PostID=87951</wfw:commentRss><description>&lt;p&gt;&lt;a href="http://www.dcnproductions.com/Misc/Samples/IMG00231.jpg"&gt;http://www.dcnproductions.com/Misc/Samples/IMG00231.jpg&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The above link shows what I get when I do the suggested premultiplying of alpha. However, it does worse than the following (default) method...&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.dcnproductions.com/Misc/Samples/IMG00232.jpg"&gt;http://www.dcnproductions.com/Misc/Samples/IMG00232.jpg&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This link shows how XNA naturally (or by default) does alpha. Although smoother, it picks up the red background color (which is what I&amp;#39;m clearing the screen to).&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What I&amp;#39;m doing is rendering images&amp;nbsp;(or just cleared screens) to&amp;nbsp;render targets, then rendering the images made from the render targets to the main buffer.&lt;/p&gt;</description></item><item><title>Re: Premultiplied Alpha - How to implement in XNA?</title><link>http://forums.xna.com/forums/thread/87947.aspx</link><pubDate>Sat, 06 Sep 2008 00:12:36 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:87947</guid><dc:creator>Shawn Hargreaves</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/87947.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=32&amp;PostID=87947</wfw:commentRss><description>What exactly do you mean &amp;quot;anything underneath the image is not drawn&amp;quot;? Is the topmost sprite being drawn opaque? I think I&amp;#39;m missing some context to understand what you are doing here.&lt;br /&gt;</description></item><item><title>Re: Premultiplied Alpha - How to implement in XNA?</title><link>http://forums.xna.com/forums/thread/87941.aspx</link><pubDate>Fri, 05 Sep 2008 23:20:21 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:87941</guid><dc:creator>Onions</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/87941.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=32&amp;PostID=87941</wfw:commentRss><description>&lt;p&gt;Using this method results in removing any part of an image that has&amp;nbsp;a transparent image&amp;nbsp;over it.&amp;nbsp;So lets say I have a feathered circle that&amp;#39;s saved as a PNG. Any part of the &amp;quot;feathering&amp;quot; that is over another image results in the image underneith the circle not being drawn - which also leaves a jagged looking edge where the circle should be feathered.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I can try taking a screen capture if neccessary...&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;EDIT: Actually, I&amp;#39;m wrong. it appears to be rendering the color behind anything transparent as white.&lt;/p&gt;</description></item><item><title>Re: Premultiplied Alpha - How to implement in XNA?</title><link>http://forums.xna.com/forums/thread/87928.aspx</link><pubDate>Fri, 05 Sep 2008 22:31:08 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:87928</guid><dc:creator>Shawn Hargreaves</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/87928.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=32&amp;PostID=87928</wfw:commentRss><description>That code looks right for selecting premultiplied alpha.
&lt;p&gt;What goes wrong when you try this? What exactly are you trying to draw?&lt;/p&gt;
&lt;br /&gt;</description></item></channel></rss>