API

Variable EnvironmentTextureToolsConst

EnvironmentTextureTools: {
    CreateEnvTextureAsync: (
        texture: BaseTexture,
        options?: CreateEnvTextureOptions,
    ) => Promise<ArrayBuffer>;
    CreateIrradianceImageDataArrayBufferViews: (
        data: ArrayBufferView,
        info: EnvironmentTextureInfo,
    ) => ArrayBufferView<ArrayBufferLike>[];
    CreateRadianceImageDataArrayBufferViews: (
        data: ArrayBufferView,
        info: EnvironmentTextureInfo,
    ) => ArrayBufferView<ArrayBufferLike>[][];
    GetEnvInfo: (data: ArrayBufferView) => Nullable<EnvironmentTextureInfoV2>;
    UploadEnvLevelsAsync: (
        texture: InternalTexture,
        data: ArrayBufferView,
        info: EnvironmentTextureInfo,
    ) => Promise<void[]>;
    UploadEnvSpherical: (
        texture: InternalTexture,
        info: EnvironmentTextureInfo,
    ) => void;
    UploadIrradianceLevelsAsync: (
        mainTexture: InternalTexture,
        imageData: ArrayBufferView<ArrayBufferLike>[],
        size: number,
        imageType?: string,
        dominantDirection?: Nullable<Vector3>,
    ) => Promise<void>;
    UploadRadianceLevelsAsync: (
        texture: InternalTexture,
        imageData: ArrayBufferView<ArrayBufferLike>[][],
        imageType?: string,
    ) => Promise<void>;
} = ...

Sets of helpers addressing the serialization and deserialization of environment texture stored in a BabylonJS env file. Those files are usually stored as .env files.

Type Declaration

  • CreateEnvTextureAsync: (
        texture: BaseTexture,
        options?: CreateEnvTextureOptions,
    ) => Promise<ArrayBuffer>

    Creates an environment texture from a loaded cube texture.

    defines the cube texture to convert in env file

    options for the conversion process

    the mime type for the encoded images, with support for "image/png" (default) and "image/webp"

    the image quality of encoded WebP images.

    a promise containing the environment data if successful.

  • CreateIrradianceImageDataArrayBufferViews: (
        data: ArrayBufferView,
        info: EnvironmentTextureInfo,
    ) => ArrayBufferView<ArrayBufferLike>[]

    Creates the ArrayBufferViews used for initializing environment texture image data.

    the image data

    parameters that determine what views will be created for accessing the underlying buffer

    the views described by info providing access to the underlying buffer

  • CreateRadianceImageDataArrayBufferViews: (
        data: ArrayBufferView,
        info: EnvironmentTextureInfo,
    ) => ArrayBufferView<ArrayBufferLike>[][]

    Creates the ArrayBufferViews used for initializing environment texture image data.

    the image data

    parameters that determine what views will be created for accessing the underlying buffer

    the views described by info providing access to the underlying buffer

  • GetEnvInfo: (data: ArrayBufferView) => Nullable<EnvironmentTextureInfoV2>

    Gets the environment info from an env file.

    The array buffer containing the .env bytes.

    the environment file info (the json header) if successfully parsed, normalized to the latest supported version.

  • UploadEnvLevelsAsync: (
        texture: InternalTexture,
        data: ArrayBufferView,
        info: EnvironmentTextureInfo,
    ) => Promise<void[]>

    Uploads the texture info contained in the env file to the GPU.

    defines the internal texture to upload to

    defines the data to load

    defines the texture info retrieved through the GetEnvInfo method

    a promise

  • UploadEnvSpherical: (texture: InternalTexture, info: EnvironmentTextureInfo) => void

    Uploads spherical polynomials information to the texture.

    defines the texture we are trying to upload the information to

    defines the environment texture info retrieved through the GetEnvInfo method

  • UploadIrradianceLevelsAsync: (
        mainTexture: InternalTexture,
        imageData: ArrayBufferView<ArrayBufferLike>[],
        size: number,
        imageType?: string,
        dominantDirection?: Nullable<Vector3>,
    ) => Promise<void>

    Uploads the levels of image data to the GPU.

    defines the internal texture to upload to

    defines the array buffer views of image data [mipmap][face]

    the mime type of the image data

    the dominant direction of light in the environment texture, if available

    a promise

  • UploadRadianceLevelsAsync: (
        texture: InternalTexture,
        imageData: ArrayBufferView<ArrayBufferLike>[][],
        imageType?: string,
    ) => Promise<void>

    Uploads the levels of image data to the GPU.

    defines the internal texture to upload to

    defines the array buffer views of image data [mipmap][face]

    the mime type of the image data

    a promise