This page has been translated automatically.
Видеоуроки
Интерфейс
Основы
Продвинутый уровень
Подсказки и советы
Основы
Программирование на C#
Рендеринг
Профессиональный уровень (SIM)
Принципы работы
Свойства (properties)
Компонентная Система
Рендер
Физика
Редактор UnigineEditor
Обзор интерфейса
Работа с ассетами
Контроль версий
Настройки и предпочтения
Работа с проектами
Настройка параметров ноды
Setting Up Materials
Настройка свойств
Освещение
Sandworm
Использование инструментов редактора для конкретных задач
Расширение функционала редактора
Встроенные объекты
Ноды (Nodes)
Объекты (Objects)
Эффекты
Декали
Источники света
Geodetics
World-ноды
Звуковые объекты
Объекты поиска пути
Player-ноды
Программирование
Основы
Настройка среды разработки
Примеры использования
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Плагины
Форматы файлов
Материалы и шейдеры
Rebuilding the Engine Tools
Интерфейс пользователя (GUI)
Двойная точность координат
API
Animations-Related Classes
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
VR-Related Classes
Работа с контентом
Материалы
Визуальный редактор материалов
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Учебные материалы

Отсечение по окклюзии

Object culling allows you not to render objects which are not presented in the viewing frustum. The particular cases of occlusion culling are the following: Отсечение объектов позволяет не отображать объекты, не попадающие в усеченную пирамиду видимости. В частности существуют следующие варианты отсечения по окклюзии:

Примечание
As the object's bounding box is used for occlusion culling (it is checked if the bounding box is visible or not), it is recommended to export objects from 3D computer graphics software in local coordinates to make bounds of the mesh closer to geometry. Поскольку ограничивающий прямоугольник объекта используется для отсечения по окклюзии (проверяется, виден ли ограничивающий прямоугольник или нет), рекомендуется экспортировать объекты из программного обеспечения для компьютерной 3D-графики в локальных координатах, чтобы границы сетки были ближе к геометрии.

OccludersОкклюдеры#

Occluders allow culling geometry that isn't visible behind them. There are 2 types of occluders: Окклюдеры позволяют отсекать геометрию, которая не видна позади них. Есть 2 типа окклюдеров:

The type of occluder to be used is defined by geometry to be culled. Тип используемого окклюдера определяется выбираемой геометрией.

Occluders can be very effective in case of complex environments where there are many objects that occlude each other and are costly to render (they have a lot of polygons and/or heavy shaders). Окклюдеры могут быть очень эффективны в сложных сценах, где есть много объектов, которые перекрывают друг друга и требуют больших затрат на рендеринг (у них много полигонов и / или тяжелых шейдеров).

Примечание
Using occluders to cull large objects with a few surfaces may cause additional performance loss. Moreover, occluders aren't effective in scenes with flat objects, or when a camera looks down on the scene from above. So, when using the occluders, you should take into account peculiarities of objects to be culled. Использование окклюдеров для отсечения больших объектов с несколькими поверхностями может вызвать дополнительную потерю производительности. Более того, окклюдеры не эффективны в сценах с плоскими объектами или когда камера смотрит на сцену сверху. Поэтому при использовании окклюдеров следует учитывать особенности отбираемых объектов.

Before using occluders, check the following: Перед использованием окклюдеров проверьте следующее:

  • Rendering of occluders is enabled: in the Menu Bar, Rendering -> Occlusion Culling -> Occluders is toggled on. Визуализация окклюдеров включена: в меню включен Rendering -> Occlusion Culling -> Occluders.
  • Rendering of shadows from the occluded objects is disabled: in the Menu Bar, choose Rendering -> Occlusion Culling and toggle Shadows Culling on.
    Примечание
    You can leave shadows rendering enabled, if necessary.You can leave shadows rendering enabled, if necessary.
    You can leave shadows rendering enabled, if necessary.
    Отрисовка теней от закрытых объектов отключена: в меню выберите Rendering -> Occlusion Culling и включите Shadows Culling.
    Примечание
    You can leave shadows rendering enabled, if necessary. При необходимости можно оставить включенным рендеринг теней.

Usage of occluders is shown in the Content Optimization video tutorial. Использование окклюдеров показано в видеоуроке Оптимизация контента .

Using a Box-Shaped OccluderИспользование прямоугольного окклюдера#

