robburke.NET
© 2010 Robert Burke
All Rights Reserved.

Greg is in the middle of writing a great explanation of how to build custom WPF 3.5 SP1 pixel shader effects on his blog. He helped me re-create his sample ColorComplementEffect, so I thought I’d offer a sample solution containing an end-to-end custom WPF Pixel Shader Effect using the .NET 3.5 SP1 Beta bits.

Download it here.

WPF Pixel Shader Effect

Some notes:

  • This solution requires that you have Visual Studio 2008 and the .NET 3.5 SP1 Beta installed.
  • This also requires that you have the DXSDK installed on your PC (I am out-of-date and using the August 2007 flavor)
  • In my .sln, a Pre-build Event Command invokes fxc.exe to compile ColorComplementShader.fx into ColorComplementShader.ps. The Pre-build command requires you to have the DXSDK_DIR environment variable set (see previous note – installing the DXSDK should set this automatically for you)
  • The picshure is from teh awesum icanhascheezburger.com

Next step… databound shader parameters :)

Download sample solution.

[14 May 08 Update: Greg has posted an end-to-end shader sample with 3 sample shaders!]

Possibly Related Articles (possibly not):

2 Responses to “End-to-End Custom WPF Shader Example”

  1. Martin 27th Jul 2008 @ 12:55 pm

    You wrote on Gregs blog, that you wanted to create a rgb->hsl->rgb shader. I created a rgb->hsV->rgb shader, and with some optimizations i got around the 64 operations limitation. Give me a mail if you’re interested in the code.

  2. Richard Fencel 14th Mar 2010 @ 5:23 pm

    I downloaded your project and it did not build until I added more quotes in the pre-build command. The new command should be:

    “%DXSDK_DIR%\Utilities\Bin\x86\fxc.exe” /T ps_2_0 /E main /Fo”$(SolutionDir)ColorComplementShader.ps” “$(SolutionDir)ColorComplementShader.fx”

    I haven’t tested the rest yet, I just thought I would report this now.

Trackback URI | Comments RSS

Leave a Comment