mrdoob/three.js — Issue #1089: Add transparent flag to convert_obj_three
Author: powerslave
Created: 2012-01-12 16:04:57+00:00
State: open

I was wondering why, when converting models with convert_obj_three.py, materials with mapAlpha don't have the transparent flag set. As far as I see it, mapAlpha textures are only rendered transparent when this flag is set. So why not add the transparent flag whenever a mapAlpha is set?

I patched my convert_obj_three.py with

```python
# Alpha texture
# map_d texture_alpha.png
if chunks[0] == "map_d" and len(chunks) == 2:
materials[identifier]["mapAlpha"] = texture_relative_path(chunks[1])
materials[identifier]["transparent"] = True ## added this line
```

and for me it seems to do what I'd expect. The output .js simply has the transparent flag added.

```javascript
"materials": [ {
...
"mapAlpha" : "earth_clouds_1024.png",
"mapDiffuse" : "earth_clouds_1024.png",
"opticalDensity" : 1.0,
"specularCoef" : 0.0,
"transparency" : 1.0,
"transparent" : true #transparent flag is added
},
```

Is this a good idea, or is there a reason why the transparent flag is not set "automatically"?