Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolution of BitmapMask gets somehow corrupted on game resize #6769

Open
pavels opened this issue Mar 15, 2024 · 4 comments
Open

Resolution of BitmapMask gets somehow corrupted on game resize #6769

pavels opened this issue Mar 15, 2024 · 4 comments
Assignees

Comments

@pavels
Copy link

pavels commented Mar 15, 2024

Phaser 3.80.1

When you create small game, resize it to large and then create mask and set it on object, the object resolution gets lowered and the object becomes pixelated.

Here is reproduction code:

class Example extends Phaser.Scene
{
    preload ()
    {
        this.load.image('ayu', 'assets/pics/ayu.png');
    }

    create ()
    {
        this.game.scale.resize(800, 600);

        const sprite = this.add.sprite(400, 300, 'ayu');

        const rt = this.make.renderTexture({x: 0, y: 0, width: 800, height: 600, add: false}).setOrigin(0.0);
        const mask = new Phaser.Display.Masks.BitmapMask(this, rt);

        rt.fill(0x000000, 1);

        this.input.on('pointerdown', pointer => {
            sprite.setMask(mask);
        })        
    }
}

const config = {
    type: Phaser.AUTO,
    width: 200,
    height: 150,
    backgroundColor: '#0a440a',
    parent: 'phaser-example',
    scene: Example
};

const game = new Phaser.Game(config);

Run the code, click on the scene and see the effect.

@pavels
Copy link
Author

pavels commented Mar 18, 2024

Just a note

3.55.2 is OK
3.60.0 is completely broken (the sprite disappears)
3.70.0 exhibits described bug

@orcomarcio
Copy link

orcomarcio commented Apr 2, 2024

I have a very similar bug.

If I apply a bitmapMask and/or postFx to a container and then resize the game (and it returns to normal if i put the resolution back to what it was when I added these effects).

3.6: container disappears or gets stretched vertically (the new resolution just has a bigger height, i guess the shader references screen % for coords). It also stops "updating", meaning even the stretched image is frozen in time.
3.7 / 3.8: works with normal sprites. SpineObjects instead disappear for some reason.

EDIT: in 3.7 / 3.8 SpineObjects don't disappear, the whole container disappears if there's at least one spine object visible

@woshisheji
Copy link

Very bad experience, I just added a mask. There was no problem at all in 3.55.2, but in 3.8.01, it was very bad. The content inside the mask is all blurred. When the mask is blocked, it is very normal. I hope to receive timely updates and handling.

list.mask = new Phaser.Display.Masks.BitmapMask(H5object, rect);

@woshisheji
Copy link

123
132

list.mask = new Phaser.Display.Masks.BitmapMask(H5object, rect);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants