mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
Adds sRGB support for proper lighting
Currently we're incorrectly using sRGB colors as raw inputs for lighting instead of conversion to linear space. For proper PBR we need linear values.
This commit is contained in:
@@ -103,6 +103,7 @@ CMaterial CMaterialManager::LoadMaterial(const VfsPath& pathname)
|
||||
AT(material);
|
||||
AT(name);
|
||||
AT(pass);
|
||||
AT(srgb);
|
||||
AT(value);
|
||||
#undef AT
|
||||
#undef EL
|
||||
@@ -161,7 +162,8 @@ CMaterial CMaterialManager::LoadMaterial(const VfsPath& pathname)
|
||||
}
|
||||
else if (token == el_required_texture)
|
||||
{
|
||||
material.AddRequiredSampler(attrs.GetNamedItem(at_name));
|
||||
const bool sRGB{attrs.GetNamedItem(at_srgb) == "true"};
|
||||
material.AddRequiredSampler({CStrIntern{attrs.GetNamedItem(at_name)}, sRGB});
|
||||
if (!attrs.GetNamedItem(at_define).empty())
|
||||
material.AddShaderDefine(CStrIntern(attrs.GetNamedItem(at_define)), str_1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user