Is it possible to make these 2 scripts work together?

I have this project, the camera entity (its parent is the entity “Player”) has a deactivated post effect script attached to it.
If you look at the Root entity, it also has a script attached to it. This script renders the game to an image element on the screen with a different resolution.
Now, if I activate both scripts, what I get is a black screen.
Is it possible to make these 2 scripts work together?
And, is there any better way to change the resolution of the canvas BUT keep the aspect ratio.
I know that the values of the width and height of the canvas, in CSS represent the actual size occupied on the screen and the HTML values represent the “internal” number of pixels in the canvas, but not necessarily its actual size on the screen.

Hi @Sewbak,

I think the issue is the post process effect, when activated, a new layer (PostProcessQueue) is being added to your scene layer’s list. You need to take that into account in your render-layer-to-texture.js script, where you set the render targets:

    var layerNames = this.layerNames.split(',');
    var layers =;
    for (var i = 0; i < layerNames.length; ++i) {
        layers.getLayerByName(layerNames[i]).renderTarget = renderTarget;

Though I’d say if you are only after a pixelated effect and you are using a post process effect already, you can easily pixelate in the shader using something like this:

// GLSL code
vec2 pixelateDxy = filmicPixelateSize / resolution;
vec2 pixelateCoord = pixelateDxy * floor( vUv0 / pixelateDxy );
gl_FragColor = texture2D(colorbuffer, pixelateCoord);

Hey, @Leonidas, thanks for the reply
The thing is, I didn’t write these scripts myself…
I don’t really have any experience with post effects and stuff like that and I forgot to mention in the first question
I have no idea how to implement the GLSL code you wrote.
I included PostProcessQueue in the layer string but the code tells me that it’s not a layer
I think I’ll go with the pixelation effect without the VCR effect