A mipmap level is a version of a texture with a specific resolution. Mipmap levels exist in sets called mipmaps. Mipmaps contain progressively smaller and lower resolution versions of a single texture.
For example, a mipmap might contain four versions of a texture, from the original texture (mipmap level 0), to mipmap level 1, mipmap level 2, and mipmap level 3:
Mipmaps are commonly used for rendering objects in 3D scenes, where textured objects can vary in distance from the camera. A higher mipmap level is used for objects closer to the camera, and lower mipmap levels are used for more distant objects.
Mipmaps can speed up rendering operations and reduce rendering artifacts in situations where the GPU renders a texture at less than its full resolution. A mipmap is effectively a cached, downsampled version of the original texture. Instead of performing many sampling operations on the original, full resolution texture, the GPU can perform a smaller number of operations on the already downsampled version.
ミップマップが有益でないこともあります。ミップマップは、ディスクとメモリの両方で、テクスチャのサイズを 33% 増加させます。また、スケールされていない UI テクスチャなど、テクスチャが完全な解像度で描画される場合、ミップマップは何の利益ももたらしません。
テクスチャのミップマップは、手動で作成することも、Unity に指示して生成させることもできます。ミップマップを自動生成するには、ミップマップ画像の例に示すように、元のテクスチャの解像度が 2 のべき乗の値でなければなりません。
テクスチャアセットのミップマップの有効無効は、テクスチャインポート設定の Inspector で設定することができます。
When the GPU samples a texture, it determines which mipmap level to use based on the texture coordinates (UVs) for the current pixel, and two internal values that the GPU calculates: DDX and DDY. DDX and DDY provide information about the UVs of the pixels beside and above the current pixel, including distances and angles.
The GPU uses these values to determine how much of a texture’s detail is visible to the camera. A greater distance and a more extreme angle between the current pixel and its neighbors means that the GPU picks a lower resolution mipmap level; a shorter distance and less extreme angle means that the GPU picks a mipmap level with a higher resolution.
The GPU can also blend the texture information from two mipmap levels together with trilinear filtering. Blending mipmap levels while sampling can make the transition from one mipmap level to another less noticeable. To blend mipmap levels, the GPU takes a specific percentage of texture information from one mipmap level and the rest from another mipmap level.
A setting called mipmap bias can do two things while sampling, based on the sampler settings:
The GPU has a global mipmap bias that it applies to its mipmap level selection by default. Textures can have their own mipmap bias, which Unity adds or subtracts from the global mipmap bias. You can also specify your own mipmap bias for an individual texture sampling operation in a shader.
To set the mipmap bias for an individual texture, see Texture.mipMapBias. To set a mipmap bias for a texture sampling operation in a hand-coded shader, use HLSL functions such as tex2dbias. To set a mipmap bias for a texture sampling operation in Shader Graph, see Sample texture 2D Array node or Sample texture 2D node.
Unity がランタイムにミップマップをロードする方法は、ミップマップストリーミング で制御できます。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.