From a96da32a4c3b785fea0c92a03a8d9bf89008a8ca Mon Sep 17 00:00:00 2001 From: Rene Sepulveda Date: Thu, 5 Oct 2023 19:59:17 -0400 Subject: [PATCH] Skeleton of doing materials --- cpp/open3d/t/io/file_format/FileASSIMP.cpp | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/cpp/open3d/t/io/file_format/FileASSIMP.cpp b/cpp/open3d/t/io/file_format/FileASSIMP.cpp index 202a4fe9c87..4c32af6978c 100644 --- a/cpp/open3d/t/io/file_format/FileASSIMP.cpp +++ b/cpp/open3d/t/io/file_format/FileASSIMP.cpp @@ -281,6 +281,33 @@ bool WriteTriangleMeshUsingASSIMP(const std::string& filename, ai_scene->mMaterials = new aiMaterial*[ai_scene->mNumMaterials]; auto ai_mat = new aiMaterial; if (mesh.HasMaterial()) { + ai_mat->GetName().Set("mat1"); + auto shading_mode = aiShadingMode_PBR_BRDF; + ai_mat->AddProperty(&shading_mode, 1, AI_MATKEY_SHADING_MODEL); + + // Set base material properties + if (mesh.GetMaterial().HasBaseColor()) { + auto c = mesh.GetMaterial().GetBaseColor(); + auto ac = aiColor4D(c.x(), c.y(), c.z(), c.w()); + ai_mat->AddProperty(&ac, 1, AI_MATKEY_COLOR_DIFFUSE); + ai_mat->AddProperty(&ac, 1, AI_MATKEY_BASE_COLOR); + } + if (mesh.GetMaterial().HasBaseRoughness()) { + } + if (mesh.GetMaterial().HasBaseMetallic()) { + } + if (mesh.GetMaterial().HasBaseReflectance()) { + } + + // Now set texture maps + if (mesh.GetMaterial().HasAlbedoMap()) { + } + if (mesh.GetMaterial().HasRoughnessMap()) { + } + if (mesh.GetMaterial().HasMetallicMap()) { + } + if (mesh.GetMaterial().HasNormalMap()) { + } } ai_scene->mMaterials[0] = ai_mat;