phaserjs / phaserjs/phaser

Scaled Images derived from a DynamicTexture disappear when mipmapped

Open
#7,137 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
40.3k
Forks
7.2k
PR merge metrics
No merged PRs in 30d

Description

Version

  • Phaser Version: 3.88.2
  • Operating system: MacOS 15.4.1
  • Browser: Chrome 135.0.7049.115

Description

When the render setting mipmapFilter is set to a mipmap setting, scaled images/sprites derived from a dynamic texture frame become increasingly transparent as they are scaled down until completely transparent by a scale of ~0.75 to ~0.5. Some mipmap settings make it fade slowly, while others cut out suddenly.

Solution for now is to avoid mipmapFilters.

Example Test Code

class Example extends Phaser.Scene
{
    preload ()
    {
        this.load.setBaseURL('https://cdn.phaserfiles.com/v385');
        this.load.image('uv', 'assets/pics/uv-grid-4096-ian-maclachlan.png');
        this.dt = this.textures.addDynamicTexture('main', 4096, 4096);
    }

    create ()
    {
        this.dt.draw('uv', 0, 0);
        this.dt.add('AABB', 0, 0, 0, 512, 512);
        
        // shows up fine
        this.add.image(0, 300, 'main', 'AABB').setOrigin(0,0).setDisplaySize(512, 512);
        
        // transparent??
        this.add.image(0, 0, 'main', 'AABB').setOrigin(0,0).setDisplaySize(300, 300);

        // completely gone
        this.add.image(300, 0, 'main', 'AABB').setOrigin(0,0).setDisplaySize(200, 200);
        this.add.image(500, 0, 'main', 'AABB').setOrigin(0,0).setDisplaySize(100, 100);
    }
}

const config = {
    type: Phaser.AUTO,
    parent: 'phaser-example',
    mipmapFilter: 'LINEAR_MIPMAP_LINEAR',
    scene: Example
};

const game = new Phaser.Game(config);

Additional Information

Image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied Example scene and reproduce the issue using a DynamicTexture frame, scaled images, and the mipmapFilter setting. Trace the DynamicTexture and mipmap-related rendering entry points from there; done means scaled images derived from the frame remain visible rather than fading or disappearing.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.