🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Mipmap generation: better to downsample in chain or always using the original size?

Started by
2 comments, last by frob 2 years, 5 months ago

Hi,
Is it better to generate mipmap downsampling using the last generated mipmap or always using the original sized image?
Down-sampling from the original image would give more detailed result but is it what give the best result for mipmaps?
Thanks!

Advertisement

Alundra said:
Down-sampling from the original image would give more detailed result but is it what give the best result for mipmaps?

This depends on your filter, probably, but for example with simple-average, the result is identical (minus minor rounding-errors if you convert each mip immediately to integer-precision before recalculating). Consider this basic example “image”:

10	2		4	3
1	9		5	7

1	1		6	6
1	1		8	1

Now if we calculate the sum and average of each cell, we get:

5.5	(22)		4.75 (19)
1 	(4)		5.25 (21)

Then, the sum of the averages and the sum of the cells:

16.5 (66)

Now, if calculate the average from those results again, we get:

4.125 (4.125)

Which is exactly the same*. Which means that you'd just be wasting a lot of CPU-time for calculating the same thing over and over when you were not using the previous mips for further downsampling. I'm not sure if this is true for all filters though, but I've personally only been doing simple-average for mips, so yeah.

* Just to clarify, average here is done by sum / number-of-elements. In the last step, we divide 66 / 16 because thats essentially how many elements have been summed up at this point, vs the /4 when calculating the cells separately

As above, it is a classic “it depends” answer. Since you wrote “always” the answer is definitely “no”.

Some textures will be identical results. Some textures with difficult patterns, like dense grids or brick or waves, are better drawn by hand or at least verified by artists.

For most games it is something artists look at as a matter of course as they sculpt and texture their models. It is common for artists to start with the auto-generated mipmaps in their tools and touch them up as needed. If you are the one building those tools, I would recommend using the original in each case then showing the artist the morph between each level.

This topic is closed to new replies.

Advertisement