<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Where did the time go? - HLSL</title>
    <link>http://blog.j-maxx.net/</link>
    <description>Brain Powered</description>
    <language>en-us</language>
    <copyright>Jeff Klawiter</copyright>
    <lastBuildDate>Wed, 18 Mar 2009 23:41:54 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.1.8102.813</generator>
    <managingEditor>Jeff.Klawiter@sierra-bravo.com</managingEditor>
    <webMaster>Jeff.Klawiter@sierra-bravo.com</webMaster>
    <item>
      <trackback:ping>http://blog.j-maxx.net/Trackback.aspx?guid=b5175d15-d866-4db3-baa1-2a969d4496b1</trackback:ping>
      <pingback:server>http://blog.j-maxx.net/pingback.aspx</pingback:server>
      <pingback:target>http://blog.j-maxx.net/PermaLink,guid,b5175d15-d866-4db3-baa1-2a969d4496b1.aspx</pingback:target>
      <dc:creator>Jeff Klawiter</dc:creator>
      <wfw:comment>http://blog.j-maxx.net/CommentView,guid,b5175d15-d866-4db3-baa1-2a969d4496b1.aspx</wfw:comment>
      <wfw:commentRss>http://blog.j-maxx.net/SyndicationService.asmx/GetEntryCommentsRss?guid=b5175d15-d866-4db3-baa1-2a969d4496b1</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">With the release of Silverlight 3 Beta
we can now run PixelShader effects on any control. This can produce some powerful
stuff as shown during the Mix 09 Keynote this morning. I delved in as fast as I could
to find out how to make your own and work with them in VS.<br /><br />
I downloaded the WPF shader library from <a href="http://wpffx.codeplex.com/">http://wpffx.codeplex.com/</a> .
I only imported the ShaderEffectLibrary so far, I have not tried the transition one.<br /><br />
I simply copied the EffectFiles, ShaderSource and EffectLibrary.cs files into my project
and tried to compile.  Issues I ran into<br /><ol><li>
UIPropertyMetadata needs to be replaced with PropertyMetadata</li><li>
Color.FromScRgb needs to be replaced with Color.FromArgb and it's inputs run through
Convert.ToByte</li><li>
MagnifyEffect.cs and SwirlEffect.cs reference classes that do not exist in Silverlight
like the Vector class. I could have got them from reflector but in sake of time I
didn't (that and being able to release this code)</li><li>
Getting the ps resources required a minor change to the Global static class. Basically
changing the path to do a Relative URI lookup.</li></ol>
The basics here for doing your own shader effects is included save 1 thing. You need
the DirectX SDK to compile your HLSL code. You can add a new build event or do it
from the commandline. This is a good tutorial on how to do it <a href="http://windowsclient.net/wpf/wpf35/wpf-35sp1-hlsl-primer.aspx">http://windowsclient.net/wpf/wpf35/wpf-35sp1-hlsl-primer.aspx</a>. 
<br /><br />
So the basics of doing your own Pixel shader in Silverlight is damn near identical
as WPF. You inherit from the ShaderEffect class, load your compiled HLSL bytecode
resource and expose any properties you need to modify as dependency properties.<br /><br />
Attached is my ugly but working example. I couldn't find anyway to bind to properties
on an effect so I had to just do it by event.<br /><br /><a href="http://blog.j-maxx.net/content/binary/SlShaderEffectDemo.zip">SlShaderEffectDemo.zip</a><br /><p></p><img width="0" height="0" src="http://blog.j-maxx.net/aggbug.ashx?id=b5175d15-d866-4db3-baa1-2a969d4496b1" /></body>
      <title>Silverlight 3 Shader Effects</title>
      <guid isPermaLink="false">http://blog.j-maxx.net/PermaLink,guid,b5175d15-d866-4db3-baa1-2a969d4496b1.aspx</guid>
      <link>http://blog.j-maxx.net/2009/03/18/Silverlight3ShaderEffects.aspx</link>
      <pubDate>Wed, 18 Mar 2009 23:41:54 GMT</pubDate>
      <description>With the release of Silverlight 3 Beta we can now run PixelShader effects on any control. This can produce some powerful stuff as shown during the Mix 09 Keynote this morning. I delved in as fast as I could to find out how to make your own and work with them in VS.&lt;br&gt;
