From 156d9d16431274fb9556fdabac2cd8b8cfadd7d6 Mon Sep 17 00:00:00 2001 From: Markus Sauermann <6299227+Sauermann@users.noreply.github.com> Date: Sun, 20 Feb 2022 18:36:46 +0100 Subject: [PATCH] simplify calculation of max in grayscale (cherry picked from commit 79a75cd68337820a3ae7e5f1f556bbebab138dd8) --- scene/resources/visual_shader_nodes.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scene/resources/visual_shader_nodes.cpp b/scene/resources/visual_shader_nodes.cpp index c7bf965d4f9..815e9a36078 100644 --- a/scene/resources/visual_shader_nodes.cpp +++ b/scene/resources/visual_shader_nodes.cpp @@ -1796,8 +1796,7 @@ String VisualShaderNodeColorFunc::generate_code(Shader::Mode p_mode, VisualShade code += "\t\tvec3 c = " + p_input_vars[0] + ";\n"; code += "\t\tfloat max1 = max(c.r, c.g);\n"; code += "\t\tfloat max2 = max(max1, c.b);\n"; - code += "\t\tfloat max3 = max(max1, max2);\n"; - code += "\t\t" + p_output_vars[0] + " = vec3(max3, max3, max3);\n"; + code += "\t\t" + p_output_vars[0] + " = vec3(max2, max2, max2);\n"; code += "\t}\n"; break; case FUNC_SEPIA: