Added proper conversion from sRGB to linear space and added a temporary fix for Blender bug with vertex colors in sRGB
parent
7135a6660b
commit
8f710a24c8
|
@ -247,6 +247,8 @@ void GLTFLoader::ReadMaterials()
|
||||||
color[2].get<float>(),
|
color[2].get<float>(),
|
||||||
0.0
|
0.0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mat.emissiveColor = Gfx::ToLinear(mat.emissiveColor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -283,6 +285,8 @@ void GLTFLoader::ReadMaterials()
|
||||||
color[2].get<float>(),
|
color[2].get<float>(),
|
||||||
color[3].get<float>()
|
color[3].get<float>()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mat.albedoColor = Gfx::ToLinear(mat.albedoColor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -680,6 +684,16 @@ std::vector<glm::u8vec4> GLTFLoader::ReadColors(int index)
|
||||||
GetLogger()->Error("Invalid color type: %d\n", accessor.componentType);
|
GetLogger()->Error("Invalid color type: %d\n", accessor.componentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fix for bug in Blender where it exports vertex colors in sRGB instead of linear space
|
||||||
|
for (size_t i = 0; i < colors.size(); i++)
|
||||||
|
{
|
||||||
|
auto color = Gfx::IntColorToColor(Gfx::IntColor(colors[i]));
|
||||||
|
|
||||||
|
color = Gfx::ToLinear(color);
|
||||||
|
|
||||||
|
colors[i] = Gfx::ColorToIntColor(color);
|
||||||
|
}
|
||||||
|
|
||||||
return colors;
|
return colors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue