Question

GLTF - Output is transparent when it shouldn't (really) be

  • 18 March 2021
  • 3 replies
  • 69 views

Userlevel 4
Badge +26

When converting a 3D model to GLTF (2.0) which has png textures with an alpha band the output looks pretty weird in most viewers.

 

The alpha value in the textures is at the Max (255) so it shouldn't be transparent, however, FME sets the alphamode to 'BLEND'. While I understand the logic in this I think in practice a better default for the alphamode would be 'MASK'. In the image below you can see that the inner cube is rendered even though the outer cube has a texture which has no transparent pixels.

 

In my situation the issue can be solved by simply having jpegs as textures, however, this is often not possible to get.

 

In other situations, for example billboard trees, you want to have transparency, but in the form of a 'MASK' not a 'BLEND'.

 

I would argue that in 90 % of cases the 'MASK' option would be better than 'BLEND'.

 

I've attached the model for inspection.

 

Note that this seems to get rendered the same in all the renderers I've tried.

 

I should also note that this isn't really a question, more of a request. I'll create an idea and link it.

transparent


3 replies

Userlevel 1
Badge +10

Thanks for posting this Idea @virtualcitymatt​! Here's the link for anyone who's interested in adding their thoughts:

https://community.safe.com/s/idea/0874Q000000LP2FQAW/detail

Userlevel 1
Badge +10

@virtualcitymatt​ - I followed up with one of our developers and he looked into this. He still believes that BLEND is the the correct value. However, he's not sure why your data is rendering that way. He was unable to reproduce it, even when using the textures from your output. Would you mind sharing your workspace with us so he can investigate this further? 

Userlevel 4
Badge +26

@virtualcitymatt​ - I followed up with one of our developers and he looked into this. He still believes that BLEND is the the correct value. However, he's not sure why your data is rendering that way. He was unable to reproduce it, even when using the textures from your output. Would you mind sharing your workspace with us so he can investigate this further? 

Hiya @nampreetatsafe​ , thanks for bringing this to the dev.

 

I also believe that BLEND is not exactly wrong to output. BLEND would be fine, however, in my experience most real time rendering engines seems to have trouble with it to varying degrees. This is not really the fault of the data at all. And of course BLEND is required with windows.

Here are a few popular viewers which I've tested with various models

https://sandbox.babylonjs.com/

https://gltf-viewer.donmccurdy.com/

and of course with Cesium

In fact, all three seem to handle it differently.

 

I should also point out that the Blender documentation mention this specifically in this page: https://docs.blender.org/manual/en/2.80/addons/io_scene_gltf2.html?highlight=alpha

 

"Be aware that transparency (or Alpha Blend mode) is complex for real-time engines to render, and may behave in unexpected ways after export. Where possible, use Alpha Clip mode instead, or place Opaque polygons behind only a single layer of Alpha Blend polygons."

 

I think the issue here is that one size dose not fit all. I just feel that using BLEND mode will/could result in more issues than using the CUTOFF mode if it was one or the other. Ideally a choice would be the best option. I should also mention that the issue is present in 3DTiles as well (gltf is part of 3Dtiles).

 

Please find attached a workspace which creates a model where this issue is seen. The issue is worse when there are a lot more textures. For example a complex bim model with a lot of textured surfaces really results in a funky mess.

 

Cheers

Matt

 

 

 

 

 

Reply