View Full Version : Performance at lower mipmap level

06-25-2011, 09:55 AM
Hello all. I am working on a 2d game and was thinking about using mipmaps to display correct 2d images for the game running at different resolutions.

So far it works pretty well and displays the correct res texture for the size of the screen, however I'm wondering if this is the best way to go about for performance.

Sometimes people choose to run their game at a lower resolution to increase performance, and although opengl draws the lower res mip-map do you think there is still too much overhead in loading the .dds that includes higher res textures.

Do you think I should just create a number of texture files and load the correct one manually or would mip-maps be a good idea in this situation?

06-26-2011, 04:43 AM
On the pure rendering speed, it should be equivalent IF there is enough memory for video card and the cpu.
That means having an option to select the texture detail level is still a good idea.

06-26-2011, 06:23 PM
Assuming all the textures and whatever other resources fit into the video card, mipmapping improves performance. Probably because the mipmap better fits the texture cache.

06-28-2011, 12:04 PM
Thanks for the input. In the end I suppose it will have to come down to testing on different machines. I'd rather not have multiple files as it's easier to make and also reduces file size.

06-28-2011, 02:33 PM
A full mipmap chain only adds 33% to the size of the base texture.
Anyway you can just ship the highest res, then at load time reduce it first before using it as base texture.

06-29-2011, 02:54 AM
Ideally, generate mipmaps with high quality tools (NVTextureTools is good), avoid basic averaging filters that get gamma wrong and thus darken smaller mipmap levels. Also be aware of the type of the content, for example normal maps need different treatment than color textures. For load time optimization, generate mipmaps offline, not during load time.

At load time, when you know your target resolution, you can choose to skip loading mipmap levels which are not going to be used. This will save you some loading time and texture memory.

All of this is optimization that you can add any time later, so I would not worry about it too much unless your target includes some very constrained systems. If you are memory constrained, you can get away with a single CPU memory buffer where you load one mipmap level at time, upload it to OpenGL, then load next mipmap level; This buffer needs to be big enough to contain the largest mipmap level you are going to upload during the load time.