Black opaque background on transparent Phaser.Text textures in Phaser 4.2.1 on older iOS WebGL
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 1/5
- 見積もり時間
- 1時間未満
- 初心者へのやさしさ
- 85/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript
- 領域
- game-dev
調査の方向性
Phaserのソースツリー内でWebGLシェーダーファイル ApplyTint.glsl を見つけてください。古いiOS WebGLデバイスで不透明な黒い背景が表示される問題を解決するため、非乗算除算の前に、アルファ値がゼロのテクセルに対する指定の早期リターンガードを追加してください。付属のテキスト描画サンプルコードを使って修正を検証し、透明なテキストが正しく描画されることを確認してください。
索引モデルが issue の本文から書いたものです。
説明
Version
- Phaser Version: 4.2.1
- Operating system: iPad OS 16.4
Description
Problem
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 issue in ApplyTint.glsl.
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. In Phaser 3.8 this was not a problem.
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;
Example Test Code
const textStyling = {
fontSize: '80px',
color: 'black',
fontFamily: 'sans-serif',
fontStyle: 'bold',
padding: { x: 10, y: 10 },
}
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)
- 主要言語
- JavaScript
- スター
- 40.4k
- フォーク
- 7.2k
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
phaserjs/phaser のほかの issue
-
Type definition for TilemapLayer.getTileAt is wrong対応中かも @hkbughk が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 2 日以内に返信
-
Shader.preDestroy leaks its ShaderQuad's vertex buffer and VAO on every create/destroy cycle (4.2.1)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 2 日以内に返信
-
WebGL stroke of a Polygon drops a vertex when its origin-shifted position equals the previous raw vertex対応中かも @ICOM725 が 38 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
phaserjs/phaser#7361 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
MouseManager.stopListeners never removes the wheel listener — destroyed Game stays retained through the canvas対応中かも @schulerj89 が 78 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信
phaserjs/phaser の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
schmayterling/hibi#245 ·
メンテナーはふだん 1 日以内に返信
-
factory-active task-identify-harness-labels-done task-identify-issue-type-done
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
bug package:vitest
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
cloudflare/workers-sdk#16255 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Proxy and MCP URLs with an empty authority parse as a different host対応中かも @ericcaiwx-star が今日担当しました。 オープンclawsweeper:bulk-filed clawsweeper:linked-pr-open clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster P2
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
openclaw/openclaw-enterprise#2384 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Access-request approve silently discards the decider's note (decision_note written only on deny)オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
Uuriko/project-room#3378 ·
メンテナーはふだん 1 日以内に返信