Secondary Maps (Detail Maps) & Detail Mask
The reason for this is to allow the material to have sharp detail when viewed up close, while also having a normal level of detail The Level Of Detail (LOD) technique is an optimization that reduces the number of triangles that Unity has to render for a GameObject when its distance from the Camera increases. More info
See in Glossary when viewed from further away, without having to use a single extremely high texture map to achieve both goals.





If you use a single normal map do ALWAYS plug it into the primary channel. The Secondary normal map channel is more expensive than the primary one but has the exact same effect.
Detail Mask
The detail mask texture allows you to mask off certain areas of your model to have the detail texture applied. This means you can show the detail texture in certain areas, and hide it in others. In the example of the skin pores above, you might want to create a mask so the pores are not shown on the lips or eyebrows.
Secondary Maps (Detail Maps) & Detail Mask
Secondary Maps (or Detail maps) allow you to overlay a second set of textures on top of the main textures listed above. You can apply a second Albedo colour map, and a second Normal map. Typically, these would be mapped on a much smaller scale repeated many times across the object’s surface, compared with the main Albedo and Detail maps.
The reason for this is to allow the material to have sharp detail when viewed up close, while also having a normal level of detail when viewed from further away, without having to use a single extremely high texture map to achieve both goals.





If you use a single normal map do ALWAYS plug it into the primary channel. The Secondary normal map channel is more expensive than the primary one but has the exact same effect.
Detail Mask
The detail mask texture allows you to mask off certain areas of your model to have the detail texture applied. This means you can show the detail texture in certain areas, and hide it in others. In the example of the skin pores above, you might want to create a mask so the pores are not shown on the lips or eyebrows.
Mask and detail maps
The High Definition Render Pipeline (HDRP) uses channel-packed Textures to store multiple Material maps in a single Texture. Channel packing is efficient because it allows the renderer to sample up to four grayscale maps that use the same UV coordinates with a single Texture fetch. HDRP uses two types of channel-packed Textures: the Mask Map, and the Detail Map. They can use a different set of UV coordinates, or a different UV tiling value, giving you more creative freedom.
This document describes the format of the mask map and detail map so that you can author your own to use in HDRP.
To create a mask map:
Mask map
The mask map contains four grayscale Textures, one in each of its color channels.
| Color channel | Map |
|---|---|
| Red | Metallic |
| Green | Occlusion |
| Blue | Detail mask |
| Alpha | Smoothness |
The following example image demonstrates the individual components of a full mask map.
Detail map
The detail map contains two grayscale Textures and one two-component Texture, which is the Material’s normal map.
| Color channel | Map |
|---|---|
| Red | Desaturated albedo |
| Green | Normal Y |
| Blue | Smoothness |
| Alpha | Normal X |
The following example image demonstrates the individual components of a full detail map.
Mask map unity что это
A Mask is not a visible UI control but rather a way to modify the appearance of a control’s child elements. The mask restricts (ie, “masks”) the child elements to the shape of the parent. So, if the child is larger than the parent then only the part of the child that fits within the parent will be visible.

Свойства

| Свойство: | Функция: |
|---|---|
| Show Graphic | Should the graphic of the masking (parent) object be drawn with alpha over the child object? |
Описание
A common use of a Mask is to show a small section of a large Image, using say a Panel object (menu: GameObject > Create UI > Panel) as a “frame”. You can achieve this by firstly making the Image a child of the Panel object. You should position the Image so that the area that should be visible is directly behind the Panel area.
Panel area shown in red with child Image behind
Then, add a Mask component to the Panel. The areas of the child Image outside the panel will become invisible since they are masked by the shape of the Panel.
Masked areas shown faint, but would really be invisible
If the image is then moved around then only the part revealed by the Panel will be visible. The movement could be controlled by Scrollbars to create a scrollable viewer for a map, say.
Implementation
Masking is implemented using the stencil buffer of the GPU.
The first Mask element writes a 1 to the stencil buffer All elements below the mask check when rendering, and only render to areas where there is a 1 in the stencil buffer *Nested Masks will write incremental bit masks into the buffer, this means that renderable children need to have the logical & of the stencil values to be rendered.
Unity — Используем маски для UI и спрайтов
Привет. Маски можно увидеть в большинстве фото и видеоредакторов. В Фотошопе закругления, обрезки и другие подобные задачи и вовсе принято делать только с их помощью. Ведь так мы можем получить отредактированное изображение сохранив оригинал.
В Unity маски используются аналогично. В документации они описаны так:
Маска ограничивает (т. е. «маскирует») дочерние элементы формой родителя. Таким образом, если ребенок больше родителя, то будет видна только та часть ребенка, которая вписывается в родителя.
И сегодня мы рассмотрим пару стандартных масок для UI, один бесплатный ассет, который делает это немного лучше стандартных и маски для спрайтов.
Rect Mask 2D
Эта маска чётко обрезает всё, что находится за пределами родителя. Представим такую ситуацию, где в родительском прямоугольнике находится дочерний Image.
Как видите, родитель намного меньше изображения. Добавляем родителю компонент Rect Mask 2D.
Результат увидим сразу же:
Более интересный эффект можно получить, меняя параметр Softness:
А если добавить родителю свой Image, то вместо прозрачного фона мы получим плавный переход между изображениями:
Но в данном случае мы всяк получаем прямоугольную форму, что не всегда подходит. Переходим к следующему решению.
Mask
Далее нам нужен родитель с компонентом Image, который определит вид маски, и оставим тот же дочерний элемент.
Добавляем родителю компонент Mask:
И смотрим на более интересный результат:
Но, можно заметить, что появились очень острые углы.
Проблема этой маски в том, что результат выглядит достаточно небрежно. Помогут с этим народные умельцы. А именно mob-sakai, который сделал свою версию этой маски, но с опциями сглаживания. Об этом далее.
SoftMaskForUGUI
Добавляем его в проект при помощи Package Manager по этой URL.
Заменяем дефолтную Mask на Soft Mask.
Дочерние элементы теперь должны наследовать Soft Maskable:
Результат вот, но появилась обводка от маски.
Это можно легко скрыть в настройках:
И теперь сравним вид без сглаживания, и с ним:
Сглаживание тоже относительное, конечно. Но мне кажется, что на камере второй вариант выглядит куда приятнее.
Sprite Mask
Варианты выше предусмотрены для UI, а вот эту можно спокойно использовать с обычными спрайтами на сцене. К примеру, для создания головоломок, где обзор ограничен. Или для игр, где нужно искать какие-то предметы.
Для наглядного теста добавим на сцену две картинки:
И пустой объект, куда добавим компонент Sprite Mask:
Теперь у нас есть маска, но нужно указать поведения для спрайтов.
Первому укажем, что его нужно рисовать снаружи маски:
Да, лого тут не лучшее решение. Что-то круглое будет выглядеть интереснее:
Итак. На этом с масками у меня всё. Благодаря им можно достаточно просто создать UI элементы самых разных форм, а также использовать многократно одни и те же ресурсы с разным результатом.




























