From 49b4c20f3a73bbf09b03f43c638273276590836a Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Fri, 28 Jun 2024 20:46:19 +0200 Subject: [PATCH] Preserve existing alpha channel when using Normal Map Invert Y import option While normal maps with RGTC compression cannot contain an alpha channel, it is possible for Godot to read non-RGTC normal maps that can contain an alpha channel that custom shaders can read. The visual output for opaque images (including RGTC normal maps) is unaffected by this change. --- editor/import/resource_importer_texture.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp index 487b8fc175c..4869a44b8c3 100644 --- a/editor/import/resource_importer_texture.cpp +++ b/editor/import/resource_importer_texture.cpp @@ -558,7 +558,7 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { const Color color = target_image->get_pixel(i, j); - target_image->set_pixel(i, j, Color(color.r, 1 - color.g, color.b)); + target_image->set_pixel(i, j, Color(color.r, 1 - color.g, color.b, color.a)); } } }