question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

glTF 2.0 'OPAQUE' mode broken

See original GitHub issue

When alphaBlend mode is set to OPAQUE, glTF 2.0 specifies that source alpha values will be ignored, not pre-multiplied. There is a test model to check this: AlphaBlendModeTest.

This was broken recently. I ran git bisect on this, and I’m sorry @OmarShehata, it narrowed this down to one of your image handling commits here: b772d527599c78796 (part of #7579).

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
emackeycommented, Apr 30, 2019

I think “always false” might be correct for glTF 2.0, particularly if the BLEND side of the test model continues to work.

1reaction
OmarShehatacommented, Apr 30, 2019

Thanks for tracking this down @emackey ! Looks like this is indeed an ImageBitmap issue. One of the major issues with implementing it was that an ImageBitmap cannot be flipped during texture upload. It looks like premultiplied alpha is another setting that would need to be done passed on image decode to get ImageBitmap to work correctly.

Here’s my local Sandcastle. This expects the AlphaBlendModeTest folder from the glTF sample models repo to be copied to Apps/SampleData/models/.

Changing Resource.js:1894 to:

Resource.createImageBitmapFromBlob = function(blob, flipY) {
        return createImageBitmap(blob, {
            imageOrientation: flipY ? 'flipY' : 'none',
            premultiplyAlpha: 'none'
        });
    };

Fixes the issue. This potentially impacts imagery as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

A-Frame gltf 2.0 can't set opacity - Stack Overflow
I import a animated gltf 2.0 model in a A-Frame scene. I want to set its opacity to 0.5. But it doen't work,...
Read more >
Transparent PNG image in GLTF appears black?
The transparent part of the PNG image, however, becomes black and I don't know why ... It might be a glTF 2.0 model...
Read more >
glTF 2.0 — Blender Manual
Three settings are supported by glTF: Opaque. Alpha values are ignored (the default). Alpha Blend.
Read more >
glTF™ 2.0 Specification - Khronos Registry
glb extension and model/gltf-binary Media Type. Files representing binary buffers SHOULD use either: .bin file extension with application/octet- ...
Read more >
Writing volumetric refraction in glTF 2.0 - Don McCurdy
This may change as renderers improve over time, but for now it's important to keep it in mind and ensure that transmissive objects...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found