KhronosGroup / glTF-Blender-IO

Blender glTF 2.0 importer and exporter
https://docs.blender.org/manual/en/latest/addons/import_export/scene_gltf2.html
Apache License 2.0
1.45k stars 306 forks source link

Export: Alpha values are ignored when sourcefile has no transparency #2245

Closed emkajeej closed 1 month ago

emkajeej commented 1 month ago

Describe the bug When connecting the color socket of an image that does not have an alpha channel to the alpha socket of the Principled BSDF, Blender correctly interprets black pixels als 0 alpha. When exported to a GLB, the tranparent pixels turn black.

This does not happen in Blender 4.0.

To Reproduce Steps to reproduce the behavior:

  1. Add a plane
  2. Add a new material
  3. Import a black and white image and connect the Color to the Alpha
  4. Export as GLB/GLTF
  5. Open in any GLB viewer, like https://gltf.report/

Expected behavior The black and white values of the image are interpreted as alpha values, allowing for more granular control of the material's transparency.

Screenshots

material-setup export-4 1 1

Here is the same file exported from 4.0:

export-4 0

.blend file/ .gltf (mandatory) alphamap.blend.zip

Version

Additional context Issue does not occur in v < 4.1.

emkajeej commented 1 month ago

I see that this is a duplicate of sorts of https://github.com/KhronosGroup/glTF-Blender-IO/issues/2176. Hopefully this (arguably workflow breaking) change will be reversed, as hundreds of blend files would now need manual updating before reexports are possible.

julienduroure commented 1 month ago

Hello, Yes, this is a duplicate of #2176

In 4.0, the alpha channel was created only from Red channel of the texture. In 4.1, no alpha is generated. Agree that the behavior changed. Was not right, and still is not right, not in the same way.

This will be solved by #2176

julienduroure commented 1 month ago

2242 is now merged, closing