Options
All
  • Public
  • Public/Protected
  • All
Menu

@derschmale/spherical-harmonizer

Index

Type aliases

Functions

Type aliases

RGB

RGB: { b: number; g: number; r: number }

Type declaration

  • b: number
  • g: number
  • r: number

SHOptions

SHOptions: { irradiance?: boolean }

The options that can be passed to the generateSH function.

Type declaration

  • Optional irradiance?: boolean

    Whether or not the spherical harmonics are generated as an irradiance map. Defaults to true.

Functions

encodeASH

  • encodeASH(sh: RGB[]): string
  • Encodes the sh harmonics as an .ASH file (as used by Knald Lys and Helix3D).

    Parameters

    Returns string

generateSH

  • generateSH(hdrImageData: Float32Array | Uint8ClampedArray, width: number, height: number, onComplete: (sh: RGB[]) => void, onProgress?: (r: number) => void, options?: SHOptions): void
  • Converts HDRI (equirectangular / panorama) image to its SH representation.

    Parameters

    • hdrImageData: Float32Array | Uint8ClampedArray

      The Float32Array (for hdr) or Uint8ClampedArray (for ldr) image data as a flat list. Float32Arrays should only contains packed RGB data, while Uint8ClampedArray are RGBA.

    • width: number

      The width of the image.

    • height: number

      The height of the image.

    • onComplete: (sh: RGB[]) => void

      A function that's called when processing is complete.

        • (sh: RGB[]): void
        • Parameters

          Returns void

    • Optional onProgress: (r: number) => void

      An optional function that's called when processing updates.

        • (r: number): void
        • Parameters

          • r: number

          Returns void

    • Optional options: SHOptions

      An optional SHOptions object.

    Returns void

Generated using TypeDoc