Better calculation of glTF opacity.

At the glTF level, transparency is a scalar; we just throw away any
color information in FBX TransparentColor. We still need to calculate
our total opacity from it, however. This is the right formula, which
additionally matches the deprecated (but still populated, by the Maya
exporter) 'Opacity' property.
This commit is contained in:
Par Winzell 2017-11-06 14:48:16 -08:00
parent 3b7872f4f1
commit 4f8ddffdf7
1 changed files with 2 additions and 2 deletions

View File

@ -168,8 +168,8 @@ public:
if (facTex) {
fmt::printf("Warning: Mat [%s]: Can't handle texture for %s; discarding.\n", name, FbxSurfaceMaterial::sTransparencyFactor);
}
// FBX color is RGB, so we supply the A channel from TransparencyFactor
res.colDiffuse[3] = 1.0 - transparency[3];
// FBX color is RGB, so we calculate the A channel as the average of the FBX transparency color vector
res.colDiffuse[3] = 1.0 - (transparency[0] + transparency[1] + transparency[2])/3.0;
return res;
}