Post Process Effect, code only engine api


#1

My project imports the playcanvas engine. I am attempting to add a post-process effect, any will do to start.

engine-master\engine-master\extras\posteffects

I am attempting to add one in this manner:

    this.camera.addComponent('script');
    this.camera.script.create('horizontalTiltShift');

The script is being initialized, but none of them look correct. The Vignette is almost completely black, the Sapia completely white, and the horizontaltiltshift is a bunch of banded color lines across the screen.

Thank you for ideas, suggestions.


#2

Adding it like this instead worked:

var vignette = new pc.VignetteEffect(this.application.graphicsDevice);
vignette.darkness = 2;
this.camera.camera.postEffects.addEffect(vignette);