The occluder is a box shape that culls objects' surfaces, bounds of which aren't visible behind it. This is the simplest type of occluders that should be used together with box-shaped objects that block off other objects. For example, you can add an occluder the shape of which coincides with the bounds of a building to avoid rendering of objects behind this building. Окклюдер - это прямоугольная форма, которая отсекает поверхности объектов, границы которых не видны позади них. Это самый простой тип окклюдеров, который следует использовать вместе с объектами в форме параллелепипеда, которые блокируют другие объекты. Например, вы можете добавить окклюдер, форма которого совпадает с границами здания, чтобы избежать рендеринга объектов позади этого здания.

Box-shaped occluder inside building Прямоугольный-окклюдер внутри здания

To create a box-shaped occluder, perform the following: Чтобы создать прямоугольный окклюдер, выполните следующие действия:

  1. In the Menu Bar, choose Create -> Optimization -> Occluder and add the occluder as a child to the node that should occlude other objects. В меню выберите Create -> Optimization -> Occluder и добавьте окклюдер в качестве дочернего узла к узлу, который должен перекрывать другие объекты.
  2. In the Common section of the Node tab in the Parameters window, set the position of the occluder to the parent one.

    В разделе Common вкладки Node в окне Parameters установите положение окклюдера на родительский.

  3. In the World Occluder section of the Node tab, click Edit Size to enable the editing mode for the occluder. Resize the occluder by using the colored rectangles on the occluder box sides so that it coincides with the parent node size.
    Примечание
    You can also use the Size parameter to set the size along the axes.You can also use the Size parameter to set the size along the axes.

    You can also use the Size parameter to set the size along the axes.
    В разделе World Occluder вкладки Node щелкните Edit Size, чтобы включить режим редактирования для окклюдера. Измените размер окклюдера, используя цветные прямоугольники по бокам окклюдера, чтобы он совпадал с размером родительского узла.
    Примечание
    You can also use the Size parameter to set the size along the axes. Вы также можете использовать параметр Size, чтобы установить размер по осям.

  4. Specify the Distance between the camera and the occluder, at which the occluder doesn't occlude anything and, therefore, should be disabled to avoid negative impact on the performance.

    Укажите Distance между камерой и окклюдером, при котором окклюдер ничего не закрывает и, следовательно, должен быть отключен, чтобы избежать негативного влияния на производительность.

To check how the occluder works, disable the parent node and then try to toggle the occluder on and off: Чтобы проверить, как работает окклюдер, отключите родительский узел, а затем попробуйте включить и выключить окклюдер:

By default, the front faces of the occluder are used to cull objects. However, if the camera is inside the occluder (e.g. inside the building), occlusion culling won't be performed. To avoid such situation, enable the Back Face parameter in the World Occluder section of the Node tab. По умолчанию передние грани окклюдера используются для отсечения объектов. Однако, если камера находится внутри окклюдера (например, внутри здания), отсечение окклюзии выполняться не будет. Чтобы избежать такой ситуации, включите параметр Back Face в разделе World Occluder вкладки Node.

Using a Mesh-Based OccluderИспользование меш-окклюдера#

The occluder mesh is based on an arbitrary mesh that culls objects' surfaces, bounds of which aren't visible behind it. The occluder mesh is used together with the geometry that cannot be approximated with a box. Меш-окклюдер основан на произвольном меше, который отсекает поверхности объектов, границы которых не видны позади Это. Меш-окклюдер используется вместе с геометрией, которую нельзя аппроксимировать прямоугольным окклюдером.

