Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alphaMode Not Set to MASK for PNGs With Transparency #257

Open
KermMartian opened this issue Sep 7, 2019 · 2 comments
Open

alphaMode Not Set to MASK for PNGs With Transparency #257

KermMartian opened this issue Sep 7, 2019 · 2 comments

Comments

@KermMartian
Copy link
Contributor

KermMartian commented Sep 7, 2019

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:

            <transparent>
              <texture texture="model_png-sampler" texcoord="UVMap"/>
            </transparent>

is not triggering this code in COLLADA2GLTF::Writer:

if (transparent.isTexture()) {
std::cerr << "WARNING: Effect " << effect->getOriginalId() <<
" contains a transparent texture that will be omitted from" <<
" the converted model." << std::endl;
}

@lasalvavida
Copy link
Contributor

Hi @KermMartian. I think I'd prefer to do alphaMode and alphaCutoff by command line flag. Would be happy to take a PR for that.

@lasalvavida
Copy link
Contributor

As for the latter part, could you open up a separate issue and attach the relevant model?

This is likely an OpenCOLLADA issue, but I'd like to be able to triage it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants