Generating MipMaps

Started by
5 comments, last by Facehat 24 years, 3 months ago
Hmm, sounds rather sparkly.
__Definately more processor intensive, but just average groups of four pixels and skip every other column and row. Something like this:
[(x,y)+(x,y+1)+(x+1,y)+(x+1,y+1)]/4
__Repeat for each channel (don't forget alpha.)
__If your using alpha mattes (not rendering anything if a certain color is present) you'll either have to convert to alpha channeled graphics, or just treat that set of four as the matte color or the average of the remaining pixels. Be careful when you code so that you don't get colored edges (ala Tomb Raider w/3Dfx or FF7pc.)
Advertisement
I usually use a box filter, which is just the average of the four pixels in the higher level mip-map. This usually gives me good results.

You can experiment with the DX Texture Tool to see how this looks, it uses a box filter for mip-map generation.

Box filters are actually a very ugly way to scale down a bitmap, because it won't completely elliminate the high frequencies in the images (the box-filter being a sinc-graph in the frequency domain). You're better of using a Gaussian convolution filter.

-----
Willem H. de Boer
E-mersion Project
www.connectii.net/emersion

Thanks for all the responses.

I think I'll go with the box filter because it's so easy to implement and the results aren't bad.

--TheGoop

You might like to look at the Intel Image Processing library at http://developer.intel.com/vtune/PERFLIBST/IPL/. Its free and it makes Guassian filters really easy!

[This message has been edited by Alastair (edited December 28, 1999).]

Does anyone know of any good filtering techniques to use when shrinking down a bitmap to use as a MipMap? Basically I'm looking for something which will I can use to shrink a bitmap without losing too much quality. Right now I'm using a simple "use half the pixels" scheme (use every other pixel). Any better ideas?

--TheGoop

And, of course (and with all due respect) don't forget Photoshop. The whole point of mipmaps is to compensate for the fact that there's no good instant algo. to reduce texels. I think linear filtering (GL_LINEAR) basically does a box filter, even though it doesn't mix along exactly four pixels.
-the logistical one-http://members.bellatlantic.net/~olsongt

This topic is closed to new replies.

Advertisement