Validation workaround `opaque-clear-alpha`: framebuffer alpha differs from WebGL with opaque clear

Open
#2,007 0 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@bkaradzic-microsoft is already working on this.

Since Nov 3, 2026.

Assessment

This issue has not been assessed yet.

Description

Affected tests (15)

  • Ribbon morphing
  • Solid particle system
  • RH billboard
  • Particle Helper
  • Area Lights - Standard Material
  • Textured - Area Lights - Standard Material
  • Textured - Area Lights - PBR
  • Area Lights - PBR
  • Enable disable post process
  • Prepass SSAO + depth of field
  • Prepass SSAO + on/off post-process
  • Particles - Multiply Blend
  • Particles - Helper - Sun
  • Particles - Helper - Smoke
  • Particles - Helper - Fire

What the workaround does

When the scene clears with an opaque color but the read-back image contains alpha < 1, the harness skips compositing over the canvas background (browser composites the canvas with the page). Without it, BN screenshots differ where blended geometry writes alpha < 1. Introduced in #1913.

Recommended fix

Likely the alpha channel of blended draws differs from WebGL (separate alpha blend factors / alphaMode mapping). Compare per-pixel alpha of the BN readback with WebGL readPixels for one affected test; fix the alpha blend state mapping in NativeEngine (setAlphaMode → bgfx BGFX_STATE_BLEND_FUNC_SEPARATE) so alpha matches WebGL. Then the harness can composite identically to the browser and the workaround can be removed.


Workaround implementations live in Apps/Playground/Scripts/validation_native.js (WORKAROUNDS map); tests opt in via the workarounds array in Apps/Playground/Scripts/config.json. See Documentation/AddingNewValidationTests.md.

Dominant language
C++
Stars
931
Forks
169
Avg merge
2d 17h
Merged PRs (30d)
66

Getting set up

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.

More from BabylonJS/BabylonNative

All issues in BabylonJS/BabylonNative

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.