phaserjs / phaser

Phaser is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.

Home Page:https://phaser.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Meshes are missing parts when multiple batches are needed to render scene

pavels opened this issue · comments

When multiple batches are used to render scene (lot of triangles), meshes are missing parts

Here is reproduction code:

class Example extends Phaser.Scene
{
    constructor ()
    {
        super();
    }

    preload ()
    {
        this.load.image('ayu', 'assets/pics/ayu.png');
    }

    create ()
    {
        var cnt = 10;

        for(var i = 0; i < cnt; i++) {
            for(var j = 0; j < cnt; j++) {        
                const mesh = this.add.mesh(50 + i * 100, 50 + j  * 100, 'ayu');
                Phaser.Geom.Mesh.GenerateGridVerts({
                    mesh,
                    widthSegments: 10
                });
                mesh.hideCCW = false;
                mesh.panZ(20);
            }
        }
    }

    update ()
    {
    }
}

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

let game = new Phaser.Game(config);

The problem is artificially exaggerated by setting small batchSize but happens even on default settings - you will just need more triangles on scene for this to happen.

This happens on 3.80.1 and down to at lest 3.55.2