KhronosGroup / KhronosGroup/COLLADA2GLTF
alphaMode Not Set to MASK for PNGs With Transparency
- Dominant language
- C++
- Stars
- 573
- Forks
- 154
- PR merge metrics
- No merged PRs in 30d
Description
What it says on the tin. If an input COLLADA file has a PNG image with transparency as a texture, the `alphaMode` property of the resulting GLTF texture is not set. Inspecting the source code, I see that the `GLTFMaterial` class supports `alphaMode` and `alphaCutoff` fields, but that nothing in the `COLLADA2GLTF::Writer` sets the `alphaMode` to `MASK`. I understand it would be annoying to scan each input image to determine if it contains any transparency, but I propose that it might be reasonable to assume a PNG is being used for its transparency, and set `alphaMode` to `MASK` any time a PNG is encountered.
If you agree, I'm happy to make a PR for this.
Edit: In addition, it appears this stanza in the input COLLADA model:
```
```
is not triggering this code in `COLLADA2GLTF::Writer`:
https://github.com/KhronosGroup/COLLADA2GLTF/blob/6e11fe684881c915f12889c3da2b9f6bc1647b48/src/COLLADA2GLTFWriter.cpp#L1115-L1119
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in src/COLLADA2GLTFWriter.cpp around lines 1115-1119 and inspect how the COLLADA transparent texture stanza is handled by COLLADA2GLTF::Writer and GLTFMaterial. Reproduce the case with a COLLADA model using a transparent PNG; done means the resulting glTF texture has alphaMode set to MASK.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100