From 649857416dc1080d1b049da22d11a9bc20f84fc4 Mon Sep 17 00:00:00 2001 From: scurest Date: Sat, 7 Jan 2023 16:45:28 -0600 Subject: Mark OBJ vertex colors sRGB in materials (only if has vertex colors) --- editor/import/resource_importer_obj.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp index 5da4659767..f1fd1d5a03 100644 --- a/editor/import/resource_importer_obj.cpp +++ b/editor/import/resource_importer_obj.cpp @@ -373,7 +373,11 @@ static Error _parse_obj(const String &p_path, List> &r_meshes, bool p_ print_verbose("OBJ: Current material " + current_material + " has " + itos(material_map.has(current_material_library) && material_map[current_material_library].has(current_material))); if (material_map.has(current_material_library) && material_map[current_material_library].has(current_material)) { - surf_tool->set_material(material_map[current_material_library][current_material]); + Ref &material = material_map[current_material_library][current_material]; + if (!colors.is_empty()) { + material->set_flag(StandardMaterial3D::FLAG_SRGB_VERTEX_COLOR, true); + } + surf_tool->set_material(material); } mesh = surf_tool->commit(mesh, mesh_flags); -- cgit v1.2.3