Clean the Material FBX code and how we use the factor components for diffuse and specular

This commit is contained in:
samcake 2015-09-28 17:46:48 -07:00
parent 202d2944ab
commit 1e9c19d535
2 changed files with 7 additions and 9 deletions

View file

@ -957,14 +957,14 @@ FBXGeometry* FBXReader::extractFBXGeometry(const QVariantHash& mapping, const QS
} else if (property.properties.at(0) == "Diffuse") {
material.diffuseColor = getVec3(property.properties, index);
} else if (property.properties.at(0) == "DiffuseFactor") {
// material.diffuseFactor = property.properties.at(index).value<double>();
material.diffuseFactor = property.properties.at(index).value<double>();
} else if (property.properties.at(0) == "SpecularColor") {
material.specularColor = getVec3(property.properties, index);
} else if (property.properties.at(0) == "Specular") {
material.specularColor = getVec3(property.properties, index);
} else if (property.properties.at(0) == "SpecularFactor") {
// material.specularFactor = property.properties.at(index).value<double>();
material.specularFactor = property.properties.at(index).value<double>();
} else if (property.properties.at(0) == "Emissive") {
material.emissiveColor = getVec3(property.properties, index);

View file

@ -136,15 +136,13 @@ void FBXReader::consolidateFBXMaterials() {
material._material->setEmissive(material.emissiveColor);
auto diffuse = material.diffuseColor;
diffuse *= material.diffuseFactor;
if (glm::all(glm::equal(diffuse, glm::vec3(0.0f)))) {
material._material->setDiffuse(diffuse);
} else {
material._material->setDiffuse(diffuse);
}
// FIXME: Do not use the Diffuse Factor yet as some FBX models have it set to 0
// diffuse *= material.diffuseFactor;
material._material->setDiffuse(diffuse);
float metallic = std::max(material.specularColor.x, std::max(material.specularColor.y, material.specularColor.z));
metallic *= material.specularFactor;
// FIXME: Do not use the Specular Factor yet as some FBX models have it set to 0
// metallic *= material.specularFactor;
material._material->setMetallic(metallic);
material._material->setGloss(material.shininess);