CesiumGS / obj2gltf

Convert OBJ assets to glTF
Apache License 2.0
1.71k stars 307 forks source link

checkTransparency issue #112

Closed PrincessGod closed 6 years ago

PrincessGod commented 6 years ago

Should checkTransparency parameter be in ambientTextureOptions? Cause I have obj with transparency ambient texture.

lilleyse commented 6 years ago

I'm pretty sure most glTF 2 renderers will ignore the alpha channel for anything but base color. For example: https://github.com/KhronosGroup/glTF-WebGL-PBR/blob/master/shaders/pbr-frag.glsl#L293.

It would be better to transfer the alpha channel to the base color (diffuse) texture instead.

PrincessGod commented 6 years ago

@lilleyse Thanks, That's let me learn a lot. But in this code, if a .png file load for ambientTexture first, and when deffuseTexture use it, it will lose alpha data. Because you just load image once.

lilleyse commented 6 years ago

Ah that is true. I'll open a PR to change the load order.