WPF Diaries : Using HLSL pixel shaders

HLSL is mature language that enables developers to address the graphics hardware in a familiar, C-like way. Next to vertex shaders, you can use it to write pixel shaders, which is what - with .Net version 3.5 SP1 - Microsoft introduced into WPF. What sounds like no big deal at first sight is a major leap towards serius WPF / Silverlight game development and - more generally - graphically intensive UI. That goes hand in hand with the DirectX-powered concepts of WPF, finally giving .net developers a good deal of acceleration without the need for unsafe code. Since we're not doing heavy calculus on our GPU, even decent hardware is sufficient to display manipulated images. Since the death sentence of XNA, hopes were shallow that .Net developers get in touch with this cool technology, but we've always loved the walking dead, haven't we?

Quite a few WPF Pixel Shader libraries and tutorials have popped up (Some are linked below), and I really recommend getting in touch with the technology. Blend in the current Release (Blend for VS 2012, Update 2) ships with a pretty long list of ready to use Effects, and it's free, so try that too!

Here's a condensed tutorial to get yout started in short time:

1) Get the Shader Library project template, Shader Effect item template and Effect build action.
   Installation instructions included.  This is a nice way to get around the DirectX SDK requirement.
   Also note that for Silverlight, you need to apply some more force to get it going
2) As a reference grayscale shader , see Bursjoo's code
3)   Once you've gotten a grasp of the concept, start writing your own shaders. Shazzam is a great deal
   of help there.

Need more input? This book seems to be the place to go. Also, there's a nice channel 9 tutorial on the subject.

Isn't WPF a great framework ?

Links:

  1. http://wpf.codeplex.com/releases/view/14962
  2. http://wpffx.codeplex.com/
  3. http://dotwaywpf.codeplex.com

Next, I'll take a look at how to incorporate the Effect Build action into an existing TFS continuous build.

Kommentare

Beliebte Posts aus diesem Blog

Using AutoMapper for MVVM implementations

Deploying ClickOnce-applications in different environments without modifying the assembly identity

Preparing for and passing MCTS exam 70-536