Merge pull request #2185 from gongminmin/FixShininess
Make gltf2's roughnessAsShininess matches between importer and exporter.pull/2183/head^2
commit
4d3ce0fed2
|
@ -272,7 +272,8 @@ static aiMaterial* ImportMaterial(std::vector<int>& embeddedTexIdxs, Asset& r, M
|
||||||
aimat->AddProperty(&mat.pbrMetallicRoughness.metallicFactor, 1, AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_METALLIC_FACTOR);
|
aimat->AddProperty(&mat.pbrMetallicRoughness.metallicFactor, 1, AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_METALLIC_FACTOR);
|
||||||
aimat->AddProperty(&mat.pbrMetallicRoughness.roughnessFactor, 1, AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_ROUGHNESS_FACTOR);
|
aimat->AddProperty(&mat.pbrMetallicRoughness.roughnessFactor, 1, AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_ROUGHNESS_FACTOR);
|
||||||
|
|
||||||
float roughnessAsShininess = (1 - mat.pbrMetallicRoughness.roughnessFactor) * 1000;
|
float roughnessAsShininess = 1 - mat.pbrMetallicRoughness.roughnessFactor;
|
||||||
|
roughnessAsShininess *= roughnessAsShininess * 1000;
|
||||||
aimat->AddProperty(&roughnessAsShininess, 1, AI_MATKEY_SHININESS);
|
aimat->AddProperty(&roughnessAsShininess, 1, AI_MATKEY_SHININESS);
|
||||||
|
|
||||||
SetMaterialTextureProperty(embeddedTexIdxs, r, mat.normalTexture, aimat, aiTextureType_NORMALS);
|
SetMaterialTextureProperty(embeddedTexIdxs, r, mat.normalTexture, aimat, aiTextureType_NORMALS);
|
||||||
|
|
Loading…
Reference in New Issue