What's with texture filters?

Jul 22, 2009 at 10:07 AM


I failed to find image filter options in API and I wonder if it's supported. My sprites mainly use pixel-art style, and all those carefully placed pixels are being mixed with each other by default bilinear image filter. Previously in XNA I've used GraphicsDevice.SamplerStates[0].MagFilter = TextureFilter.Point. Does anybody know about any similiar functions in Silverlight?

Jul 22, 2009 at 3:44 PM

There's no way that I know of to change the scaling algorithm in Silverlight, I'm wondering if it might be possible to implement a pixel shader to do this.

Jul 22, 2009 at 8:18 PM

Thanks for your answer.

I researched this problem a bit and I'm afraid it is not possible to do so in a beatiful way. Sampler2D is supplied to shader implicitly by runtime and we can't change it, so the shader will be working with pixels after applying the scaling filter that blurs and washes out the said pixels. I guess that my best bet will be to plan for more vector-looking art and wait for next releases of Silverlight while praying for developers to add RenderOptions.SetBitmapScalingMode from WPF ^_^

By the way, do you know if this blurry effect could be from non-direct pixel/texel mapping, or such problem does not exist in Silverlight? I would have checked this myself with pixel shader that applies 0.5 to uv coords, but I can't write Silverlight shaders yet ^_^