Baker
Off-Screen Rendering, to generate Spherical harmonics and IBL mipmaps
npm
The Baker
is published on npm with full typing support. To install, use:
$ npm install @oasis-engine-tools/baker
This will allow you to import package entirely using:
import * as BAKER from "@oasis-engine-tools/baker";
or individual classes using:
import { IBLBaker } from "@oasis-engine-tools/baker";
Usage
const texture = await engine.resourceManager.load<TextureCube>({
url: "https://gw.alipayobjects.com/os/bmw-prod/10c5d68d-8580-4bd9-8795-6f1035782b94.bin", // sunset_1K
type: "HDR-RGBE"
})
const bakedTexture = IBLBaker.fromTextureCubeMap(texture, DecodeMode.RGBE);
ambientLight.specularTexture = bakedHDRCubeMap;
ambientLight.specularTextureDecodeRGBM = true;
const sh = new SphericalHarmonics3();
SphericalHarmonics3Baker.fromTextureCubeMap(hdrCubeMap, DecodeMode.RGBE, sh);
ambientLight.diffuseMode = DiffuseMode.SphericalHarmonics;
ambientLight.diffuseSphericalHarmonics = sh;
Links
License
The engine is released under the MIT license. See LICENSE file.