WPF architect Greg Schechter was written a series of articles on the new hardware accelerated shaders recently released in beta form, as part of .NET 3.5 SP1 beta. This article includes some sample code that was enough to get me started down the path of writing a very simple shader effect - I've dubbed it "watery" but it's more just "wavy". In this example the "waviness" of the effect is bound to the value of the slider at the bottom of the screen. One thing that I thought was very nicely done by the WPF team was the mechanism for passing parameters from WPF into the HLSL code using an attached property declaration like this: public static readonly DependencyProperty WavinessProperty = DependencyProperty.Register("Waviness", typeof(double), typeof(WaterEffect), new UIPropertyMetadata(0d, PixelShaderConstantCallback(0) )); The last part is the most important bit, which wires up the dependency property that has been defined in our C# WPF code to a constant in the [very crude] pixel shader
Read More...