Closed ShantanuSriv closed 5 years ago
@kcoley i also see transparency is missing and scale values are literally high when converting gltf to usda. Can you please look into this asap?
@ShantanuSriv @gopikrishnachaganti I didn't see an alphaMode option in the UsdPreviewSurface API spec, so I left it out: https://graphics.pixar.com/usd/docs/UsdPreviewSurface-Proposal.html
There is a material opacity option, which I set using the base color factor, if a base color texture with alpha isn't set in usd_material
: https://github.com/kcoley/gltf2usd/blob/master/Source/_gltf2usd/usd_material.py#L231
Though I should set the opacity regardless whether there is alpha in the base color texture, which I can quickly fix.
@gopikrishnachaganti when you say scale values, are you referring to normal scale, emissive factor, base color factor, etc? I also set these in usd_material.py based on their parameters though I can run some tests to verify they are working against these models: https://github.com/KhronosGroup/glTF-Asset-Generator/tree/master/Output/Material.
If referring to model scale, models by default are scaled by 100 to convert from glTF meters to centimeters, though this can be adjusted with the --scale
flag
@ShantanuSriv @gopikrishnachaganti I pushed a fix for opacity with base color factor that I mentioned previously. I also tested the alpha modes based on Material_07
and the factors seem to export as expected: https://github.com/KhronosGroup/glTF-Asset-Generator/tree/master/Output/Material
Though I am not sure if ArQuicklook is respecting the scale factors of the textures based on looking at the renders on Mac and iOS.
@ShantanuSriv As for adding support for alpha modes to the USD spec, I think that is a good question for the USD interest group: https://groups.google.com/forum/#!forum/usd-interest
@kcoley Thanks a lot for such a quick response! I will look into the new changes and test it.
@kcoley I have tried converting the files from gltf to usdz. Even after the changes of the latest patch, I see the transparency issues. I have a question to ask: is this the issue with ARQuickLook or is there some edge cases that are not handled properly during the conversion. Plus, I have tried converting obj to usdz -- from another tool -- but the same transparency issues. So, what I have concluded that there is some issue with how ARQuickLook is handling transparency -- not sure though. Do you have any confirmation on this issue?
Here are some of the files in glTF and its corresponding usdz-converted files:
Also, do you have any official usdz sample file from Apple which has transparency exposed in it?
@ShantanuSriv hmm, it could be an issue with ArQuickLook. Apple does not have any sample usdz models with transparency on their gallery: https://developer.apple.com/arkit/gallery/
I noticed that if there is alpha in the base color texture, it gets used in ArQuickLook even when set to not be used in the UsdPreviewSurface in the usdz file. I could put in a check for that and overwrite the transparency to completely opaque if the alpha mode is set to opaque.
@ShantanuSriv I just added support for alpha mode in the Material class (https://github.com/kcoley/gltf2usd/pull/93).
Note that Alpha Mask is not yet supported in USD so it will default to Alpha Blend. If that doesn't fix your issue, feel free to reopen.
I tried the new changes but all the transparency is now gone.
glTF
converted-usdz
The glTF file has only two alphaModes:
Conclusion: After the changes, shadow at the bottom is fixed but transparency is still an issue.
https://github.com/kcoley/gltf2usd/blob/2fb00ed730b8a87206551ff67cd75682d8276ad4/Source/_gltf2usd/gltf2/Material.py#L104
I was going through the code and couldn't find anything which handles alphaMode parameter of material class -- for handling transparency nature of the asset? I wanted to know whether this is purposely left out because of no API support or did @kcoley miss adding the support for it?
As, I converted a few glTF files to usdz and there were issues with transparency of the converted files.