kcoley / gltf2usd

command-line utility for converting glTF 2.0 models to USD
MIT License
264 stars 38 forks source link

Blend Mode Not Getting Rendered Properly #95 #112

Closed ShantanuSriv closed 5 years ago

ShantanuSriv commented 5 years ago

@kcoley Transparency issue is resolved to a great extent but there is one issue which I am not able to find a solution for -- I think the blend mode is not working properly.

Here is the glTF rendered file:

screen shot 2018-12-04 at 10 53 25 pm

In the glTF rendered file, I see a thin pinkish-layer in the middle area where there is transparency.

In the usdz-converted file:

image uploaded from ios 1

I see complete transparency.

I think blend mode is not working fine with usdz. Do you have any proof of whether it's working fine? I remember you saying that alphaMode: Mask is not yet supported for usdz. Can you provide the source for it? I was not able to find it.

If this is an altogether different issue, can you please look into it? It's a bit urgent.

Thanks.

kcoley commented 5 years ago

Hi @ShantanuSriv. The only thing I was able to confirm working with iOS was alpha blend, which I believe to be the only alpha mode currently supported in usdz specification. I was not able to find anything about blend modes in the USD preview surface specification: https://graphics.pixar.com/usd/docs/UsdPreviewSurface-Proposal.html

I tested against these glTF models from the glTF-Asset-Generator project: https://github.com/KhronosGroup/glTF-Asset-Generator/tree/master/Output/Material_AlphaBlend

Is the bag supposed to be using alpha blend?

kcoley commented 5 years ago

@ShantanuSriv also is the alpha value set to a very low value, if using alpha blending?

ShantanuSriv commented 5 years ago

@kcoley

Is the bag supposed to be using alpha blend?

yes

ShantanuSriv commented 5 years ago

@ShantanuSriv also is the alpha value set to a very low value, if using alpha blending?

@kcoley I have two base materials and both of them use the same alpha value of 1 in baseColorFactor[3], having same baseColorTexture but one with alphaMode Blend and the other one with Opaque.

kcoley commented 5 years ago

@ShantanuSriv gotcha. As a test, can you remove the "Blend" line from the glTF file and try converting to see if the result is the same when converting to usd?

ShantanuSriv commented 5 years ago

@kcoley sure, I will try that and see if it helps.

ShantanuSriv commented 5 years ago

@kcoley I tried that but it completely takes away the transparency from it.

image uploaded from ios 2

kcoley commented 5 years ago

@ShantanuSriv interesting, do you know what the alpha values are in the texture?

ShantanuSriv commented 5 years ago

@kcoley 1.0

kcoley commented 5 years ago

@ShantanuSriv do you know if you can provide a simple mesh that can repro this issue?

ShantanuSriv commented 5 years ago

@kcoley gltf sample which for the above images. Can you please look into this? 53264118_mid.zip

kcoley commented 5 years ago

@ShantanuSriv I'll take a look

kcoley commented 5 years ago

@ShantanuSriv this looks like a discrepancy between Mac OS and iOS.

Viewing the usdz model on iOS does yield a result similar to your photo: img_2104

However, rendering the model within XCode actually shows the pink hue on the texture:

screen shot 2018-12-10 at 6 39 06 pm

I also get a similar result using Babylon.js's glTF viewer:

screen shot 2018-12-10 at 6 33 01 pm

So this seems like it may be a bug in iOS. Maybe good to file an issue with Apple?

ShantanuSriv commented 5 years ago

@kcoley thanks for all the help. Closing the issue for now.