diff --git a/base/Sources/arm/shader/MaterialParser.hx b/base/Sources/arm/shader/MaterialParser.hx index aa3fdeaa7..df6f9583b 100644 --- a/base/Sources/arm/shader/MaterialParser.hx +++ b/base/Sources/arm/shader/MaterialParser.hx @@ -685,6 +685,14 @@ class MaterialParser { var col = parse_vector_input(node.inputs[1]); return '(floor(100.0 * $strength * $col) / (100.0 * $strength))'; } + else if (node.type == "REPLACECOL") { + var inputColor = parse_vector_input(node.inputs[0]); + var oldColor = parse_vector_input(node.inputs[1]); + var newColor = parse_vector_input(node.inputs[2]); + var radius = parse_value_input(node.inputs[3]); + var fuzziness = parse_value_input(node.inputs[4]); + return 'mix($newColor, $inputColor, clamp((distance($oldColor, $inputColor) - $radius) / max($fuzziness, $eps), 0.0, 1.0))'; + } else if (node.type == "VALTORGB") { // ColorRamp var fac = parse_value_input(node.inputs[0]); var interp = node.buttons[0].data == 0 ? "LINEAR" : "CONSTANT"; diff --git a/base/Sources/arm/shader/NodesMaterial.hx b/base/Sources/arm/shader/NodesMaterial.hx index ede446ed6..4db74e175 100644 --- a/base/Sources/arm/shader/NodesMaterial.hx +++ b/base/Sources/arm/shader/NodesMaterial.hx @@ -1758,6 +1758,7 @@ class NodesMaterial { }, { name: _tr("use_clamp"), + tooltip: _tr("Clamps the output value to the interval [0,1]."), type: "BOOL", default_value: false, output: 0 @@ -1767,6 +1768,7 @@ class NodesMaterial { { id: 0, name: _tr("Quantize"), + tooltip: _tr("Creates a posterization effect."), type: "QUANTIZE", x: 0, y: 0, @@ -1803,6 +1805,73 @@ class NodesMaterial { ], buttons: [] }, + { + id: 0, + name: _tr("Replace Color"), + type: "REPLACECOL", + x: 0, + y: 0, + color: 0xff62676d, + inputs: [ + { + id: 0, + node_id: 0, + name: _tr("Color"), + type: "RGBA", + color: 0xffc7c729, + default_value: f32([0.8, 0.8, 0.8, 1.0]) + }, + { + id: 0, + node_id: 0, + name: _tr("Old Color"), + tooltip: _tr("Color to replace."), + type: "RGBA", + color: 0xffc7c729, + default_value: f32([0.8, 0.8, 0.8, 1.0]) + }, + { + id: 0, + node_id: 0, + name: _tr("New Color"), + tooltip: _tr("The replacement color."), + type: "RGBA", + color: 0xffc7c729, + default_value: f32([0.8, 0.8, 0.8, 1.0]) + }, + { + id: 0, + node_id: 0, + name: _tr("Radius"), + tooltip: _tr("Replace colors within this range."), + type: "VALUE", + color: 0xffa1a1a1, + default_value: 0.1, + min: 0.0, + max: 1.74 + }, + { + id: 0, + node_id: 0, + name: _tr("Fuzziness"), + tooltip: _tr("Soften edges around replaced regions."), + type: "VALUE", + color: 0xffa1a1a1, + default_value: 0.0 + } + ], + outputs: [ + { + id: 0, + node_id: 0, + name: _tr("Color"), + type: "RGBA", + color: 0xffc7c729, + default_value: f32([0.8, 0.8, 0.8, 1.0]) + } + ], + buttons: [] + }, { id: 0, name: _tr("Warp"), @@ -1857,6 +1926,7 @@ class NodesMaterial { { id: 0, name: _tr("Bump"), + tooltip: _tr("Generates a normal map from a height texture."), type: "BUMP", x: 0, y: 0, @@ -1874,6 +1944,7 @@ class NodesMaterial { id: 0, node_id: 0, name: _tr("Distance"), + tooltip: _tr("Currently not implemented."), type: "VALUE", color: 0xffa1a1a1, default_value: 0.0 @@ -1882,6 +1953,7 @@ class NodesMaterial { id: 0, node_id: 0, name: _tr("Height"), + tooltip: _tr("Scalar value-typically a height map texture-giving the height offset from the surface."), type: "VALUE", color: 0xffa1a1a1, default_value: 1.0 @@ -1910,6 +1982,7 @@ class NodesMaterial { { id: 0, name: _tr("Mapping"), + tooltip: _tr("Transforms the input vector by applying translation, rotation, and scaling."), type: "MAPPING", x: 0, y: 0, @@ -2002,6 +2075,7 @@ class NodesMaterial { buttons: [ { name: _tr("blend_type"), + tooltip: _tr("Blending method"), type: "ENUM", data: [_tr("Partial Derivative"), _tr("Whiteout"), _tr("Reoriented")], default_value: 0, @@ -2142,6 +2216,7 @@ class NodesMaterial { { id: 0, name: _tr("Clamp"), + tooltip: _tr("Clamps a value between a minimum and a maximum."), type: "CLAMP", x: 0, y: 0, @@ -2241,6 +2316,7 @@ class NodesMaterial { { id: 0, name: _tr("Color Mask"), + tooltip: _tr("Generates a mask from color values-typically a texture-equal to mask color."), type: "COLMASK", x: 0, y: 0, @@ -2258,6 +2334,7 @@ class NodesMaterial { id: 0, node_id: 0, name: _tr("Mask Color"), + tooltip: _tr("Color to use for mask."), type: "RGBA", color: 0xffc7c729, default_value: f32([0.8, 0.8, 0.8, 1.0]) @@ -2266,6 +2343,7 @@ class NodesMaterial { id: 0, node_id: 0, name: _tr("Radius"), + tooltip: _tr("Select colors within this range from input Mask Color."), type: "VALUE", color: 0xffa1a1a1, default_value: 0.1, @@ -2276,6 +2354,7 @@ class NodesMaterial { id: 0, node_id: 0, name: _tr("Fuzziness"), + tooltip: _tr("Feather edges around selection. Higher values result in a softer mask."), type: "VALUE", color: 0xffa1a1a1, default_value: 0.0 @@ -2490,6 +2569,7 @@ class NodesMaterial { buttons: [ { name: _tr("use_clamp"), + tooltip: _tr("Clamps the output value to the interval [0,1]."), type: "BOOL", default_value: false, output: 0 @@ -2541,6 +2621,7 @@ class NodesMaterial { }, { name: _tr("use_clamp"), + tooltip: _tr("Clamps the output value to the interval [0,1]."), type: "BOOL", default_value: false, output: 0