Skip to content

BrightnessPlugin

Brightness estimation plugin

Plugin estimates parameters of lighting (brightness) observed in the current image and calls the provided callback with these parameters. This plugin can be used for automatic adjustment of intensities of lights on the scene, for example in callback user can scale intensity properties of lights and environment map according to estimated brightness. One can set output range, estimated value will not go below the minimum and [min..max] range will be scaled to [min..1.0]. Adaptive low pass smoothing is applied to the result.

new BrightnessPlugin(callback?, rangeMax?, rangeMin?, filterParams?): BrightnessPlugin

Constructor

(brightness) => void

Method when brightness has changed

number = 0.5

Maximum brightness, range scales to [min..1.0]

number = 0.1

Minimum brightness, range scales to [min..1.0]

FilterParams = ...

Parameters of reactive low-pass filter

BrightnessPlugin

Plugin.constructor

protected optional callback: (brightness) => void

Method when brightness has changed

number

void


protected filterParams: FilterParams

Parameters of reactive low-pass filter


loaded: boolean

Loaded state

Plugin.loaded


ordinal: number

Ordinal number

Plugin.ordinal


protected rangeMax: number = 0.5

Maximum brightness, range scales to [min..1.0]


protected rangeMin: number = 0.1

Minimum brightness, range scales to [min..1.0]


protected optional renderer: Renderer<any>

Renderer loaded the plugin

Plugin.renderer

dispose(): void

Dispose video plugin

void

Plugin.dispose


load(renderer): Promise<void>

Initialize plugin

Initializes resources for the brightness estimation. Acquires webgl context of the main ShaderRenderer, allocates multilevel texture for the input image.

Renderer<any>

Renderer this plugin is attached to

Promise<void>

Promise resolving when initialization is finished

Plugin.load


setCallback(callback): void

Set brightness change callback

Method when brightness has changed

undefined | (brightness) => void

void


setupCamera(ratio, angle): void

Set camera parameters

Could be overridden to adjust plugin’s pipeline.

number

Aspect ration of input video

number

Vertical field of view in radians

void

Plugin.setupCamera


setupVideo(size): boolean

Set video size

Resize multilevel texture

Size

Resolution of input video

boolean

Plugin.setupVideo


unload(): void

Reset plugin

Releases all resources and instances created in load().

void

Plugin.unload


update(result, stream): Promise<void>

Update

Plugin estimates current brightness and calls provided callback.

any

Results of video processing

HTMLCanvasElement

Captured video frame

Promise<void>

Promise resolving when update is finished

Plugin.update