Size of n mipmaps

Started by
2 comments, last by DanielH 17 years, 3 months ago
This is probably really simple but I can't get my head around it at this time of the day :( (Don't we all say that just to try make us feel less stupid!) So I'm making this mipmapped terrain and I need to find the offset in the data storage to where the data to mipmap n lies. So let's say my first mipmap is positioned at an offset of 0 and is 257^2 in size. Next mipmap will the be placed at an offset of 257^2 and be 129^2 in size. Third mipmap will be at offset 257^2 + 129^2 and be 65^2 in size. So how do that little universal find-the-mipmap-offset-formula look like? It should just be a numerical sum of [size^2 * 0,5^(2n)] where n is the mipmap level... right? Anyway it's been long since i was doing that kind of math :P
Advertisement
A little addition:

I'm aware of that

sum( k * ((0,25^n - 1) / (0,25 - 1) )

where
k = size^2
n = mipmap level


Actually works for 256, 128 etc. Problem is that my mipmaps are 257, 129 etc. What should the coefficients be? :(
IIRC, the limit of mipmaps (of any pixel size as long as they're reduced by the standard scaling)is < original image/3 (may want to look up to check...).

just out of interest, why are you using 2^n+1 sizes?
They need to be n^2+1 since the height map is splitted up in m patches which are power of two in width. And the patches furthest out on the +x and +z edge need to sample their height map data from something :)

This topic is closed to new replies.

Advertisement