diff --git a/AssetLoader/interface/GLTFLoader.hpp b/AssetLoader/interface/GLTFLoader.hpp index f7d40953..81608cd0 100644 --- a/AssetLoader/interface/GLTFLoader.hpp +++ b/AssetLoader/interface/GLTFLoader.hpp @@ -220,7 +220,8 @@ struct Material struct TransmissionShaderAttribs { float Factor = 0; - float Padding[3] = {}; + float IOR = 1.5f; + float Padding[2] = {}; }; static_assert(sizeof(TransmissionShaderAttribs) % 16 == 0, "TransmissionShaderAttribs struct must be 16-byte aligned"); std::unique_ptr Transmission; diff --git a/AssetLoader/src/GLTFLoader.cpp b/AssetLoader/src/GLTFLoader.cpp index 64f60b5f..4dabe4d8 100644 --- a/AssetLoader/src/GLTFLoader.cpp +++ b/AssetLoader/src/GLTFLoader.cpp @@ -1874,6 +1874,12 @@ void Model::LoadMaterials(const tinygltf::Model& gltf_model, const ModelCreateIn const tinygltf::Value& TransExt = ext_it->second; LoadExtensionTexture(gltf_model, *this, TransExt, MatBuilder, TransmissionTextureName); LoadExtensionParameter(TransExt, "transmissionFactor", Mat.Transmission->Factor); + + if (auto IorExtIt = gltf_mat.extensions.find("KHR_materials_ior"); + IorExtIt != gltf_mat.extensions.end()) + { + LoadExtensionParameter(IorExtIt->second, "ior", Mat.Transmission->IOR); + } } }