This is the documentation for Enlighten.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Functions to create and manage emissive environments and the associated input lighting buffers.

Functions

Name Description
CalcEnvironmentInputLightingBufferSize(Geo::s32, PrecisionHint::Value)

Tells you the amount of memory required to hold input lighting for a given environment resolution.

CalcNumEnvironmentLightValues(Geo::s32)

Returns the total number of values in the emissive environment cluster tree.

CreateEnvironmentInputLightingBuffer(void *, Geo::s32, PrecisionHint::Value)

Construct an InputLightingBuffer inside the memory provided.

SetEnvironmentLightValues(Enlighten::InputLightingBuffer *, const Geo::v128 *, Geo::s32)

Sets the environment light values.


Geo::u32 GEO_CALL Enlighten::CalcEnvironmentInputLightingBufferSize


public: Geo::u32GEO_CALL CalcEnvironmentInputLightingBufferSize
(
    Geo::s32 environmentResolution,
    PrecisionHint::Value precisionHint
)


Tells you the amount of memory required to hold input lighting for a given environment resolution.

Parameters
[in] environmentResolution

The resolution of the emissive environment.

[in] precisionHint

A hint as to the preferred precision, if available on the platform.


Geo::s32 GEO_CALL Enlighten::CalcNumEnvironmentLightValues


public: Geo::s32GEO_CALL CalcNumEnvironmentLightValues
(
    Geo::s32 environmentResolution
)


Returns the total number of values in the emissive environment cluster tree.

The cluster tree is formed by one root node plus six faces with a perfect tree of 4 children per node. A perfect tree is a tree where each node has the same number of children, and all leaf nodes are on the same level. The formula for the number of nodes per face for a perfect tree is: (number_of_children_per_node * num_leaf_nodes - 1) / (number_of_children_per_node - 1);


InputLightingBuffer* GEO_CALL Enlighten::CreateEnvironmentInputLightingBuffer


public: InputLightingBuffer *GEO_CALL CreateEnvironmentInputLightingBuffer
(
    void * memory,
    Geo::s32 environmentResolution,
    PrecisionHint::Value precisionHint
)


Construct an InputLightingBuffer inside the memory provided.

Parameters
[in] memory

A block of memory (size determined by CalcInputLightingBufferSize) to store the lighting buffer

[in] environmentResolution

The resolution of the emissive environment.

[in] precisionHint

A hint as to the preferred precision, if available on the platform.


bool GEO_CALL Enlighten::SetEnvironmentLightValues


public: bool GEO_CALL SetEnvironmentLightValues
(
    Enlighten::InputLightingBuffer * env,
    const Geo::v128 * values,
    Geo::s32 resolution
)


Sets the environment light values.

The required input is an N x N cube map of environment light values where N is the resolution. The values are laid out in the standard D3D cube map ordering, in v128 format (ie 4 x 32-bit float per value). More explicitly, this means the input buffer should contain 6 * N * N base values with 16 bytes each. The remaining values in the buffer are hierarchical averages for each face and an overall average for the entire cube map. These averages are computed internally by the SetValues function. All light values are in linear space.

Direct3D DDS cube maps use the following face order and XYZ to UV transformation:

face         major axis    uc     vc    ma
----------   ----------   ---    ---   ---
POSITIVE_X      +rx       -rz    -ry    rx
NEGATIVE_X      -rx       +rz    -ry    rx
POSITIVE_Y      +ry       +rx    +rz    ry
NEGATIVE_Y      -ry       +rx    -rz    ry
POSITIVE_Z      +rz       +rx    -ry    rz
NEGATIVE_Z      -rz       -rx    -ry    rz

u = (uc/|ma| + 1) / 2 
v = (vc/|ma| + 1) / 2

  • No labels