Skip to content

Commit

Permalink
GLTF Loader: disable clear coat extension if clear coat factor is zero
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMostDiligent committed Dec 18, 2023
1 parent b6b9426 commit 0a7aea3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions AssetLoader/src/GLTFLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1426,14 +1426,15 @@ void Model::LoadMaterials(const tinygltf::Model& gltf_model, const ModelCreateIn
auto ext_it = gltf_mat.extensions.find("KHR_materials_clearcoat");
if (ext_it != gltf_mat.extensions.end())
{
Mat.HasClearcoat = true;

const auto& ClearcoatExt = ext_it->second;
LoadExtensionTexture(*this, ClearcoatExt, MatBuilder, ClearcoatTextureName);
LoadExtensionTexture(*this, ClearcoatExt, MatBuilder, ClearcoatRoughnessTextureName);
LoadExtensionTexture(*this, ClearcoatExt, MatBuilder, ClearcoatNormalTextureName);
LoadExtensionParameter(ClearcoatExt, "clearcoatFactor", Mat.Attribs.ClearcoatFactor);
LoadExtensionParameter(ClearcoatExt, "clearcoatRoughnessFactor", Mat.Attribs.ClearcoatRoughnessFactor);

// The spec says that clear coat factor is zero, the whole clear coat layer is disabled.
Mat.HasClearcoat = Mat.Attribs.ClearcoatFactor != 0;
}
}

Expand Down

0 comments on commit 0a7aea3

Please sign in to comment.