Skip to content

raisin::PbrEnvironment ​

struct · #include <rayrai/PbrEnvironment.hpp>

Image-based lighting environment bundle.

Groups the four GL handles that together drive split-sum image-based lighting — display/radiance cubemap, diffuse irradiance cubemap, roughness-prefiltered specular cubemap, split-sum BRDF LUT — plus the mip count of the prefiltered cubemap and an overall strength scalar. Prefer this struct over passing the four handles individually.

Build one with PbrEnvironment::loadFromHdrFile(path) (factory defined in RayraiWindow.hpp so the static IBL loaders are visible) and pass it to Visuals::setPbrEnvironment(env).

Nested classes ​

  • struct LoadOptions — Options accepted by loadFromHdrFile().

Public member functions ​

isComplete ​

cpp
bool isComplete() const

Returns True when all four texture handles are non-zero.

Static member functions ​

loadFromHdrFile static ​

cpp
static PbrEnvironment loadFromHdrFile(const std::string &hdrPath)

Build a complete PbrEnvironment from a single Radiance .hdr file.

Loads the equirectangular cubemap, integrates the diffuse irradiance, computes the GGX-prefiltered specular cubemap, and creates the split-sum BRDF LUT. All four handles are owned by the active GL context and remain valid for the lifetime of that context.

Each handle that fails to build (for example because the file cannot be read) is 0, and isComplete() then returns false. Handles that did build, such as the file-independent BRDF LUT, are still returned.

Defined inline in RayraiWindow.hpp so the static cubemap creators are visible.

Parameters

ParameterDescription
hdrPathPath to the equirectangular Radiance .hdr file.

Returns The baked environment; check isComplete() before use.

cpp
static PbrEnvironment loadFromHdrFile(
    const std::string &hdrPath,
    const LoadOptions &opts)

Build a complete PbrEnvironment from a single Radiance .hdr file.

Loads the equirectangular cubemap, integrates the diffuse irradiance, computes the GGX-prefiltered specular cubemap, and creates the split-sum BRDF LUT. All four handles are owned by the active GL context and remain valid for the lifetime of that context.

Each handle that fails to build (for example because the file cannot be read) is 0, and isComplete() then returns false. Handles that did build, such as the file-independent BRDF LUT, are still returned.

Defined inline in RayraiWindow.hpp so the static cubemap creators are visible.

Parameters

ParameterDescription
hdrPathPath to the equirectangular Radiance .hdr file.

Returns The baked environment; check isComplete() before use.

Parameters

ParameterDescription
optsFace sizes, sample counts and strength used for the bake.

Public attributes ​

environmentCubemap ​

cpp
unsigned int environmentCubemap

Display/radiance cubemap (sky).

irradianceCubemap ​

cpp
unsigned int irradianceCubemap

Diffuse irradiance cubemap.

prefilteredCubemap ​

cpp
unsigned int prefilteredCubemap

Roughness-prefiltered specular cubemap; mip 0 sharp.

splitSumBrdfLut ​

cpp
unsigned int splitSumBrdfLut

Split-sum BRDF lookup texture (2D).

prefilteredMipCount ​

cpp
int prefilteredMipCount

Mip count baked into prefilteredCubemap.

strength ​

cpp
float strength

Overall IBL contribution scale.

boxProjection ​

cpp
bool boxProjection

Optional box-projected parallax-corrected reflection bounds.

probePosition ​

cpp
glm::vec3 probePosition

World-space capture position of the cubemap, metres.

boxMin ​

cpp
glm::vec3 boxMin

World-space minimum corner of the projection box, metres.

boxMax ​

cpp
glm::vec3 boxMax

World-space maximum corner of the projection box, metres.

RaiSim — physics for robotics and AI.