To create a mesh-based occluder, perform the following:

  1. Prepare a low-poly mesh to be used for the occluder.
    Примечание
    It isn't recommended to use the same detailed mesh that is used for the node that should occlude other objects: the mesh for the occluder should be as simple as possible to avoid performance loss.It isn't recommended to use the same detailed mesh that is used for the node that should occlude other objects: the mesh for the occluder should be as simple as possible to avoid performance loss.

    It isn't recommended to use the same detailed mesh that is used for the node that should occlude other objects: the mesh for the occluder should be as simple as possible to avoid performance loss.
    Prepare a low-poly mesh to be used for the occluder.
    Примечание
    It isn't recommended to use the same detailed mesh that is used for the node that should occlude other objects: the mesh for the occluder should be as simple as possible to avoid performance loss.It isn't recommended to use the same detailed mesh that is used for the node that should occlude other objects: the mesh for the occluder should be as simple as possible to avoid performance loss.

  2. In the Menu Bar, choose Create -> Optimization -> Occluder Mesh and specify the prepared mesh.
    Примечание
    You can load a new mesh for the occluder at any time.You can load a new mesh for the occluder at any time.
    You can load a new mesh for the occluder at any time.
    In the Menu Bar, choose Create -> Optimization -> Occluder Mesh and specify the prepared mesh.
    Примечание
    You can load a new mesh for the occluder at any time.You can load a new mesh for the occluder at any time.
  3. Add the occluder as a child to the node that should occlude other objects.Add the occluder as a child to the node that should occlude other objects.
  4. In the Common section of the Node tab in the Parameters window, set the position of the occluder to the parent one.

    In the Common section of the Node tab in the Parameters window, set the position of the occluder to the parent one.

  5. Specify the Distance between the camera and the occluder, at which the occluder doesn't occlude anything and, therefore, should be disabled to avoid negative impact on the performance.

    Specify the Distance between the camera and the occluder, at which the occluder doesn't occlude anything and, therefore, should be disabled to avoid negative impact on the performance.

Prepare a low-poly mesh to be used for the occluder.
Примечание
It isn't recommended to use the same detailed mesh that is used for the node that should occlude other objects: the mesh for the occluder should be as simple as possible to avoid performance loss.It isn't recommended to use the same detailed mesh that is used for the node that should occlude other objects: the mesh for the occluder should be as simple as possible to avoid performance loss.

It isn't recommended to use the same detailed mesh that is used for the node that should occlude other objects: the mesh for the occluder should be as simple as possible to avoid performance loss.In the Menu Bar, choose Create -> Optimization -> Occluder Mesh and specify the prepared mesh.
Примечание
You can load a new mesh for the occluder at any time.You can load a new mesh for the occluder at any time.
You can load a new mesh for the occluder at any time.Add the occluder as a child to the node that should occlude other objects.In the Common section of the Node tab in the Parameters window, set the position of the occluder to the parent one.

Specify the Distance between the camera and the occluder, at which the occluder doesn't occlude anything and, therefore, should be disabled to avoid negative impact on the performance.

Чтобы создать окклюдер на основе меша, выполните следующие действия:

  1. Prepare a low-poly mesh to be used for the occluder.
    Примечание
    It isn't recommended to use the same detailed mesh that is used for the node that should occlude other objects: the mesh for the occluder should be as simple as possible to avoid performance loss.It isn't recommended to use the same detailed mesh that is used for the node that should occlude other objects: the mesh for the occluder should be as simple as possible to avoid performance loss.

    It isn't recommended to use the same detailed mesh that is used for the node that should occlude other objects: the mesh for the occluder should be as simple as possible to avoid performance loss.
    Подготовьте низкополигональную сетку, которая будет использоваться для окклюдера.
    Примечание
    It isn't recommended to use the same detailed mesh that is used for the node that should occlude other objects: the mesh for the occluder should be as simple as possible to avoid performance loss. Не рекомендуется использовать ту же подробную сетку, которая используется для узла, который должен перекрывать другие объекты: сетка для окклюдера должна быть как можно более простой, чтобы избежать потери производительности.

  2. In the Menu Bar, choose Create -> Optimization -> Occluder Mesh and specify the prepared mesh.
    Примечание
    You can load a new mesh for the occluder at any time.You can load a new mesh for the occluder at any time.
    You can load a new mesh for the occluder at any time.
    В меню выберите Create -> Optimization -> Occluder Mesh и укажите подготовленную сетку.
    Примечание
    You can load a new mesh for the occluder at any time. Вы можете загрузить новую меш для окклюдера в любое время.
  3. Add the occluder as a child to the node that should occlude other objects. Добавьте окклюдер в качестве потомка к узлу, который должен перекрывать другие объекты.
  4. In the Common section of the Node tab in the Parameters window, set the position of the occluder to the parent one.

    В разделе Common вкладки Node в окне Parameters установите положение окклюдера на родительский.

  5. Specify the Distance between the camera and the occluder, at which the occluder doesn't occlude anything and, therefore, should be disabled to avoid negative impact on the performance.

    Укажите Distance между камерой и окклюдером, при котором окклюдер ничего не закрывает и, следовательно, должен быть отключен, чтобы избежать негативного влияния на производительность.

