From a850af674ff578b22775169d42f01ccce0ad519e Mon Sep 17 00:00:00 2001 From: RodZill4 Date: Tue, 7 Jan 2020 22:17:14 +0100 Subject: [PATCH] Added min ad max options to the greyscale node --- addons/material_maker/nodes/greyscale.mmg | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/addons/material_maker/nodes/greyscale.mmg b/addons/material_maker/nodes/greyscale.mmg index 01d0111..7941ae8 100644 --- a/addons/material_maker/nodes/greyscale.mmg +++ b/addons/material_maker/nodes/greyscale.mmg @@ -12,7 +12,7 @@ }, "shader_model": { "code": "", - "global": "float gs_lightness(vec3 c) {\n\treturn 0.5*(max(c.r, max(c.g, c.b)) + min(c.r, min(c.g, c.b)));\n}\nfloat gs_average(vec3 c) {\n\treturn 0.333333333333*(c.r + c.g + c.b);\n}\nfloat gs_luminosity(vec3 c) {\n\treturn 0.21 * c.r + 0.72 * c.g + 0.07 * c.b;\n}\n", + "global": "float gs_min(vec3 c) {\n\treturn min(c.r, min(c.g, c.b));\n}\nfloat gs_max(vec3 c) {\n\treturn max(c.r, max(c.g, c.b));\n}\nfloat gs_lightness(vec3 c) {\n\treturn 0.5*(max(c.r, max(c.g, c.b)) + min(c.r, min(c.g, c.b)));\n}\nfloat gs_average(vec3 c) {\n\treturn 0.333333333333*(c.r + c.g + c.b);\n}\nfloat gs_luminosity(vec3 c) {\n\treturn 0.21 * c.r + 0.72 * c.g + 0.07 * c.b;\n}\n", "inputs": [ { "default": "vec3(0.0)", @@ -31,7 +31,7 @@ ], "parameters": [ { - "default": 2, + "default": 4, "label": "", "name": "mode", "type": "enum", @@ -47,6 +47,14 @@ { "name": "Luminosity", "value": "luminosity" + }, + { + "name": "Min", + "value": "min" + }, + { + "name": "Max", + "value": "max" } ] }