The camera parameter specifies which camera to attach to. If you’re creating a post process that will be managed by a render pipeline, this should be set to null. See Post Process Pipeline
Though when we follow the link, the first example we see is this one:
var blackAndWhite = new BABYLON.BlackAndWhitePostProcess("bw", 1.0, null, null, engine, false);
var horizontalBlur = new BABYLON.BlurPostProcess("hb", new BABYLON.Vector2(1.0, 0), 20, 1.0, null, null, engine, false);
This constructor for the BlackAndWhitePostProcess doesn’t work as camera is a required parameter.
I’d love to if I knew how this is supposed to be done correctly.
Should the BlackAndWhitePostProcess class allow null as camera?
I think it should as I checked the internals and it just passes the camera to the base class.
Oh. In fact it is.
I didn’t open this PG so when I tried it all with TypeScript in my project, null was not allowed.
I can update the types a little bit. I’ll check other PostEffects for the same problem.
Oh, that might be a typing issue then. if null is not allowed but under the hood acceptable we might need to have a nullable camera instead of camera in the code itself.
I made camera optional in all classes derived from PostProcess except for anaglyph and multiview. I believe it is fair to leave the camera obligatory for them as otherwise it might get very ambigous.
In some places I slightly adjusted the code but judging by internals of PostProcess.ts the behavior should stay exactly the same. Everywhere where I did that the code was not updated 4 years since the introduction of postprocess library so I believe that is safe.