So you know that Silverlight 3 supports pixel shaders right? Great! You are filled with joy, nay even rapture. But how to actually start using them?
From a designer’s point of view you can web search what’s available and all the juicy examples but there are a few hurdles before you get your crayon-crusted mitts on them.
Things you should have baked earlier:
My way to victory was starting with the WPF pixel shader effects currently published on codeplex that use a workaround to get them running in SL3.
Download and extract the WPF shader library, open up the solution and have a look at the project structure, taking note of the SLShaderEffectLibrary folder… we’re stealing that one very shortly.
Then open up Visual Studio (resist the urge to go visual in Blend just yet) and create a new Silverlight application.
Next right click on the solution and click ‘Add > Existing Project…’ and then hunt for the SLShaderEffectsLibrary folder we found earlier from inside the wpf effects toolkit.

With that in place we need to add a reference from our base project so that it knows about all those shiny effects. Right click on the references folder in the base project and in the popup window choose the projects tab.

Then choose the imported project that appears in the list.

Finally, in your mainpage.xaml file we need to add an import statement to the added project; using ShaderEffectLibrary will do it.

Now that our base project knows of the magic that will shortly be, probably gratuitously, gracing your screen. With no delay, open blend with shaky sweaty fingers and slap down something interesting like an image onto mainpage.xaml. Then click new effect and in the popup window notice that instead of the two effects available as standard the project you added now appears in the list …

…and opening the list reveals the full list of effects to play with!

As a caveat I have noticed that some of the effects simply don’t work, though happily these are in the minority.
Also take note that while some effects just like the standard blur and dropshadow have exposed properties for you to play with variations of each effect, others are as is and don’t expose any properties at all.

So!
Now you’ve got some playing to do here’s some points to muse on:
• any exposed effect property can be animated
• only one effect instance can be attached per xaml object (canvas, image, textblock for eg)…
• BUT you can stack effects by adding effects to a parent container
• keep in mind that these effects are doing some fairly serious calculations, if you can get away with one instance of an effect on a parent container rather than 10 instances of the effect on each object in that container, that’s probably the way you want to go
With this new effect playground it provides a framework for adding new effects you find (or make) into this library with only minor wrangling. I’ll cover this approach in a future post, so for now happy shading and I hope this provides some image effect joy!