This page has been translated automatically.
Видеоуроки
Interface
Essentials
Advanced
Полезные советы
Программирование на C#
Принципы работы
Свойства (properties)
Компонентная Система
Рендер
Физика
Редактор UnigineEditor
Обзор интерфейса
Работа с ассетами
Настройки и предпочтения
Работа с проектами
Настройка параметров узла
Setting Up Materials
Setting Up Properties
Освещение
Landscape Tool
Sandworm (Experimental)
Использование инструментов редактора для конкретных задач
Extending Editor Functionality
Встроенные объекты
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Objects
Sound Objects
Pathfinding Objects
Players
Программирование
Основы
Настройка среды разработки
Примеры использования
UnigineScript
C++
C#
Унифицированный язык шейдеров UUSL
File Formats
Rebuilding the Engine Tools
GUI
Двойная точность координат
API
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
Работа с контентом
Оптимизация контента
Материалы
Art Samples
Tutorials
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

Unigine::BakeLighting Class

Header: #include <UnigineRender.h>

This class allows you to bake lighting.

BakeLighting Class

Enums

LIGHTMAP_QUALITY#

Light baking quality preset.
NameDescription
LIGHTMAP_QUALITY_DRAFT = 0Ultra baking quality. Provides the highest iterativity with the lowest sampling quality and number of rays.
LIGHTMAP_QUALITY_LOW = 1Ultra baking quality. Provides low sampling quality and number of light rays.
LIGHTMAP_QUALITY_MEDIUM = 2Ultra baking quality. Corresponds to stable quality level which is good for most cases.
LIGHTMAP_QUALITY_HIGH = 3Ultra baking quality. Corresponds to high sampling quality and number of light rays simulated intended for release production.
LIGHTMAP_QUALITY_ULTRA = 4Ultra baking quality. Might be useful to get rid of even small inconsistencies. Intended for the release production.

Members


void bake ( const Vector< Ptr<LightVoxelProbe> > & voxel_lights, const Vector< Ptr<LightEnvironmentProbe> > & env_lights, const Vector< Ptr<Light> > & shadow_lights, const Vector< Ptr<ObjectMeshStatic> > & objects, const Vector< int > & surfaces ) #

Starts the process of light baking for all voxel and environment probes, shadow baking for light sources in static light mode and lightmaps baking for surfaces of Mesh Static objects in the given list.

Arguments

  • const Vector< Ptr<LightVoxelProbe> > & voxel_lights - List of voxel probes for which the process of light baking is to be performed. The order of nodes added for baking is not important.
  • const Vector< Ptr<LightEnvironmentProbe> > & env_lights - List of environment probes for which the process of light baking is to be performed. The order of nodes added for baking is not important.
  • const Vector< Ptr<Light> > & shadow_lights - List of light sources in static light mode for which the process of shadow baking is to be performed. The order of lights added for baking is not important.
  • const Vector< Ptr<ObjectMeshStatic> > & objects - List of Mesh Static objects for which the process of lightmaps baking is to be performed.
  • const Vector< int > & surfaces - List of surfaces of Mesh Static objects for which the process of lightmaps baking is to be performed.
    Notice
    The number of objects and surfaces added for baking must be equal.

void bakeAll ( bool voxel_probes = true, bool env_probes = true, bool shadow = true, bool lightmap = true ) #

Starts the process of light baking for all enabled voxel and environment probes, shadow baking for eanbled light sources in static light mode and lightmaps baking for enabled surfaces of Mesh Static objects in the scene.

Arguments

  • bool voxel_probes - 1 to enable light baking for voxel probes; otherwise, 0.
  • bool env_probes - 1 to enable light baking for environment probes; otherwise, 0.
  • bool shadow - 1 to enable shadow baking for light sources in static light mode; otherwise, 0.
  • bool lightmap - 1 to enable lightmaps baking for surfaces of Mesh Static objects; otherwise, 0.

bool isBaking ( ) const#

Returns a value indicating if the process of baking is being performed at the moment.

Return value

1 if lighting is being baked; otherwise - 0.

int getCurrentBounce ( ) const#

Returns a bounce being calculated at the moment.
Notice
If the process of baking is not being performed at the moment, 1 is returned.

Return value

Bounce number.

int getBounces ( ) const#

Returns number of all bounces.

Return value

Number of bounces.

int getProgress ( ) const#

