0
\$\begingroup\$

I need to upscale images using the 'box' scaling algorithm as the pixel art textures in my game don't scale well with bilinear because of the blur. Either that, or use high res pictures which would be undesirable and inflate the size by many times.

\$\endgroup\$
2
\$\begingroup\$

Typically you just draw 2D images as textures (a.k.a. "sprites") as is done with SpriteBatch in DirectX Tool Kit. You can specify the sampler state to use D3D11_FILTER_MIN_MAG_MIP_POINT to turn off all the filtering.

const float border[4] = { 0.f, 0.f, 0.f, 0.f };

// PointWrap
CD3D11_SAMPLER_DESC desc(D3D11_FILTER_MIN_MAG_MIP_POINT,
    D3D11_TEXTURE_ADDRESS_WRAP, D3D11_TEXTURE_ADDRESS_WRAP, D3D11_TEXTURE_ADDRESS_WRAP,
    0.f, maxAnisotropy, D3D11_COMPARISON_NEVER, border, 0.f, FLT_MAX);

// PointClamp
CD3D11_SAMPLER_DESC desc(D3D11_FILTER_MIN_MAG_MIP_POINT,
    D3D11_TEXTURE_ADDRESS_CLAMP, D3D11_TEXTURE_ADDRESS_CLAMP, D3D11_TEXTURE_ADDRESS_CLAMP,
    0.f, maxAnisotropy, D3D11_COMPARISON_NEVER, border, 0.f, FLT_MAX);
\$\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.