&lt;br&gt;
I downloaded the WPF shader library from &lt;a href="http://wpffx.codeplex.com/"&gt;http://wpffx.codeplex.com/&lt;/a&gt; .
I only imported the ShaderEffectLibrary so far, I have not tried the transition one.&lt;br&gt;
&lt;br&gt;
I simply copied the EffectFiles, ShaderSource and EffectLibrary.cs files into my project
and tried to compile.&amp;nbsp; Issues I ran into&lt;br&gt;
&lt;ol&gt;
&lt;li&gt;
UIPropertyMetadata needs to be replaced with PropertyMetadata&lt;/li&gt;
&lt;li&gt;
Color.FromScRgb needs to be replaced with Color.FromArgb and it's inputs run through
Convert.ToByte&lt;/li&gt;
&lt;li&gt;
MagnifyEffect.cs and SwirlEffect.cs reference classes that do not exist in Silverlight
like the Vector class. I could have got them from reflector but in sake of time I
didn't (that and being able to release this code)&lt;/li&gt;
&lt;li&gt;
Getting the ps resources required a minor change to the Global static class. Basically
changing the path to do a Relative URI lookup.&lt;/li&gt;
&lt;/ol&gt;
The basics here for doing your own shader effects is included save 1 thing. You need
the DirectX SDK to compile your HLSL code. You can add a new build event or do it
from the commandline. This is a good tutorial on how to do it &lt;a href="http://windowsclient.net/wpf/wpf35/wpf-35sp1-hlsl-primer.aspx"&gt;http://windowsclient.net/wpf/wpf35/wpf-35sp1-hlsl-primer.aspx&lt;/a&gt;. 
&lt;br&gt;
&lt;br&gt;
So the basics of doing your own Pixel shader in Silverlight is damn near identical
as WPF. You inherit from the ShaderEffect class, load your compiled HLSL bytecode
resource and expose any properties you need to modify as dependency properties.&lt;br&gt;
&lt;br&gt;
Attached is my ugly but working example. I couldn't find anyway to bind to properties
on an effect so I had to just do it by event.&lt;br&gt;
&lt;br&gt;
&lt;a href="http://blog.j-maxx.net/content/binary/SlShaderEffectDemo.zip"&gt;SlShaderEffectDemo.zip&lt;/a&gt;
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.j-maxx.net/aggbug.ashx?id=b5175d15-d866-4db3-baa1-2a969d4496b1" /&gt;</description>
      <comments>http://blog.j-maxx.net/CommentView,guid,b5175d15-d866-4db3-baa1-2a969d4496b1.aspx</comments>
      <category>HLSL</category>
      <category>Silverlight 3</category>
    </item>
    <item>
      <trackback:ping>http://blog.j-maxx.net/Trackback.aspx?guid=03ad26ec-50ab-426d-9296-8122a6ab6387</trackback:ping>
      <pingback:server>http://blog.j-maxx.net/pingback.aspx</pingback:server>
      <pingback:target>http://blog.j-maxx.net/PermaLink,guid,03ad26ec-50ab-426d-9296-8122a6ab6387.aspx</pingback:target>
      <dc:creator>Jeff Klawiter</dc:creator>
      <wfw:comment>http://blog.j-maxx.net/CommentView,guid,03ad26ec-50ab-426d-9296-8122a6ab6387.aspx</wfw:comment>
      <wfw:commentRss>http://blog.j-maxx.net/SyndicationService.asmx/GetEntryCommentsRss?guid=03ad26ec-50ab-426d-9296-8122a6ab6387</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">I was playing around with shaders the other
day and found the lack of syntax highlighting in Visual Studio to be a bit annoying.
I had downloaded the Nvidia FX composer but it's a bit more complex than I really
need. After a bit of searching google I came across <a href="http://intelishade.net/">InteliShade.NET</a>. 
<br /><br />
InteliShade seems to have full syntax highlighting and InteliSense for base types.
So far the InteliSense support is fairly simple. It will autocomplete object types
and function names. It does not detect any variables or structures you've created
nor does it give parameter completion on functions. I'm sure this will change as time
goes on.<br /><br />
It looks like there's just one guy writing it and also doesn't seem to be open source.
I'm sure if there's enough interest he may open things up. I've already begun talking
this thing up. It wasn't too long ago Shawn Hargreaves gave a talk at our local XNA
user group and he mentioned he didn't know of any VS HLSL sytnax highlighting and
urged us to bug the VS team to add it. After finding InteliShade I did send him a
quick email through his blog to let him know there is now an option.<br /><br /><br /><p></p><img width="0" height="0" src="http://blog.j-maxx.net/aggbug.ashx?id=03ad26ec-50ab-426d-9296-8122a6ab6387" /></body>
      <title>InteliShade.Net: HLSL Syntax Highlighting and Intellisense</title>
      <guid isPermaLink="false">http://blog.j-maxx.net/PermaLink,guid,03ad26ec-50ab-426d-9296-8122a6ab6387.aspx</guid>
      <link>http://blog.j-maxx.net/2008/08/22/InteliShadeNetHLSLSyntaxHighlightingAndIntellisense.aspx</link>
      <pubDate>Fri, 22 Aug 2008 18:29:45 GMT</pubDate>
      <description>I was playing around with shaders the other day and found the lack of syntax highlighting in Visual Studio to be a bit annoying. I had downloaded the Nvidia FX composer but it's a bit more complex than I really need. After a bit of searching google I came across &lt;a href="http://intelishade.net/"&gt;InteliShade.NET&lt;/a&gt;. 
&lt;br&gt;
&lt;br&gt;
InteliShade seems to have full syntax highlighting and InteliSense for base types.
So far the InteliSense support is fairly simple. It will autocomplete object types
and function names. It does not detect any variables or structures you've created
nor does it give parameter completion on functions. I'm sure this will change as time
goes on.&lt;br&gt;
&lt;br&gt;
It looks like there's just one guy writing it and also doesn't seem to be open source.
I'm sure if there's enough interest he may open things up. I've already begun talking
this thing up. It wasn't too long ago Shawn Hargreaves gave a talk at our local XNA
user group and he mentioned he didn't know of any VS HLSL sytnax highlighting and
urged us to bug the VS team to add it. After finding InteliShade I did send him a
quick email through his blog to let him know there is now an option.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.j-maxx.net/aggbug.ashx?id=03ad26ec-50ab-426d-9296-8122a6ab6387" /&gt;</description>
      <comments>http://blog.j-maxx.net/CommentView,guid,03ad26ec-50ab-426d-9296-8122a6ab6387.aspx</comments>
      <category>HLSL</category>
      <category>XNA</category>
    </item>
  </channel>
</rss>