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 parameter is missing in the Material class #88

Closed
ShantanuSriv opened this issue Oct 28, 2018 · 8 comments
Closed

AlphaMode parameter is missing in the Material class #88

ShantanuSriv opened this issue Oct 28, 2018 · 8 comments

Comments

@ShantanuSriv
Copy link

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.

@gopikrishnachaganti
Copy link

@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?

@kcoley
Copy link
Owner

kcoley commented Oct 28, 2018

@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

@kcoley
Copy link
Owner

kcoley commented Oct 28, 2018

@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

@ShantanuSriv
Copy link
Author

@kcoley Thanks a lot for such a quick response! I will look into the new changes and test it.

@ShantanuSriv
Copy link
Author

ShantanuSriv commented Nov 2, 2018

@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:

glTF

screen shot 2018-11-02 at 2 58 14 pm

screen shot 2018-11-02 at 3 00 17 pm

screen shot 2018-11-02 at 3 01 08 pm

usdz-converted

image from ios 1
image from ios 2
image from ios

Also, do you have any official usdz sample file from Apple which has transparency exposed in it?

@kcoley
Copy link
Owner

kcoley commented Nov 2, 2018

@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.

@kcoley kcoley mentioned this issue Nov 3, 2018
@kcoley
Copy link
Owner

kcoley commented Nov 3, 2018

@ShantanuSriv I just added support for alpha mode in the Material class (#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.

@kcoley kcoley closed this as completed Nov 3, 2018
@ShantanuSriv
Copy link
Author

I tried the new changes but all the transparency is now gone.

glTF

screen shot 2018-11-02 at 3 01 08 pm

converted-usdz

image from ios 3

The glTF file has only two alphaModes:

  • Blend
  • Opaque

Conclusion: After the changes, shadow at the bottom is fixed but transparency is still an issue.

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

3 participants