White Shining Rock Logo
White Shining Rock Logo

Optimization fun with mipmaps

March 12, 2013 | Dukus | 9 Comments

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!

Leave a Reply

Your email address will not be published.

9 comments on “Optimization fun with mipmaps”

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

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

  3. 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 2048x2048 BGR texture, internally the card will store it as 2048x2048 ABGR regardless of what you do, and you will incur a conversion cost.

  4. 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!

  5. 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]

  6. 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]

More Posts

Code Rot

April 17, 2022
1 2 3 47
Back to devlog
Back to devlog
© Copyright 2021 Shining Rock Software
Website Design & Branding by Carrboro Creative
menu-circlecross-circle linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram