Phaser: [SOLUTION FOUND] Cannot use camera zoom or rotate with shaders

Created on 24 Dec 2019  路  5Comments  路  Source: photonstorm/phaser

I had an issue recently where I could not rotate or zoom the cameras without the bounds of the camera changing relative to the values when using setRenderToTexture(). The solution is by changing the file:
src/renderer/webgl/WebGLRenderer.js

In this section:
pipeline.batchTexture(
camera,
camera.glTexture,
camera.width, camera.height,
camera.x, camera.y,
camera.width, camera.height,
1, 1, //previously zoom, zoom
0, //previously rotation
camera.flipX, !camera.flipY,
1, 1,
0, 0,
0, 0, camera.width, camera.height,
getTint(camera._tintTL, camera._alphaTL),
getTint(camera._tintTR, camera._alphaTR),
getTint(camera._tintBL, camera._alphaBL),
getTint(camera._tintBR, camera._alphaBR),
(camera._isTinted && camera.tintFill),
0, 0,
this.defaultCamera,
null
);

Most helpful comment

Can this be released please?

My team needs this fix, and is currently blocked

All 5 comments

I had a similar issue with setRenderToTexture and camera zoom. I think (but maybe I'm really wrong because I have little experience with Phaser) that it is applying the camera view matrix twice. One for "objects -> render texture" and another for "render texture -> screen".

The solution you mention worked for me, thanks. But it would be nice maybe to correct this on the master so we don't have to apply the fix manually?

Thank you for submitting this issue. We have fixed this and the fix has been pushed to the master branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.

Can this be released please?

My team needs this fix, and is currently blocked

Patch the fix above into your own build then.

What is holding up the release may I ask?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Secretmapper picture Secretmapper  路  3Comments

BigZaphod picture BigZaphod  路  4Comments

JarLowrey picture JarLowrey  路  4Comments

JoeBerkley picture JoeBerkley  路  3Comments

frob picture frob  路  4Comments