@galacean/engine-toolkit-shader-lab

v1.3.9
Refactor engine builtin `pbr` shader with `ShaderLab`.

ShaderLab-toolkit

Refactor engine builtin pbr shader with ShaderLab.

npm

Published on npm with full typing support. To install, use:

$ npm install @galacean/engine-toolkit-shader-lab
## or
$ npm install @galacean/engine-toolkit

This will allow you to import package entirely using:

import { GSLPBRMaterial } from "@galacean/engine-toolkit-shader-lab";

Usage

  • To use the exported functionality, you need to init engine with ShaderLab, as below:

    const engine = await WebGLEngine.create({
      ...
      shaderLab: new ShaderLab()
      ...
    });
    
  • Use GSLPBRMaterial (implemented in shaderlab) just like normal PBRMaterial.

    const pbrMaterial = new GSLPBRMaterial(engine);
    
  • When you instanced GSLPBRMaterial, several shader source fragment written in shaderlab will auto be registered, so you can use #include syntax in shaderlab. Or you can register pbr related shader source fragment manually with:

    GSLPBRMaterial.registerIncludes();
    
npm i @galacean/engine-toolkit-shader-lab

Metadata

  • MIT
  • Whatever
  • Unknown
  • released 9/24/2024

Downloads