Optimization fun with mipmaps

Mipmap Debug

So I was fixing some textures today that were the wrong format. Really all this means is that they were taking too much space because I was storing an unneeded alpha channel in addition to red, green and blue.

I decided to go a little farther and make sure all the textures in the game were the ‘correct’ size. Modern GPUs (and all the old ones, back to the 3dfx Voodoo) use mip-maps – smaller and smaller versions of the same image to used to reduce aliasing and increase cache coherency when the texture is minified in the distance. By coloring each subsequent mip-map a different color and running the game, I can see which textures are actually using thier highest resolution mip level.

Plus it looks really cool.

In the picture above, red, yellow, green, blue, and cyan are the first five colors. From this i can see the trees in the foreground are green and the ones in the distance are blue. This means I can downsample the texture and still retain the same final image quality.

I know PC’s have gigabytes of memory now, but I come from game console programming where memory is precious. I saved about 25 megabytes with of memory with the format and size changes, while increasing the quality of ambient occlusion maps! Hoorah!


    March 14, 2013 6:25 am

    Interesting post. If the colours were rearranged it’d look like a heat map.

    March 22, 2013 3:19 am

    Oh my goodness! an impressive write-up dude. Thank you But I’m experiencing concern with ur rss . Don’t know why Unable to subscribe to it. Is there any individual getting identical rss challenge? Any individual who knows kindly respond. Thnkx

    jordans for sale

    March 22, 2013 8:06 pm

    You know, i have instant respect for you. I hate the idea of just being lose and willy nilly with resources.

    However we’re talking about 25 MB of ram, are you sure you’re using your time productively? The way i understand it, you’ll have the best result optimizing your code by looking at the finished product and seeing what uses the most resources.

    Anyways i’m glad your going the extra mile on this game and i hope you go far.

    March 22, 2013 9:29 pm

    Not to burst your bubble, but to let you know, all modern PCs, with both OpenGL and Direct3D (it’s a card/driver thing) will simply convert 24-bit textures into 32-bit internally. In fact, this _slows down_ the loading process and this can be a substantial slowdown. For all games I’ve worked on, unless we are using DXT1 textures, we have an alpha channel even if unused as the card will most certainly add it even if it isn’t there.

    So, to restate (since I tend to drone on), if you upload a 2048×2048 BGR texture, internally the card will store it as 2048×2048 ABGR regardless of what you do, and you will incur a conversion cost.

    cheap beats by dre
    March 23, 2013 1:26 pm

    Hi there, just became aware of your blog through Google, and found that it’s truly informative. I抦 going to watch out for brussels. I will be grateful if you continue this in future. A lot of people will be benefited from your writing. Cheers!

    March 27, 2013 3:34 pm

    This actually answered my dilemma, thank you!

    [url=http://louisvuittonhandbags8.web1337.net/]lv handbags[/url]


    April 1, 2013 10:31 am

    fairly nice post, i undoubtedly enjoy this web page, maintain on it

    [url=http://louisvuittonhandbags8.mydiscussion.net/]lv handbags[/url]


    April 7, 2013 9:24 pm

    I discovered your blog web-site on google and check a number of of your early posts. Continue to keep up the very fantastic operate. I just further up your RSS feed to my MSN News Reader. Searching for forward to reading additional from you later on!

    [url=http://coolchristianlouboutina.2kool4u.net]christian louboutin for men[/url]

    April 11, 2013 12:16 am

    You produced some decent points there. I looked on the internet for the issue and located most people will go together with with your web page.

    [URL=http://www.salemichaelkorsbag.com/messenger-c-69.html]michael kors nordstrom[/URL]