gltf2usd
gltf2usd copied to clipboard
Material opacity lost on export to USDZ
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 c0301fc9579739c826d51be97fc1d169f2c78e65.
Attached is an example model that exhibits this behavior.
+1 Please let me know if there's anything I can do to help.
+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
}
}
@TyLindberg The line of code that set the default opacity value was removed on commit c0301fc9579739c826d51be97fc1d169f2c78e65 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)
@rafaelmaroxa Nice find! Might be worthwhile to open a pull request with that fix.
opacity did not work after the convert to usdz file
may i know what is the proper way to it up on gltf side?
Any update on this issue? Should we consider a PR with the suggested fix?