From 186920e8d0aa8c3447ec08f952d66f0e0be3a9a3 Mon Sep 17 00:00:00 2001 From: Philip Rideout Date: Fri, 22 Feb 2019 15:26:54 -0800 Subject: [PATCH] Fix up emissive energy compensation for glTF. --- samples/app/MeshAssimp.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/samples/app/MeshAssimp.cpp b/samples/app/MeshAssimp.cpp index 6a98751767f..cd32c0c3c80 100644 --- a/samples/app/MeshAssimp.cpp +++ b/samples/app/MeshAssimp.cpp @@ -144,8 +144,12 @@ std::string shaderFromConfig(MaterialConfig config) { material.roughness = materialParams.roughnessFactor * metallicRoughness.g; material.metallic = materialParams.metallicFactor * metallicRoughness.b; material.ambientOcclusion = texture(materialParams_aoMap, aoUV).r; - material.emissive = texture(materialParams_emissiveMap, emissiveUV); + material.emissive.rgb = texture(materialParams_emissiveMap, emissiveUV).rgb; material.emissive.rgb *= materialParams.emissiveFactor.rgb; + + // The opinionated lighting model specified by glTF does not account for energy + // compensation, using this value basically disables it: + material.emissive.a = 3.0; )SHADER"; }