I added mipmaps because i was not so happy with the way the game looked. The problem with mipmaps in XNA is that you can not set the max mipmap level. So in the game i use one image to store multiple tiles for example 10x10 tiles with a size of 16x16 would make the image 160x160. Now when you turn mipmaps on the XNA Pipeline is generating 8 mipmaps:
Original = 160x160 (tilesize 16x16)
Mip 1 = 80x80 (tilesize 8x8)
Mip 2 = 40x40 (tilesize 4x4)
Mip 3 = 20x20 (tilesize 2x2)
Mip 4 = 10x10 (tilesize 1x1)
Mip 5 = 5x5 (tilesize < 1x1)
Mip 6 = 2x2 (tilesize < 1x1)
Mip 7 = 1x1 (tilesize < 1x1)
Mip 8 = 1x1 (tilesize < 1x1)
So after the Mip 4 it would be bad to generate more mipmaps because the tilesize would be less than 1x1 (below you can see how it looks). After doing some research I found out that the only way to solve this problem is to set the max mipmap level in an shader. After i doing this I still was not very happy with the result because the way XNA is generating the mipmaps does not work very good with more than one texture in on image. XNA is just scaling the image down and by doing this the colors of the tiles will mix and i endet up with them becoming a little bit green (as you can see below). So I wrote my own mipmap generator and the problem is gone. It does not look perfect but I am very happy I found a solution to the problem. What do you think?
No mipmap:
Normal mipmap + generated by the XNA Pipeline:
Normal mipmap + mipmap generated by me:
Max mipmap level set to 4 + generated by the XNA Pipeline:
Max mipmap level set to 4 + generated by me (what im currenty using):
0 comments