Archived

This topic is now archived and is closed to further replies.

Facehat

Generating MipMaps

Recommended Posts

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.)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites