MipMaps

Member
Posts: 86
Joined: 2008.04
Post: #1
Should I mipmap every texture, or only the big tileable ones...?

What are the pros and cons of using it...how much texture space does it take up....

Thanks for any advice...
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #2
You want to use mipmapping when you have a very large texture that may be shown at a small size on the screen. Like a repeating wall texture shown on a faraway wall. If you are never scaling a texture down by more than 2x, I don't think it does you any good.

Mipmapping does two things when you are zoomed way out. First, it reduces those "swimming" artifacts that you see when the GPU is trying to reduce a large texture to a very small screen area. The GPU only does a 2x2 average, so if you are zoomed out by more than 2x, pixels in the texture are being completely missed. Secondly, it reduces the memory bandwidth. VRAM uses caching too, so if the GPU has to read only a few bytes out of the entire texture, it's not very cache friendly. By having a mipmap available that is closer to the size it will be drawn on screen, you won't be wasting as much bandwidth.

The only real downside of mipmapping is that it uses a little more memory, but never more than 1/3 extra. You can also see the edges of the different mipmaps if you don't enable the more expensive trilinear filtering.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Member
Posts: 86
Joined: 2008.04
Post: #3
Thanks Skorche - that was what I was looking for....

The swimming/sparkling effect was happening quite a bit - I modified my TextureLoader so that all textures were mipmapped.

Interestingly it also did improve framerate - must be the bandwidth improvement like you said.

I was worried that it consumed too much memory but that does not seem to be the case - does it build all mipmap levels at texture load time, or does it gen them as needed?

Thanks again for your help


(Jul 13, 2010 06:59 AM)Skorche Wrote:  You want to use mipmapping when you have a very large texture that may be shown at a small size on the screen. Like a repeating wall texture shown on a faraway wall. If you are never scaling a texture down by more than 2x, I don't think it does you any good.

Mipmapping does two things when you are zoomed way out. First, it reduces those "swimming" artifacts that you see when the GPU is trying to reduce a large texture to a very small screen area. The GPU only does a 2x2 average, so if you are zoomed out by more than 2x, pixels in the texture are being completely missed. Secondly, it reduces the memory bandwidth. VRAM uses caching too, so if the GPU has to read only a few bytes out of the entire texture, it's not very cache friendly. By having a mipmap available that is closer to the size it will be drawn on screen, you won't be wasting as much bandwidth.

The only real downside of mipmapping is that it uses a little more memory, but never more than 1/3 extra. You can also see the edges of the different mipmaps if you don't enable the more expensive trilinear filtering.
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #4
glGenerateMipmap() generates all mipmaps immediately I think. I can't really see any great benefits of generating them as needed. Actually, most modern games do quite the opposite. They load up low resolution versions of every texture the game needs and as geometry with the low resolution textures appears onscreen, it loads the high resolution textures to replace them.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Member
Posts: 142
Joined: 2002.11
Post: #5
(Jul 12, 2010 08:45 PM)OptimisticMonkey Wrote:  Should I mipmap every texture, or only the big tileable ones...?

What are the pros and cons of using it...how much texture space does it take up....

Thanks for any advice...

Use mip mapping on all textures. It adds only 33% to the space requirements of the texture, increases speed dramatically by increasing cache effectiveness, and reduces high frequency noise artifacts. The only case not to use mip maps is when the texel / pixel ratio is always very close to 1.0 -- usually only true for user interface elements.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  mipmaps LOD bias bensta00 2 4,004 Feb 2, 2005 10:04 AM
Last Post: bensta00
  Pixel Buffers, Cocoa, and Mipmaps bensta00 10 5,631 Jan 24, 2005 02:11 PM
Last Post: arekkusu