mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 18:25:52 +02:00
Merge branch 'orange' of https://github.com/samcake/hifi into orange
This commit is contained in:
commit
2fc359d34c
3 changed files with 32 additions and 16 deletions
|
@ -892,24 +892,27 @@ FBXGeometry* FBXReader::extractFBXGeometry(const QVariantHash& mapping, const QS
|
||||||
} else if (property.properties.at(0) == "DiffuseFactor") {
|
} 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) == "Diffuse") {
|
} else if (property.properties.at(0) == "Diffuse") {
|
||||||
// material.diffuseColor = getVec3(property.properties, index);
|
// NOTE: this is uneeded but keep it for now for debug
|
||||||
// material.diffuseFactor = 1.0;
|
// material.diffuseColor = getVec3(property.properties, index);
|
||||||
|
// material.diffuseFactor = 1.0;
|
||||||
|
|
||||||
} else if (property.properties.at(0) == "SpecularColor") {
|
} else if (property.properties.at(0) == "SpecularColor") {
|
||||||
material.specularColor = getVec3(property.properties, index);
|
material.specularColor = getVec3(property.properties, index);
|
||||||
} else if (property.properties.at(0) == "SpecularFactor") {
|
} 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) == "Specular") {
|
} else if (property.properties.at(0) == "Specular") {
|
||||||
// material.specularColor = getVec3(property.properties, index);
|
// NOTE: this is uneeded but keep it for now for debug
|
||||||
// material.specularFactor = 1.0;
|
// material.specularColor = getVec3(property.properties, index);
|
||||||
|
// material.specularFactor = 1.0;
|
||||||
|
|
||||||
} else if (property.properties.at(0) == "EmissiveColor") {
|
} else if (property.properties.at(0) == "EmissiveColor") {
|
||||||
material.emissiveColor = getVec3(property.properties, index);
|
material.emissiveColor = getVec3(property.properties, index);
|
||||||
} else if (property.properties.at(0) == "EmissiveFactor") {
|
} else if (property.properties.at(0) == "EmissiveFactor") {
|
||||||
material.emissiveFactor = property.properties.at(index).value<double>();
|
material.emissiveFactor = property.properties.at(index).value<double>();
|
||||||
} else if (property.properties.at(0) == "Emissive") {
|
} else if (property.properties.at(0) == "Emissive") {
|
||||||
// material.emissiveColor = getVec3(property.properties, index);
|
// NOTE: this is uneeded but keep it for now for debug
|
||||||
// material.emissiveFactor = 1.0;
|
// material.emissiveColor = getVec3(property.properties, index);
|
||||||
|
// material.emissiveFactor = 1.0;
|
||||||
|
|
||||||
} else if (property.properties.at(0) == "Shininess") {
|
} else if (property.properties.at(0) == "Shininess") {
|
||||||
material.shininess = property.properties.at(index).value<double>();
|
material.shininess = property.properties.at(index).value<double>();
|
||||||
|
@ -917,6 +920,7 @@ FBXGeometry* FBXReader::extractFBXGeometry(const QVariantHash& mapping, const QS
|
||||||
} else if (property.properties.at(0) == "Opacity") {
|
} else if (property.properties.at(0) == "Opacity") {
|
||||||
material.opacity = property.properties.at(index).value<double>();
|
material.opacity = property.properties.at(index).value<double>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sting Ray Material Properties!!!!
|
// Sting Ray Material Properties!!!!
|
||||||
else if (property.properties.at(0) == "Maya|use_normal_map") {
|
else if (property.properties.at(0) == "Maya|use_normal_map") {
|
||||||
material.isPBSMaterial = true;
|
material.isPBSMaterial = true;
|
||||||
|
@ -925,6 +929,7 @@ FBXGeometry* FBXReader::extractFBXGeometry(const QVariantHash& mapping, const QS
|
||||||
} else if (property.properties.at(0) == "Maya|base_color") {
|
} else if (property.properties.at(0) == "Maya|base_color") {
|
||||||
material.isPBSMaterial = true;
|
material.isPBSMaterial = true;
|
||||||
material.diffuseColor = getVec3(property.properties, index);
|
material.diffuseColor = getVec3(property.properties, index);
|
||||||
|
|
||||||
} else if (property.properties.at(0) == "Maya|use_color_map") {
|
} else if (property.properties.at(0) == "Maya|use_color_map") {
|
||||||
material.isPBSMaterial = true;
|
material.isPBSMaterial = true;
|
||||||
material.useAlbedoMap = (bool) property.properties.at(index).value<double>();
|
material.useAlbedoMap = (bool) property.properties.at(index).value<double>();
|
||||||
|
@ -932,6 +937,7 @@ FBXGeometry* FBXReader::extractFBXGeometry(const QVariantHash& mapping, const QS
|
||||||
} else if (property.properties.at(0) == "Maya|roughness") {
|
} else if (property.properties.at(0) == "Maya|roughness") {
|
||||||
material.isPBSMaterial = true;
|
material.isPBSMaterial = true;
|
||||||
material.roughness = property.properties.at(index).value<double>();
|
material.roughness = property.properties.at(index).value<double>();
|
||||||
|
|
||||||
} else if (property.properties.at(0) == "Maya|use_roughness_map") {
|
} else if (property.properties.at(0) == "Maya|use_roughness_map") {
|
||||||
material.isPBSMaterial = true;
|
material.isPBSMaterial = true;
|
||||||
material.useRoughnessMap = (bool)property.properties.at(index).value<double>();
|
material.useRoughnessMap = (bool)property.properties.at(index).value<double>();
|
||||||
|
@ -939,20 +945,25 @@ FBXGeometry* FBXReader::extractFBXGeometry(const QVariantHash& mapping, const QS
|
||||||
} else if (property.properties.at(0) == "Maya|metallic") {
|
} else if (property.properties.at(0) == "Maya|metallic") {
|
||||||
material.isPBSMaterial = true;
|
material.isPBSMaterial = true;
|
||||||
material.metallic = property.properties.at(index).value<double>();
|
material.metallic = property.properties.at(index).value<double>();
|
||||||
|
|
||||||
} else if (property.properties.at(0) == "Maya|use_metallic_map") {
|
} else if (property.properties.at(0) == "Maya|use_metallic_map") {
|
||||||
material.isPBSMaterial = true;
|
material.isPBSMaterial = true;
|
||||||
material.useMetallicMap = (bool)property.properties.at(index).value<double>();
|
material.useMetallicMap = (bool)property.properties.at(index).value<double>();
|
||||||
|
|
||||||
} else if (property.properties.at(0) == "Maya|emissive") {
|
} else if (property.properties.at(0) == "Maya|emissive") {
|
||||||
material.isPBSMaterial = true;
|
material.isPBSMaterial = true;
|
||||||
material.emissiveColor = getVec3(property.properties, index);
|
material.emissiveColor = getVec3(property.properties, index);
|
||||||
|
|
||||||
} else if (property.properties.at(0) == "Maya|emissive_intensity") {
|
} else if (property.properties.at(0) == "Maya|emissive_intensity") {
|
||||||
material.isPBSMaterial = true;
|
material.isPBSMaterial = true;
|
||||||
material.emissiveIntensity = property.properties.at(index).value<double>();
|
material.emissiveIntensity = property.properties.at(index).value<double>();
|
||||||
|
|
||||||
} else if (property.properties.at(0) == "Maya|use_emissive_map") {
|
} else if (property.properties.at(0) == "Maya|use_emissive_map") {
|
||||||
material.isPBSMaterial = true;
|
material.isPBSMaterial = true;
|
||||||
material.useEmissiveMap = (bool)property.properties.at(index).value<double>();
|
material.useEmissiveMap = (bool)property.properties.at(index).value<double>();
|
||||||
|
|
||||||
} else if (property.properties.at(0) == "Maya|use_ao_map") {
|
} else if (property.properties.at(0) == "Maya|use_ao_map") {
|
||||||
|
material.isPBSMaterial = true;
|
||||||
material.useOcclusionMap = (bool)property.properties.at(index).value<double>();
|
material.useOcclusionMap = (bool)property.properties.at(index).value<double>();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -138,15 +138,15 @@ public:
|
||||||
opacity(opacity) {}
|
opacity(opacity) {}
|
||||||
|
|
||||||
glm::vec3 diffuseColor{ 1.0f };
|
glm::vec3 diffuseColor{ 1.0f };
|
||||||
float diffuseFactor = 1.0f;
|
float diffuseFactor{ 1.0f };
|
||||||
glm::vec3 specularColor{ 0.02f };
|
glm::vec3 specularColor{ 0.02f };
|
||||||
float specularFactor = 1.0f;
|
float specularFactor{ 1.0f };
|
||||||
|
|
||||||
glm::vec3 emissiveColor{ 0.0f };
|
glm::vec3 emissiveColor{ 0.0f };
|
||||||
float emissiveFactor = 0.0f;
|
float emissiveFactor{ 0.0f };
|
||||||
|
|
||||||
float shininess = 23.0f;
|
float shininess{ 23.0f };
|
||||||
float opacity = 1.0f;
|
float opacity{ 1.0f };
|
||||||
|
|
||||||
float metallic{ 0.0f };
|
float metallic{ 0.0f };
|
||||||
float roughness{ 1.0f };
|
float roughness{ 1.0f };
|
||||||
|
|
|
@ -80,10 +80,12 @@ void FBXReader::consolidateFBXMaterials() {
|
||||||
QString diffuseFactorTextureID = diffuseFactorTextures.value(material.materialID);
|
QString diffuseFactorTextureID = diffuseFactorTextures.value(material.materialID);
|
||||||
|
|
||||||
if (!diffuseFactorTextureID.isNull() || !diffuseTextureID.isNull()) {
|
if (!diffuseFactorTextureID.isNull() || !diffuseTextureID.isNull()) {
|
||||||
// If both factor and color are specified, color wins
|
// If both factor and color are specified, the texture bound to DiffuseColor wins
|
||||||
if (!diffuseFactorTextureID.isNull() && diffuseTextureID.isNull()) {
|
if (!diffuseFactorTextureID.isNull() && diffuseTextureID.isNull()) {
|
||||||
diffuseTextureID = diffuseFactorTextureID;
|
diffuseTextureID = diffuseFactorTextureID;
|
||||||
// Avoid the DiffuseFactor effect in this case because here Maya would put 0.5...
|
// If the diffuseTextureID comes from the Texture bound to DiffuseFactor, we know it s exported from maya
|
||||||
|
// And the DiffuseFactor is forced to 0.5 by Maya which is bad
|
||||||
|
// So we need to force it to 1.0
|
||||||
material.diffuseFactor = 1.0;
|
material.diffuseFactor = 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,10 +192,13 @@ void FBXReader::consolidateFBXMaterials() {
|
||||||
|
|
||||||
// Finally create the true material representation
|
// Finally create the true material representation
|
||||||
material._material = std::make_shared<model::Material>();
|
material._material = std::make_shared<model::Material>();
|
||||||
material._material->setEmissive(material.emissiveColor * material.emissiveFactor);
|
|
||||||
|
|
||||||
// Do not use the Diffuse Factor from FBX at all, this simpliies the export path
|
// Emissive color is the mix of emissiveColor with emissiveFactor
|
||||||
auto diffuse = material.diffuseColor;
|
auto emissive = material.emissiveColor * material.emissiveFactor;
|
||||||
|
material._material->setEmissive(emissive);
|
||||||
|
|
||||||
|
// Final diffuse color is the mix of diffuseColor with diffuseFactor
|
||||||
|
auto diffuse = material.diffuseColor * material.diffuseFactor;
|
||||||
material._material->setAlbedo(diffuse);
|
material._material->setAlbedo(diffuse);
|
||||||
|
|
||||||
if (material.isPBSMaterial) {
|
if (material.isPBSMaterial) {
|
||||||
|
|
Loading…
Reference in a new issue