what are the steps to perform downsampling on a texture ? I've got as far as rendering the scene to a render target, but I'm not sure as to how to then render that to a smaller texture in order to blur it. I can't seem to find in good explanation or tutorial about this technique.


Render a large quad (with your texture) to a smaller render target, performing whatever blur/downsampling algorithm is appropriate.

I.e. for each target pixel, sample the number of texels from the source you'd want to combine.

The simplest (and thus fastest, but ugliest) is the box filter, which usually uses 4 samples from the large texture and put their average into a single texel/pixel in the target. Repeat this step until destination is 2x2 to get all mip-map levels for a texture.

There are two-pass techniques that are more efficient if you don't need the intermediate textures, and just a result, see this gamasutra article.

  • \$\begingroup\$ I'm not sure I understand. If I render the scene to a texture and then render a quad with that texture to a smaller render target I only get a quarter of the scene rendered (and magnified) when I draw the small texture to the backbuffer. \$\endgroup\$ – dotminic May 17 '11 at 20:25
  • 1
    \$\begingroup\$ @dotminic You will have to sample several times, and blend the samples together. Or you can sample once and make sure your linear filtering takes care of blending the 4 pixels. \$\endgroup\$ – void May 18 '11 at 6:50
  • \$\begingroup\$ @void kind of like creating a mipmap chain and blending them all together ? \$\endgroup\$ – dotminic May 18 '11 at 11:23
  • 1
    \$\begingroup\$ @dotminic Mipmap chain creation is just several down sample steps that reduces 2x2 pixels to 1. Sometimes you might want to sample a bit more though, to reduce aliasing. \$\endgroup\$ – void May 18 '11 at 11:38
  • \$\begingroup\$ @dotminic: IIUC, you basically want create a mip map chain, but stop once you reach the desired size. You might need to adjust the sample pattern & count if the downsample size isn't a power-of-two fraction of the large texture, or to reduce aliasing as void says. \$\endgroup\$ – Macke May 18 '11 at 11:46

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.