# \[Phaser 4\] Black opaque background on transparent Phaser.Text textures in Phaser 4.2.1 on older iOS WebGL

**URL:** <https://phaser.discourse.group/t/phaser-4-black-opaque-background-on-transparent-phaser-text-textures-in-phaser-4-2-1-on-older-ios-webgl/15671>\
**Category:** Phaser 3\
**Created:** [October 5, 2026, 3:05pm UTC](https://phaser.discourse.group/t/phaser-4-black-opaque-background-on-transparent-phaser-text-textures-in-phaser-4-2-1-on-older-ios-webgl/15671 "2026-10-05T15:05:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![machineboy](https://avatars.discourse-cdn.com/v4/letter/m/b19c9b/32.png) [@machineboy](https://phaser.discourse.group/u/machineboy)\
**Post date:** [October 5, 2026, 3:05pm UTC](https://phaser.discourse.group/t/phaser-4-black-opaque-background-on-transparent-phaser-text-textures-in-phaser-4-2-1-on-older-ios-webgl/15671/1 "2026-10-05T15:05:18Z")

</div>

In our game Tvers (www.nrk.no/spill/tvers) we got reports from people playing on older iPads that there were black backgrounds behind out letter tiles after we upgraded to Phaser 4.2.1. We spent a lot of time trying to debug the behaviour and traced it to a division by zero bug in `ApplyTint.glsl.`

**Problem**

On older iOS devices (\<= iPad OS 16.4), Phaser `Text` objects with black fill rendered on top of a transparent background show as black rectangles with faint aliased edges. On newer devices the transparency works as expected.

**Cause**

The WebGL tint shader (`ApplyTint.glsl`) performs an **unpremultiply** of the text texture:

`vec3 unpremultTexture = texture.rgb / texture.a`;

Outside the character glyph, the canvas-generated texture stores **pixels with RGB = 0 and alpha = 0**. Dividing zero by zero results in undefined behavior (`NaN` or `Infinity`). How the shader handles that NaN varies between GPUs/drivers. On the affected devices it propagates, producing a visible opaque black rectangle instead of transparent.

**Fix**

Guard the division by returning early for zero-alpha texels:  
`if (texture.a <= 0.0) {`  
`return vec4(0.0);`  
`}`  
`vec3 unpremultTexture = texture.rgb / texture.a;`

Just wanted to post this if anyone encounters the same. This was our code where this happened:

```javascript
const textStyling = {

  fontSize: '80px',

color: 'black',

fontFamily: '"NRK Sans Variable", sans-serif',

fontStyle: 'bold',

padding: { x: 10, y: 10 },

}

```

```javascript
const background = this.scene.add

      .image(0, 0, 'tile')

      .setTint(palette.boardSquare)

      .setTintMode(Phaser.TintModes.FILL)

const letter = this.scene.add.text(0, 0, this.letter, textStyling)

Phaser.Display.Align.In.Center(letter, background)

```

---

<div class="post-metadata">

**Author:** ![johnSSG](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/johnssg/32/8138_2.png) [@johnSSG](https://phaser.discourse.group/u/johnSSG)\
**Post date:** [October 5, 2026, 8:06pm UTC](https://phaser.discourse.group/t/phaser-4-black-opaque-background-on-transparent-phaser-text-textures-in-phaser-4-2-1-on-older-ios-webgl/15671/2 "2026-10-05T20:06:02Z")

</div>

Could be a good thing to report on the repo:

> **[Issues · phaserjs/phaser](https://github.com/phaserjs/phaser/issues)**
>
> 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. - Issues · phaserjs/phaser

---

<div class="post-metadata">

**Author:** ![machineboy](https://avatars.discourse-cdn.com/v4/letter/m/b19c9b/32.png) [@machineboy](https://phaser.discourse.group/u/machineboy)\
**Post date:** [October 6, 2026, 7:24am UTC](https://phaser.discourse.group/t/phaser-4-black-opaque-background-on-transparent-phaser-text-textures-in-phaser-4-2-1-on-older-ios-webgl/15671/3 "2026-10-06T07:24:10Z")

</div>

Thanks, done!
