This package has been deprecated

Author message:

this package has been deprecated

alpine-ibl-packer

0.1.3 • Public • Published

Alpine IBL Packer

npm version

CLI tool for generating and packing image-based lighting assets.

It is a Typescript wrapper around cmgen, an image-based lighting asset generator, included in Filament.

Alpine IBL Packer outputs a single KTX file with a full mipchain pre-filtered importance sampled environment maps. Alongside this it also creates pre-scaled spherical harmonics, allowing for a very cheap shader reconstruction, in the KTX metadata field. Next to this a different KTX file is outputted with a blurred single mip level that can serve as a skybox. Both can optionally be compressed using ASTC, ETC or S3TC compression algorithms.

LD MIPS

Pre-scaled spherical harmonics (diffuse reflectance)

Alpine IBL Packer generates the first 3 spherical harmonic bands (9 coefficients) and puts them both into the metadata field of the pre-filtered importance sampled KTX file and as a standalone binary that can be loaded directly in the browser. This prevents you from needing to load the KTX file on less powerful mobile devices just to get the spherical harmonics. Important is to note that the spherical harmonics have been pre-scaled and the Lambertian BRDF has been baked directly in the spherical harmonics in order to save an extra multiplication in the shader.

( 0.201415319196155,  0.211361667139695,  0.212770286817262); // L00, irradiance, pre-scaled base
( 0.157267193262213,  0.161593570448123,  0.205863399951959); // L1-1, irradiance, pre-scaled base
( 0.129921429413942,  0.123286187142025,  0.099767482891979); // L10, irradiance, pre-scaled base
( 0.083556102427099,  0.079017533953803,  0.066253600494520); // L11, irradiance, pre-scaled base
( 0.075926439517366,  0.073049876830327,  0.064071066869124); // L2-2, irradiance, pre-scaled base
( 0.123749487276400,  0.116953215694003,  0.100202787423040); // L2-1, irradiance, pre-scaled base
( 0.012070432095520,  0.011717038940279,  0.008553530475801); // L20, irradiance, pre-scaled base
( 0.082367643553315,  0.078416726442848,  0.065614274459236); // L21, irradiance, pre-scaled base
(-0.000555355474104, -0.000036785972621, -0.002545633932910); // L22, irradiance, pre-scaled base

More information can be found in the Realtime Image Based Lighting using Spherical Harmonics blog entry and the Filament documentation on distant light probes and spherical harmonics.

Single-scatter, multi-scatter and cloth-specific DFG LUT (specular reflectance)

Alpine IBL Packer generates a single-scatter, multi-scatter and cloth-specific DFG LUT (RGB16F, requires EXT_color_buffer_half_float in WebGL1 and is supported natively in WebGL2) to be used for split sum image based lighting approximation. For more information regarding the implementation please refer to Filament chapter 4.7.2 and Filament chapter 5.3.3. The DFG LUT is a constant regardless of the image passed in so it does not make sense to re-generate it every time.

DFG LUT SS

Installation

Make sure you have Node.js installed.

 $ npm install alpine-ibl-packer

Automatically download the latest cmgen binaries:

$ ./scripts/setup.sh

Please be aware that this updates from nightly meaning that this tool is less stable that the stable release because any upstream changes could break the behaviour of this tool.

Usage

$ node ./bin/alpine-ibl-packer

Development

$ yarn start
 
$ yarn lint
 
$ yarn build

Flags

Required

-i, --input [example: ./input/example.hdr] [required]
-o, --output [example: ./output] [required]

Optional

-s, --size [2 - 1024 (^2), default: 256] [not required]
-m, --mirror [true / false, default: false] [not required]
-c, --compression ['none', 'astc', 'etc', 's3tc', default: 'none'] [not required]
-b, --blur [0.0 - 1.0, default: 0.2] [not required]

-dfgss, --dfgss [true / false, default: false] [not required]
-dfgms, --dfgms [true / false, default: false] [not required]
-dfgc, --dfgc [true / false, default: false] [not required]

Licence

My work is released under the MIT license.

Readme

Keywords

none

Package Sidebar

Install

npm i alpine-ibl-packer

Weekly Downloads

2

Version

0.1.3

License

MIT

Unpacked Size

39.2 MB

Total Files

56

Last publish

Collaborators

  • timvanscherpenzeel