class LightProbeVolume

Inherits: Component, CoreObject

Allows you to define a volume of light probes that will be used for indirect lighting.

Lighting information in the scene will be interpolated from nearby probes to calculate the amount of indirect lighting at that position. It is up to the caller to place the light probes in areas where the lighting changes in order to yield the best results.

The volume can never have less than 4 probes.

Public

Constructors

LightProbeVolume

LightProbeVolume(const HSceneObject &parent, const AABox &volume = AABox::kUnit, const Vector3I &cellCount = Vector3I(1, 1, 1))

Methods

AddProbe

u32 AddProbe(const Vector3 &position)

Adds a new probe at the specified position and returns a handle to the probe.

The position is relative to the volume origin.

RemoveProbe

void RemoveProbe(u32 handle)

Removes the probe with the specified handle.

Note that if this is one of the last four remaining probes in the volume it cannot be removed.

SetProbePosition

void SetProbePosition(u32 handle, const Vector3 &position)

Updates the position of the probe with the specified handle.

GetProbePosition

Vector3 GetProbePosition(u32 handle) const

Retrieves the position of the probe with the specified handle.

GetProbes

Vector<LightProbeInfo> GetProbes() const

Returns a list of all light probes in the volume.

RenderProbe

void RenderProbe(u32 handle)

Causes the information for this specific light probe to be updated.

You generally want to call this when the probe is moved or the scene around the probe changes.

RenderProbes

void RenderProbes()

Causes the information for all lights probes to be updated.

You generally want to call this if you move the entire light volume or the scene around the volume changes.

Resize

void Resize(const AABox &volume, const Vector3I &cellCount = Vector3I(1, 1, 1))

Resizes the light probe grid and inserts new light probes, if the new size is larger than previous size.

New probes are inserted in a grid pattern matching the new size and density parameters.

Note that shrinking the volume will not remove light probes. In order to remove probes outside of the new volume call Clip().

Resize will not change the positions of current light probes. If you wish to reset all probes to the currently set grid position, call Reset().

volume
Axis aligned volume to be covered by the light probes.
cellCount
Number of grid cells to split the volume into. Minimum number of 1, in which case each corner of the volume is represented by a single probe. Higher values subdivide the volume in an uniform way.

Clip

void Clip()

Removes any probes outside of the current grid volume.

Reset

void Reset()

Resets all probes to match the original grid pattern.

This will reset probe positions, as well as add/remove probes as necessary, essentially losing any custom changes to the probes.

GetGridVolume

const AABox &GetGridVolume() const

Returns the volume that's used for adding probes in a uniform grid pattern.

GetCellCount

const Vector3I &GetCellCount() const

Returns the cell count that's used for determining the density of probes within a grid volume.

staticGetRttiStatic

static RTTIType *GetRttiStatic()

GetRtti

RTTIType *GetRtti() const

Returns an interface you can use to access class' Run Time Type Information.

Protected

Constructors

LightProbeVolume

LightProbeVolume()

Methods

RunRenderProbeTask

void RunRenderProbeTask()

Renders the light probe data on the render thread.

UpdateCoefficients

void UpdateCoefficients()

Fetches latest SH coefficient data from the render thread.

Note this method will block the caller thread until the data is fetched from the render thread. It will also force any in-progress light probe updates to finish.

CreateRenderProxy

SPtr<render::RenderProxy> CreateRenderProxy() const override

Creates an object that contains render thread specific data and methods for this object.

Can be null if such object is not required.

CreateRenderProxySyncPacket

RenderProxySyncPacket *CreateRenderProxySyncPacket(FrameAllocator &allocator, u32 flags) override

Creates a data packet that will be used for syncing the core object with it's render proxy.

Caller must free the retrieved packet using the provided allocator when done using it.

Initialize

void Initialize() override

Construct any resources the component needs before use.

Called when the parent scene object is initialized. A non-initialized component shouldn't be used in a live scene (i.e. it should not receive any of the component logic updates or events).

OnCreated

void OnCreated() override

Called once when the component has been created.

Called regardless of the state the component is in.

OnDestroyed

void OnDestroyed() override

Called once just before the component is destroyed.

Called regardless of the state the component is in.

Fields

mProbes

UnorderedMap<u32, ProbeInfo> mProbes

mVolume

AABox mVolume

mCellCount

Vector3I mCellCount

mNextProbeId

u32 mNextProbeId

mRendererTask

SPtr<render::RendererTask> mRendererTask