With EffectComposer, when resizing, the new dimenssions are only used every odd rendering

postprocessing
effectcomposer

#1

Hello,

Ive been having an issue, something that must be very simple to solve and yet is very weird.
Here is a jsfiffle that illustrate the issue:

https://jsfiddle.net/Horsetopus/42ngkryu/

So, what I do is that I set up a box, a camera, etc, the basic example.
But as for the rendering, I use EffectComposer and instantiate a WebGLRenderTarget.
I understand that in my example it is absolutely useless, I could call directly the renderer.render, but in my actual project I use some shader passes.

So I render every 300ms so that you can see clearly that it once renders fine, once render in very low resolution.

As it turns out, if you set the size of the canvas, then you get this weird issue where the size you have set is only used once every two rendering.
The other times, the size used it the one set on the parameters arguments of the WebGLRenderTarget (try to change the variables and refresh and you’ll see).

That’s a weird bug… maybe two objects are stored somewhere and used in alternance, and only one is updated?

Anyway please have a look and tell me how to solve it?
And no, calling twice the render function is not acceptable :wink:

Thanks.


#2

You need to resize the effect composer instead of the original render target. When you create an instance of EffectComposer, the given render target is internally cloned for render purposes. If you only resize the render target in your application, the clone won’t get affected by this change.

I fixed your code here: https://jsfiddle.net/42ngkryu/1/


#3

ok, thanks a lot.