API

Function AllocateShBuffers

  • Allocates SH texture buffers pre-filled with 128 (the neutral encoding of ~0.0 in the shader's decompose() function). Padding bytes beyond the actual coefficients in the last texture are read as higher-order SH bands when the mesh is added to a compound with a higher degree; zero would decode to -1.0 instead, producing wrong colors.

    Parameters

    • textureCount: number

      number of SH textures to allocate

    • bytesEach: number

      byte size of each texture buffer

    Returns Uint8Array<ArrayBufferLike>[]

    array of initialized Uint8Array buffers