Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

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.

share|improve this answer
    
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. –  dotminic May 17 '11 at 20:25
1  
@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. –  void May 18 '11 at 6:50
    
@void kind of like creating a mipmap chain and blending them all together ? –  dotminic May 18 '11 at 11:23
1  
@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. –  void May 18 '11 at 11:38
    
@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. –  Macke May 18 '11 at 11:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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