Raanan Weber b9bd620a92 update all references to attachControl il y a 4 ans
..
src 430b8a321e Updating vecotr/color references il y a 5 ans
index.html b9bd620a92 update all references to attachControl il y a 4 ans
readme.md 19c6909aa2 Clean config il y a 6 ans
tsconfig.json f8723bd009 PPLIb relative path il y a 6 ans
webpack.config.js 894fc8884c Facto Webpack Config il y a 6 ans

readme.md

## Using a post process from the library

You can find multiple post processes that just works with Babylon.js in dist folder. To use then, you only need to reference the associated .js file and use the new provided post process:

var fire = new BABYLON.FireProceduralTexture2("firePT", 256, scene);
sphere.material.diffuseTexture = fire;

Adding a new post process to the library

To add a new post process, you have to create your own folder in postProcesses/src folder. Then you need to add a .ts file and one .fragment.fx files:

  • The .ts is the TypeScript code of your post process
  • .fx file: GLSL code for fragment shaders

Integrating the post process in the build process

To build all post processes and generate the dist folder, just run from the tools/gulp folder:

gulp postProcesLibrary

To integrate your new post process to the build process, you have to edit the config.json file in the tools/config folder and add an entry in the "postProcessLibray/libraries" section of the file:

  "libraries": [   
    ... 
      {
        "files": ["../../postProcessLibrary/src/asciiArt/babylon.asciiArtPostProcess.ts"],
        "shaderFiles": [
          "../../postProcessLibrary/src/asciiArt/asciiart.fragment.fx"
        ],
        "output": "babylon.asciiArtPostProcess.js"
      }
    '''
  ]

Testing your post process

To test your post process, you can use the /postProcessLibrary/index.html page. References are added automatically. You only need to update the code to create an instance of your material and reference it in the UI system:

switch (options.postProcess) {
    case "asciiArt":
      camera.detachPostProcess(aaPostProcess);
      camera.detachPostProcess(drPostProcess);
      camera.attachPostProcess(aaPostProcess);
      break;
    case "digitalRain":
      camera.detachPostProcess(aaPostProcess);
      camera.detachPostProcess(drPostProcess);
      camera.attachPostProcess(drPostProcess);
      break;
  }

This page allows you to test your code on a simple sphere.

To serve this page, you can start from the tools/gulp folder the task:

gulp webserver