PG: https://playground.babylonjs.com/#YKD6LT#1
Before uncommented line 24-25, blackAndWhite postprocess renders before blur process, but after disable and enable the effect, blackAndWhite postprocess renders after blur postprocess.
I believe it is a bug in these lines as foreach
should not be used:
if (!cams) {
return;
}
for (let i = 0; i < cams.length; i++) {
const camera = cams[i];
const cameraName = camera.name;
for (let j = 0; j < this._indicesForCamera[cameraName].length; j++) {
if (camera._postProcesses[this._indicesForCamera[cameraName][j]] === undefined || camera._postProcesses[this._indicesForCamera[cameraName][j]] === null) {
this._postProcesses[this._singleInstance ? 0 : cameraName].forEach((postProcess) => {
cams![i].attachPostProcess(postProcess, this._indicesForCamera[cameraName][j]);
});
}
}
}
}
/**
* Disables the effect on the given cameras
* @param cameras The camera to disable.
I think it should be changed to
for (let j = 0; j < this._indicesForCamera[cameraName].length; j++) {
if (camera._postProcesses[this._indicesForCamera[cameraName][j]] === undefined || camera._postProcesses[this._indicesForCamera[cameraName][j]] === null) {
cams![i].attachPostProcess(this._postProcesses[j], this._indicesForCamera[cameraName][j]);
}
}
If not, how can I disable an effect?
Thanks for reporting, here’s the fix:
BabylonJS:master
← Popov72:fix-pprendereffect-enable
opened 11:35AM - 03 Aug 23 UTC
See https://forum.babylonjs.com/t/postprocess-indices-reversed-after-disable-and… -enable-rendereffect/42953
3 Likes