@@ -618,6 +618,12 @@ void ObjFileImporter::createMaterials(const ObjFile::Model *pModel, aiScene *pSc
618618 mat->AddProperty (&pCurrentMaterial->shineness , 1 , AI_MATKEY_SHININESS );
619619 mat->AddProperty (&pCurrentMaterial->alpha , 1 , AI_MATKEY_OPACITY );
620620 mat->AddProperty (&pCurrentMaterial->transparent , 1 , AI_MATKEY_COLOR_TRANSPARENT );
621+ mat->AddProperty (&pCurrentMaterial->roughness , 1 , AI_MATKEY_ROUGHNESS_FACTOR );
622+ mat->AddProperty (&pCurrentMaterial->metallic , 1 , AI_MATKEY_METALLIC_FACTOR );
623+ mat->AddProperty (&pCurrentMaterial->sheen , 1 , AI_MATKEY_SHEEN_COLOR_FACTOR );
624+ mat->AddProperty (&pCurrentMaterial->clearcoat_thickness , 1 , AI_MATKEY_CLEARCOAT_FACTOR );
625+ mat->AddProperty (&pCurrentMaterial->clearcoat_roughness , 1 , AI_MATKEY_CLEARCOAT_ROUGHNESS_FACTOR );
626+ mat->AddProperty (&pCurrentMaterial->anisotropy , 1 , AI_MATKEY_ANISOTROPY_FACTOR );
621627
622628 // Adding refraction index
623629 mat->AddProperty (&pCurrentMaterial->ior , 1 , AI_MATKEY_REFRACTI );
@@ -709,6 +715,39 @@ void ObjFileImporter::createMaterials(const ObjFile::Model *pModel, aiScene *pSc
709715 }
710716 }
711717
718+ if (0 != pCurrentMaterial->textureRoughness .length ) {
719+ mat->AddProperty (&pCurrentMaterial->textureRoughness , _AI_MATKEY_TEXTURE_BASE, aiTextureType_DIFFUSE_ROUGHNESS, 0 );
720+ mat->AddProperty (&uvwIndex, 1 , _AI_MATKEY_UVWSRC_BASE, aiTextureType_DIFFUSE_ROUGHNESS, 0 );
721+ if (pCurrentMaterial->clamp [ObjFile::Material::TextureRoughnessType]) {
722+ addTextureMappingModeProperty (mat, aiTextureType_DIFFUSE_ROUGHNESS);
723+ }
724+ }
725+
726+ if (0 != pCurrentMaterial->textureMetallic .length ) {
727+ mat->AddProperty (&pCurrentMaterial->textureMetallic , _AI_MATKEY_TEXTURE_BASE, aiTextureType_METALNESS, 0 );
728+ mat->AddProperty (&uvwIndex, 1 , _AI_MATKEY_UVWSRC_BASE, aiTextureType_METALNESS, 0 );
729+ if (pCurrentMaterial->clamp [ObjFile::Material::TextureMetallicType]) {
730+ addTextureMappingModeProperty (mat, aiTextureType_METALNESS);
731+ }
732+ }
733+
734+ if (0 != pCurrentMaterial->textureSheen .length ) {
735+ mat->AddProperty (&pCurrentMaterial->textureSheen , _AI_MATKEY_TEXTURE_BASE, aiTextureType_SHEEN, 0 );
736+ mat->AddProperty (&uvwIndex, 1 , _AI_MATKEY_UVWSRC_BASE, aiTextureType_SHEEN, 0 );
737+ if (pCurrentMaterial->clamp [ObjFile::Material::TextureSheenType]) {
738+ addTextureMappingModeProperty (mat, aiTextureType_SHEEN);
739+ }
740+ }
741+
742+ if (0 != pCurrentMaterial->textureRMA .length ) {
743+ // NOTE: glTF importer places Rough/Metal/AO texture in Unknown so doing the same here for consistency.
744+ mat->AddProperty (&pCurrentMaterial->textureRMA , _AI_MATKEY_TEXTURE_BASE, aiTextureType_UNKNOWN, 0 );
745+ mat->AddProperty (&uvwIndex, 1 , _AI_MATKEY_UVWSRC_BASE, aiTextureType_UNKNOWN, 0 );
746+ if (pCurrentMaterial->clamp [ObjFile::Material::TextureRMAType]) {
747+ addTextureMappingModeProperty (mat, aiTextureType_UNKNOWN);
748+ }
749+ }
750+
712751 // Store material property info in material array in scene
713752 pScene->mMaterials [pScene->mNumMaterials ] = mat;
714753 pScene->mNumMaterials ++;
0 commit comments