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

RenderTexture ignores BlendMode #6546

Open
Vegita2 opened this issue Jul 15, 2023 · 0 comments
Open

RenderTexture ignores BlendMode #6546

Vegita2 opened this issue Jul 15, 2023 · 0 comments
Assignees
Milestone

Comments

@Vegita2
Copy link

Vegita2 commented Jul 15, 2023

Version

  • Phaser Version: 3.60.0
  • Operating system: Ubuntu 23.04

Description

When drawing a container with multiple images into a RenderTexture, the blendMode is not set correctly. The images all have different blendModes

Example Test Code

Code is based on this sandbox: https://labs.phaser.io/edit.html?src=src\tilemap\create%20from%20array.js

class Example extends Phaser.Scene
{
    preload ()
    {
        this.load.image('mario-tiles', 'assets/tilemaps/tiles/super-mario.png');
    }

    create ()
    {

        this.add.text(0, 66, 'Default');
        this.add.text(80, 66, 'Render\nTexture');

        // Load a map from a 2D array of tile indices
        const level = [
            [ 0, 0, 0, 0 ],
            [ 0, 0, 0, 39 ],
            [ 39, 39, 39, 39 ],
            [ 39, 39, 39, 39 ],
        ];

        // When loading from an array, make sure to specify the tileWidth and tileHeight
        const map = this.make.tilemap({ data: level, tileWidth: 16, tileHeight: 16 });
        const tiles = map.addTilesetImage('mario-tiles');
        const layer = map.createLayer(0, tiles, 0, 0);

        const container = this.add.container(7, 20);
		
		const img = this.add.image(0, -16, 'mario-tiles');
		img.setCrop(0, 16, 16, 16);
		img.setOrigin(0, 0);
		img.blendMode = Phaser.BlendModes.ADD;

        const img2 = this.add.image(-12, -14, 'mario-tiles');
		img2.setCrop(32, 16, 16, 16);
		img2.setOrigin(0, 0);

        container.add(img);
        container.add(img2);

        const texture = this.add.renderTexture(80, 0, 64, 64);
		texture.setOrigin(0, 0);
		texture.draw(layer);
		texture.draw(container);
    }
}

const config = {
    type: Phaser.AUTO,
    width: 11 * 16, // Number of tiles * size of the tile
    height: 10 * 16,
    zoom: 4,
    parent: 'phaser-example',
    pixelArt: true,
    scene: Example
};

const game = new Phaser.Game(config);

Additional Information

They should look the same
image

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

4 participants