Hardware Occlusion QueriesЗапросы аппаратной окклюзии#

One more option to cull geometry that is not visible in the camera viewport is to use a hardware occlusion query. It allows skipping rendering of objects, the bounding boxes of which are covered by another solid geometry. As a result, the number of rendered polygons is reduced and the performance grows. Еще один способ отсеять геометрию, которая не видна в окне просмотра камеры, - использовать запрос аппаратной окклюзии . Это позволяет пропускать рендеринг объектов, ограничивающие рамки которых закрыты другой непрозрачной геометрией. В результате количество отрисовываемых полигонов уменьшается, а производительность растет.

To run the hardware occlusion test for the scene before sending data to the GPU, toggle the Rendering -> Occlusion Culling -> Occlusion Query flag on in the Menu Bar. Чтобы запустить тест аппаратной окклюзии для сцены перед отправкой данных на GPU, включите флаг Rendering -> Occlusion Culling -> Occlusion Query в меню.

Примечание
Culling will be performed for all objects with the Culled by Occlusion Query flag set in the Node tab of the Parameters window. Отбор будет выполняться для всех объектов с флагом Culled by Occlusion Query, установленным на вкладке Node окна Parameters.

To run the hardware occlusion test, perform the following: Чтобы запустить тест на окклюзию оборудования, выполните следующие действия:

  1. In the Menu Bar, toggle the Rendering -> Occlusion Culling -> Occlusion Query flag on to enable testing for the scene before sending data to the GPU.

    В меню включите флаг Rendering -> Occlusion Culling -> Occlusion Query, чтобы включить тестирование сцены перед отправкой данных на графический процессор.

  2. For all objects, that should be culled, enable the Culled by Occlusion Query flag in the Node tab of the Parameters window.
    Примечание
    Only nodes with this flag set are tested on the hardware occlusion culling.Only nodes with this flag set are tested on the hardware occlusion culling.

    Only nodes with this flag set are tested on the hardware occlusion culling.
    Для всех объектов, которые следует отсечь, включите флаг Culled by Occlusion Query на вкладке Node окна Parameters.
    Примечание
    Only nodes with this flag set are tested on the hardware occlusion culling. Только узлы с этим установленным флагом проверяются на аппаратное отсечение по окклюзии.

When culling is enabled for the object, an occlusion query box is rendered for it. Если для объекта включена отсечение, для него отображается окно запроса окклюзии .

Material ball and its occlusion query box Material ball и его окно запроса окклюзии
Примечание
To visualize such boxes, toggle the Helpers -> Occlusion Queries option on. Чтобы визуализировать такие блоки, включите опцию Helpers -> Occlusion Queries.

The occlusion query box coincides with the size of the object's bounding box. When this box is overlapped (i.e. it isn't in the camera viewport), it is highlighted red, which means the occlusion test is not passed and the mesh will not be drawn. Поле запроса окклюзии совпадает с размером ограничивающего прямоугольника объекта. Когда это поле перекрывается (т.е. его нет в области просмотра камеры), оно подсвечивается красным , что означает, что тест на окклюзию не пройден и сетка не будет отрисована.

Occlusion query test passed Тест запроса на окклюзию пройден
Occlusion query test failed, material ball isn't rendered Тест запроса окклюзии не прошел, Material ball не отображается
Примечание
Hardware occlusion queries should be used only for objects that use heavy shaders. Otherwise, performance will decrease instead of increasing. It is recommended to enable queries for water or objects with reflections. Запросы аппаратной окклюзии следует использовать только для объектов, использующих тяжелые шейдеры. В противном случае производительность будет снижаться, а не увеличиваться. Рекомендуется включить запросы для воды или объектов с отражениями.

You can check the effect of this technique by enabling the second wireframe mode to see all triangles in the scene. Type render_show_triangles 2 in the console and check the way the occluded polygons act. Вы можете проверить эффект этой техники, включив второй каркасный режим, чтобы увидеть все треугольники в сцене. Введите в консоли render_show_triangles 2 и проверьте, как действуют закрытые многоугольники.

An example of using hardware occlusion queries is also available in the Content Optimization video tutorial. Пример использования запросов аппаратной окклюзии также доступен в видеоуроке Оптимизация контента .

Последнее обновление: 29.09.2021
Build: ()