0
\$\begingroup\$

I want the best visual result on my Windows Phone if I scale down my sprites from 1920x1080 pixel resolution to 800x480 pixel resolution.

How can I use a filter to scale down my sprites? Which filter is the best?

\$\endgroup\$
0
\$\begingroup\$

In XNA you can change the texture sampling method in the GraphicsDevice class. For example:

GraphicsDevice device;
//... say you created a valid device 
device.SamplerStates[0] = SamplerState.LinearClamp; //this sets bilinear filtering
device.SamplerStates[0] = SamplerState.PointClamp; //this sets nearest neighbor (or point) filtering

You will also find a LinearWrap and PointWrap feature in the SamplerState class. These do the same filtering but will wrap around your texture coordinates (You don't have to use it if you don't know what it means yet).

An other method would be to set the sampler states in the shader if your can use them:

Texture xTexture0;
sampler TextureSampler0 = sampler_state { 
                                        texture = <xTexture0>; 
                                        magfilter = linear; 
                                        minfilter = linear; 
                                        mipfilter = linear; 
                                        AddressU = wrap; 
                                        AddressV = wrap;
                                       };

For which is the best filter there is no universal definition it depends on the art style. For example with pixelated retro graphics you would want to use point filtering, while high resoulution sprites like bilinear better. Also bilinear filtering requires a bit more processing because of the interpolation.
There is an other filtering method called anisotropic which makes no difference from linear in 2D graphics.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.