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

Material opacity lost on export to USDZ #169

Open
TyLindberg opened this issue Jul 23, 2019 · 7 comments
Open

Material opacity lost on export to USDZ #169

TyLindberg opened this issue Jul 23, 2019 · 7 comments

Comments

@TyLindberg
Copy link

When the material in a gltf file has a base color with an alpha value less than 1, the material will still appear fully opaque in USDZ. This seems to have started happening at commit c0301fc.

Attached is an example model that exhibits this behavior.

TransparentDuck.zip

@paprikka
Copy link

paprikka commented Aug 2, 2019

+1 Please let me know if there's anything I can do to help.

@SokWonJeremyKim
Copy link

SokWonJeremyKim commented Sep 10, 2019

+1 Please help. GLTF viewers show transparency correctly, which is lost on exporting to USDZ

This is the part that gives alpha

{
    "alphaMode" : "BLEND",
    "name" : "Model_AP.001",
    "normalTexture" : {
        "index" : 2,
        "texCoord" : 0
    },
    "pbrMetallicRoughness" : {
        "baseColorFactor" : [
            1,
            1,
            1,
            0.5799999833106995
        ],
        "baseColorTexture" : {
            "index" : 3,
            "texCoord" : 0
        },
        "metallicFactor" : 0.8826087117195129,
        "roughnessFactor" : 0.08260869234800339
    }
}

@rafaelmaroxa
Copy link

rafaelmaroxa commented Nov 19, 2019

@TyLindberg The line of code that set the default opacity value was removed on commit c0301fc like you suspected. Adding it back fixed it for me, but may not work for you.

Added the following line to the _gltf2usd/usd_material.py file:

self._clearcoat_roughness = material.CreateInput('clearcoatRoughness', Sdf.ValueTypeNames.Float)
self._clearcoat_roughness.Set(0.01)

self._opacity = material.CreateInput('opacity', Sdf.ValueTypeNames.Float)
self._opacity.Set(1.0) # added back this line to set a default value to the opacity.

self._ior = material.CreateInput('ior', Sdf.ValueTypeNames.Float)
self._ior.Set(1.5)

@TyLindberg
Copy link
Author

@rafaelmaroxa Nice find! Might be worthwhile to open a pull request with that fix.

@ang88myt
Copy link

opacity did not work after the convert to usdz file

@ang88myt
Copy link

may i know what is the proper way to it up on gltf side?

@pedrorocha-net
Copy link

Any update on this issue? Should we consider a PR with the suggested fix?

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

6 participants