From a9cf78dc8f9d9f79d50252c72de085e6ae22c85e Mon Sep 17 00:00:00 2001 From: Nate Koenig Date: Wed, 20 Jan 2021 18:36:54 -0800 Subject: [PATCH] Fix finding PBR materials (#575) Signed-off-by: Nate Koenig Co-authored-by: Nate Koenig --- src/rendering/SceneManager.cc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/rendering/SceneManager.cc b/src/rendering/SceneManager.cc index 54fb330aa9..3804ea8f55 100644 --- a/src/rendering/SceneManager.cc +++ b/src/rendering/SceneManager.cc @@ -458,7 +458,8 @@ rendering::MaterialPtr SceneManager::LoadMaterial( std::string roughnessMap = metal->RoughnessMap(); if (!roughnessMap.empty()) { - std::string fullPath = common::findFile(roughnessMap); + std::string fullPath = common::findFile( + asFullPath(roughnessMap, _material.FilePath())); if (!fullPath.empty()) material->SetRoughnessMap(fullPath); else @@ -469,7 +470,8 @@ rendering::MaterialPtr SceneManager::LoadMaterial( std::string metalnessMap = metal->MetalnessMap(); if (!metalnessMap.empty()) { - std::string fullPath = common::findFile(metalnessMap); + std::string fullPath = common::findFile( + asFullPath(metalnessMap, _material.FilePath())); if (!fullPath.empty()) material->SetMetalnessMap(fullPath); else @@ -487,7 +489,8 @@ rendering::MaterialPtr SceneManager::LoadMaterial( std::string albedoMap = workflow->AlbedoMap(); if (!albedoMap.empty()) { - std::string fullPath = common::findFile(albedoMap); + std::string fullPath = common::findFile( + asFullPath(albedoMap, _material.FilePath())); if (!fullPath.empty()) { material->SetTexture(fullPath); @@ -502,7 +505,8 @@ rendering::MaterialPtr SceneManager::LoadMaterial( std::string normalMap = workflow->NormalMap(); if (!normalMap.empty()) { - std::string fullPath = common::findFile(normalMap); + std::string fullPath = common::findFile( + asFullPath(normalMap, _material.FilePath())); if (!fullPath.empty()) material->SetNormalMap(fullPath); else @@ -514,7 +518,8 @@ rendering::MaterialPtr SceneManager::LoadMaterial( std::string environmentMap = workflow->EnvironmentMap(); if (!environmentMap.empty()) { - std::string fullPath = common::findFile(environmentMap); + std::string fullPath = common::findFile( + asFullPath(environmentMap, _material.FilePath())); if (!fullPath.empty()) material->SetEnvironmentMap(fullPath); else @@ -525,7 +530,8 @@ rendering::MaterialPtr SceneManager::LoadMaterial( std::string emissiveMap = workflow->EmissiveMap(); if (!emissiveMap.empty()) { - std::string fullPath = common::findFile(emissiveMap); + std::string fullPath = common::findFile( + asFullPath(emissiveMap, _material.FilePath())); if (!fullPath.empty()) material->SetEmissiveMap(fullPath); else