Obj model losing transparency in Scenekit

I am new to Scenekit. I was trying to load a .Obj model with it's .mtl. Everything looks good only the transparent window glasses are appearing in solid sky-blue. While the same model in .dae format works perfectly. I tried to load the same .obj model in 3js and it worked as expected.

scnScene=SCNScene(named: modelPath)

What should I do to make the transparency work?

Replies

I ran into the same issue (therefore I found this thread).


I had a material with:
d 0.513699

So that should be ~ 50% transparent, but it appeared opaque


I also tried with Tr instead of "d" in the mtl file (Tr = 1.0 - d) since some programs / exporters / importers use Tr and although most use d, but it made no difference.
Using a transparent texture on the material did work, for instance:


map_d textures/glass.png
If glass.png has an alpha lower than 1.0.

It also works if you use

map_Kd textures/glass.png


So with a diffuse colour map with alpha < 1.0.


On a side note: I had problems with mtl / texture file names containg spaces. Apparently the tokenizer that parses these files sperataes by space and loses part of the filename, resulting in many models without textures etc ..