Mipmap bias что это
Перейти к содержимому

Mipmap bias что это

  • автор:

Texture.mipMapBias

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Submission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Your name Your email Suggestion * Submit suggestion
public float mipMapBias ;

Description

The mipmap bias of the Texture.

A positive bias makes a Texture appear extra blurry, while a negative bias sharpens the Texture.

Note that using large negative bias can reduce performance, so it’s not recommended to use more than -0.5 negative bias. In most cases you can achieve better sharpening of the Texture by using anisotropic filtering.

Mipmap bias doesn’t work with the following:

  • MaterialPropertyBlocks.
  • Some graphics APIs. For example Metal, or OpenGL ES unless you use custom shaders.

Is something described here not working as you expect it to? It might be a Known Issue. Please check with the Issue Tracker at issuetracker.unity3d.com.

Copyright ©2024 Unity Technologies. Publication Date: 2024-04-05.

Mipmaps introduction

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:

Mipmap levels

Mipmaps are commonly used for rendering objects in 3D scenes A Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary , where textured objects can vary in distance from the camera A component which creates an image of a particular viewpoint in your scene. The output is either drawn to the screen or captured as a texture. More info
See in Glossary . 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.

Sometimes, mipmaps aren’t beneficial. Mipmaps increase the size of a texture by 33%, both on disk and in memory. They also provide no benefit when a texture is only rendered at its full resolution, such as a UI (User Interface) Allows a user to interact with your application. Unity currently supports three UI systems. More info
See in Glossary texture that isn’t scaled.

You can create a mipmap for a texture manually, or you can instruct Unity to generate a mipmap for you. To automatically generate a mipmap, ensure that your original texture’s resolution is a power of two value, as shown in the example mipmap image.

You can enable or disable mipmaps for a texture asset in the Texture Import Settings Inspector.

How the GPU samples mipmap levels

When the GPU samples a texture, it determines which mipmap level to use based on the texture coordinates (UVs) for the current pixel The smallest unit in a computer image. Pixel size depends on your screen resolution. Pixel lighting is calculated at every screen pixel. More info
See in Glossary , 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.

Mipmap bias

A setting called mipmap bias can do two things while sampling, based on the sampler settings:

  • The mipmap bias can change the threshold for the GPU selecting a lower or higher mipmap level for a sample. The GPU selects a specific mipmap level when you use point and linear filtering in a sampler. For example, the GPU’s might decide that the texture at a set of UVs uses a sample from mipmap level 3. With a mipmap bias of –2, the GPU would use the higher resolution mipmap level 1 for the sample, instead.
  • The mipmap bias can tell the GPU to prefer one mipmap level over another by an exact percentage when blending samples from different mipmap levels. The GPU blends mipmap levels when you use trilinear filtering in a sampler. For example, the GPU’s calculations might return a value of 0.5. The 0.5 value tells the GPU to take 50% of the texture information it needs from one mipmap level, and the remaining 50% from the next mipmap level. With an added mipmap bias of 0.2, the 0.5 value would change to 0.7, and the GPU would take 70% of the texture information from the first mipmap level and only 30% from the second.

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 A program that runs on the GPU. More info
See in Glossary .

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.

How Unity loads mipmaps

You can control the way that Unity loads mipmaps at runtime with Mipmap Streaming.

gpu_set_tex_mip_bias

С помощью этой функции вы можете установить значение смещения мипмапы, где значение 0 равно отсутствию смещения, 1 равно первой мипмапе, 2 равно второй мипмапе и т.д.. Это контролирует скорость смены мип-карт и обычно делает рендеринг текстур более размытым, чем выше значение и чем больше «расстояние». Обратите внимание, что эта функция может принимать и отрицательные значения, в этом случае отрисованные текстуры будут более четкими на большем расстоянии, чем меньше значение.

Синтаксис:
Аргумент Тип Описание
bias Real The mipmap bias value to use (default: 0)
Возвращается:
Пример:

if gpu_get_tex_mip_bias() != 0
gpu_set_tex_mip_bias(0);
>

Приведенный выше код проверяет текущее смещение mipmap и если оно не равно 0, то устанавливается на 0.

MIP-текстурирование

MIP-текстурирование (англ. MIP mapping ) — метод текстурирования, использующий несколько копий одной текстуры с разной детализацией. Название происходит от лат. multum in parvo — «много в малом».

Назначение

Изображение лучше всего выглядит, когда детализация текстуры близка к разрешению экрана. Если разрешение экрана высокое (текстура слишком маленькая/объект очень близко), получается размытое изображение. Если же разрешение текстуры слишком высокое (текстура слишком велика/объект очень далеко), получаем случайные пиксели — а значит, потерю мелких деталей, мерцание и большой процент промахов в кэш. Получается, что лучше иметь несколько текстур разной детализации и накладывать на объект ту, которая наиболее подходит в данной ситуации.

Принцип действия

Создаётся так называемая MIP-пирамида — последовательность текстур с разрешением от максимального до 1×1. Например: 1×1, 2×2, 4×4, 8×8, 16×16, 32×32, 64×64, 128×128, 256×256, 512×512 и 1024×1024. Каждая из этих текстур называется MIP-уровнем (англ. MIP level ) или уровнем детализации (англ. level of detail ).

\sum_<i=0></p>
<p>На всех этих текстурах находится одно и то же изображение. Таким образом, MIP-текстурирование увеличивает расход видеопамяти на треть: ^\infty \left( \frac 1 4 \right)^i = 1 \frac 1 3″ width=»» height=»» />.</p>
<p><img decoding=Есть ли в церкви туалет

  • Коэффициент спроса на вентиляционное оборудование
  • Просмотрщик dwg для windows 10
  • Размерные числа наносимые на чертеже должны соответствовать
  • Добавить комментарий

    Ваш адрес email не будет опубликован. Обязательные поля помечены *