Silverlight 3.0 Pixel shaders

by morten 3/19/2009 6:36:00 AM

rippleeffect Silverlight 3.0 beta1 was released today. One of the new cool features is the pixel shader support, allowing you to make some really cool effects. I managed to fairly quickly convert the WPF Pixel Shader library to a Silverlight library (except a couple of effects), and successfully apply them to any UIElement.

To save you the trouble, you can grab the source for the library from here: ShaderEffectLibrary.zip (44.65 kb)

To use it, simply import the assembly namespace:

xmlns:fx=”clr-namespace:ShaderEffectLibrary;ShaderEffectLibrary"

and then apply any effect to your elements by setting the Effect property:

<Grid>
    <Grid.Effect>
        <fx:RippleEffect />
    </Grid.Effect>
</Grid>

The supported effects are: BandedSwirl, Bloom, BrightExtract, ColorKeyAlpha, ColorTone, ContrastAdjust, DirectionalBlur, Embossed, Gloom, GrowablePoissonDiskEffect, InvertColor, LightStreak, Magnify, Monochrome, Pinch, Pixelate, Ripple, Sharpen, SmoothMagnify, Swirl, Tone, Toon, and ZoomBlu.

Note that you will need to have the Silverlight 3.0 bits installed to use this.

UPDATE: The WPF Pixel Shader library has now added support for Silverlight as well: http://wpffx.codeplex.com/

Also note that if you want to take advantage of the new GPU hardware acceleration to further enhance performance, this is an opt-in feature! To get it, you have to go to the hosting html page and set the following object parameter (update: This doesn't apply to pixel shaders which are software only):

      <param name=”enableGPUAcceleration” value=”true” />

Also note that pixel shaders are software only, and if you add a shader to your hardware accelerated element, it will switch back to software.

Tags:

Silverlight

Comments

3/19/2009 8:16:23 PM

jaime

Hi Morten,  thanks for doing this..  I maintain he codeplex site for WPF effects and will be of course be merging it asap ( as soon as MIX is over) ...  I started yesterday, while at MIX and I am 2/3 of the way through,  I wonder why you did not do Magnify and Swirl, was there issues???   Feel free to ping me directly to discuss...  

jaime United States

3/20/2009 12:14:21 AM

Jeff Klawiter

I also had ported the library yesterday to test it out. There are only minor changes needed for most of them. Some rely on 3d classes that Silverlight doesn't have but could be added by hand.

Check out my blog, I detailed the changes I had to make

Jeff Klawiter United States

3/20/2009 1:17:35 AM

pingback

Pingback from dotnetninja.wordpress.com

Pixel Shaders with Silverlight 3 « Arman Kurtagic’s Weblog

dotnetninja.wordpress.com

3/23/2009 6:51:49 AM

pingback

Pingback from blog.webjak.net

Mix 09 - 10 from 10 « Developer Flotsam

blog.webjak.net

3/29/2009 9:28:15 PM

trackback

Trackback from Johan Lindfors

Använda HLSL och Pixel-Shaders i Silverlight 3

Johan Lindfors

6/5/2009 3:06:52 AM

trackback

Trackback from Gonçalo Chaves

Links da Semana (1-5)

Gonçalo Chaves

Comments are closed

Powered by BlogEngine.NET 1.6.1.0

RecentComments

Comment RSS

About the author

Morten Nielsen

Morten Nielsen
<--That's me
E-mail me Send mail

Twitter @SharpGIS 

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2009