Bevel Bitmap Effect problem

Dec 21, 2009 at 11:47 AM

Hello all.

I am new to the world of WPF and I was trying to create a button with a Bevel bitmap effect.

So I applied the effect with the following configuration:


<BevelBitmapEffect BevelWidth="3" EdgeProfile="BulgedUp" LightAngle="180" Smoothness="1" Relief="0.15" />


The effect looks good against a white backgound, but if I use a different color behind the button, you can see some ugly white pixels around the corners of the button. I think it's related to some kind of anti-aliasing, since it changes according to the smoothness (the higher the smoothness, the bigger the "noise").

Any suggestions to solve this?

Thanks in advance!

Jan 8, 2010 at 12:10 AM

I can't speak to your specific problem, but in general all of the "legacy" classes derived from BitmapEffect have been deprecated in the upcoming WPF 4.0 release.  They will no-op in the latest version of the framework (you would usually have to recompile your app as WPF 4.0 to get this behavior).  This was done because of the performance of legacy BitmapEffects.

I would encourage you to use the new hardware accelerated Effects (BlurEffect and DropShadowEffect), though there isn't a built-in hardware accelerated replacement for BevelBitmapEffect.  You could write your own by deriving from the ShaderEffect class, writing a small PS 2.0 pixel shader to perform the bevel operation.  I believe it would fit into the 64 instructions allowable by PS 2.0.


Jan 8, 2010 at 10:12 AM

Thanks for that insight David!

I was able to acheive some nice effects by using gradients...

Thanks again!