Set alphaMode, baseColorFactor opacity when model’s opacity isn’t 1

pull/1423/head
Daniel Hritzkiv 2017-09-06 14:17:24 -04:00
parent 37582131f4
commit 0a8183531e
No known key found for this signature in database
GPG Key ID: D1D19875679D5CBF
1 changed files with 11 additions and 1 deletions

View File

@ -433,7 +433,17 @@ void glTF2Exporter::ExportMaterials()
mat->Get(AI_MATKEY_TWOSIDED, m->doubleSided); mat->Get(AI_MATKEY_TWOSIDED, m->doubleSided);
mat->Get(AI_MATKEY_GLTF_ALPHACUTOFF, m->alphaCutoff); mat->Get(AI_MATKEY_GLTF_ALPHACUTOFF, m->alphaCutoff);
mat->Get(AI_MATKEY_GLTF_ALPHAMODE, m->alphaMode);
if (mat->Get(AI_MATKEY_GLTF_ALPHAMODE, m->alphaMode) != AI_SUCCESS) {
float opacity;
if (mat->Get(AI_MATKEY_OPACITY, opacity) == AI_SUCCESS) {
if (opacity < 1) {
m->alphaMode = "MASK";
m->pbrMetallicRoughness.baseColorFactor[3] *= opacity;
}
}
}
bool hasPbrSpecularGlossiness; bool hasPbrSpecularGlossiness;
mat->Get(AI_MATKEY_GLTF_PBRSPECULARGLOSSINESS, hasPbrSpecularGlossiness); mat->Get(AI_MATKEY_GLTF_PBRSPECULARGLOSSINESS, hasPbrSpecularGlossiness);