SaschaWillems / Vulkan-glTF-PBR

Physical based rendering with Vulkan using glTF 2.0 models
MIT License
915 stars 124 forks source link

Materials PBR loading in VulkanglTFModel.cpp #55

Closed alexkh closed 2 years ago

alexkh commented 2 years ago

What is going on in VulkanglTFModel.cpp?

            if (mat.additionalValues.find("emissiveFactor") != mat.additionalValues.end()) {
                material.emissiveFactor = glm::vec4(glm::make_vec3(mat.additionalValues["emissiveFactor"].ColorFactor().data()), 1.0);
                material.emissiveFactor = glm::vec4(0.0f);
            }

first, a vec4 is created, then a new vec4 filled with zeroes is created? Why?

Will the following do the trick?

        material.emissiveFactor = glm::vec4(mat.emissiveFactor[0],
            mat.emissiveFactor[1], mat.emissiveFactor[2], 1.0);
SaschaWillems commented 2 years ago

That's most probably unintentional. Will take a look at this.