Returns overall progress of light baking.
Notice
If the process of baking is not being performed at the moment, 0 is returned.

Return value

Overall baking progress, in percents.

int getProgressBounce ( ) const#

Returns a value showing progress of calculating current bounce.

Return value

Bounce calculating progress, in percents.

float getVoxelSizeMultiplier ( ) const#

Returns the value of the voxel size multiplier parameter. By default, it is equal to 1.0f.

Return value

Voxel size multiplier.

void setBounces ( int bounces ) #

Sets number of bounces.

Arguments

  • int bounces - Number of bounces within the [1, 32] range. The default value is 1.

int getProgressLight ( ) const#

Returns progress of light baking for the current LightVoxelProbe at the moment.

Return value

LightVoxelProbe progress, in percents.

float getTimer ( ) const#

Returns the time elapsed from the start of the process of baking.

Return value

Elapsed time, in seconds.

void setVoxelSizeMultiplier ( float multiplier ) #

Sets the value of the voxel size multiplier parameter.

Arguments

  • float multiplier - Voxel size multiplier within the [0.0f, 8.0f] range. The default value is 1.

void stop ( bool save_results = false ) #

Interrupts the process of light baking, if it is in performing state.

Arguments

  • bool save_results - 1 to save the obtained result; 0 to restore the previous content.

Ptr<Light> getCurrentLight ( ) const#

Returns an instance of the LightVoxelProbe being calculated at the moment.

Return value

Current LightVoxelProbe.

void addReadOnlyTexture ( const UGUID & guid ) #

Adds a read-only texture with the specified GUID.

Arguments

  • const UGUID & guid - GUID of the read-only texture to be added.

void removeReadOnlyTexture ( const UGUID & guid ) #

Removes the read-only texture with the specified GUID.

Arguments

  • const UGUID & guid - GUID of the read-only texture to be removed.

void setSamplesPerFrame ( int frame ) #

Sets number of voxels for voxel probes and samples for environment probes, light sources and surfaces computed and visualized per single frame.

Arguments

  • int frame - Number of samples per frame within the [1, 500] range. The default value is 1.
    Notice
    High values cause longer user interface response.

int getSamplesPerFrame ( ) const#

Returns number of voxels for voxel probes and samples for environment probes, light sources and surfaces computed and visualized per single frame.

Return value

Number of samples.

void setLightmapQuality ( BakeLighting::LIGHTMAP_QUALITY quality ) #

Sets the global baking quality for lightmaps.

Arguments

BakeLighting::LIGHTMAP_QUALITY getLightmapQuality ( ) const#

Returns the current global baking quality for lightmaps.

Return value

LIGHTMAP_QUALITY preset.

void setLightmapViewportMask ( int mask ) #

Sets the viewport mask for the lightmapper. For a light or surface to contribute to static GI, their viewport masks should match the baking viewport mask.

Arguments

  • int mask - Viewport mask (integer, each bit of which is used to represent a mask).

int getLightmapViewportMask ( ) const#

Returns the current viewport mask set for lightmapper.

Return value

Viewport mask (integer, each bit of which is used to represent a mask).

void setLightmapZFar ( float zfar ) #

Sets the far clipping distance for light rays used when baking lightmaps.

Arguments

  • float zfar - Far clipping distance.

float getLightmapZFar ( ) const#

Returns the far clipping distance for light rays.

Return value

Far clipping distance.

void setCacheDir ( const char * dir ) #

Sets the path to the directory that stores temporary cache textures during lightmaps baking process. By default, the bin/unigine_bake_lighting_cache project's folder is set.
Notice
It is recommended to specify a path to a non-existing folder to avoid losing files.

Arguments

  • const char * dir - An absolute path or a relative path to the bin folder.

const char * getCacheDir ( ) const#

Returns the current path set for the directory that stores temporary cache textures during lightmaps baking process. By default, the bin/unigine_bake_lighting_cache project's folder is set.

Return value

Path to the cache folder.

Ptr<Object> getCurrentObject ( ) const#

Returns the object currently being processed when baking lightmaps.

Return value

Object pointer during lightmaps baking; otherwise, nullptr.

int getCurrentSurface ( ) const#

Returns the index of the surface currently being processed when baking lightmaps.

Return value

Index of the surface during lightmaps baking; otherwise, -1.
Last update: 24.11.2020
Build: ()