Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c601df1

Browse files
committedNov 7, 2024·
Add a variadic color picker node
1 parent 5dbd41d commit c601df1

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed
 
+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
{
2+
"name": "color_pick",
3+
"node_position": {
4+
"x": 0,
5+
"y": 0
6+
},
7+
"parameters": {
8+
9+
},
10+
"seed_int": 0,
11+
"shader_model": {
12+
"code": "",
13+
"global": "",
14+
"inputs": [
15+
{
16+
"default": "vec3(1.0)",
17+
"label": "",
18+
"longdesc": "The input ID map",
19+
"name": "in",
20+
"shortdesc": "Input",
21+
"type": "rgb"
22+
}
23+
],
24+
"instance": "",
25+
"longdesc": "Pick colors from an input ID map",
26+
"name": "Color Pick",
27+
"outputs": [
28+
{
29+
"f": "1.0 - clamp((dot(abs($in($uv) - $color#.rgb), vec3(1.0/3.0)) - $threshold) / max($falloff, 0.00001), 0.0, 1.0)",
30+
"longdesc": "Output mask corresponding to the picked color",
31+
"shortdesc": "Output #",
32+
"type": "f"
33+
}
34+
],
35+
"parameters": [
36+
{
37+
"default": {
38+
"a": 1,
39+
"b": 1,
40+
"g": 1,
41+
"r": 1
42+
},
43+
"label": "",
44+
"longdesc": "Color to pick from the ID map",
45+
"name": "color#",
46+
"shortdesc": "Color #",
47+
"type": "color"
48+
},
49+
{
50+
"control": "None",
51+
"default": 0.01,
52+
"label": "Threshold",
53+
"longdesc": "Controls the sensitivity of color matching. Higher values will match more colors.",
54+
"max": 1,
55+
"min": 0,
56+
"name": "threshold",
57+
"shortdesc": "Threshold",
58+
"step": 0.01,
59+
"type": "float"
60+
},
61+
{
62+
"control": "None",
63+
"default": 0,
64+
"label": "Falloff",
65+
"longdesc": "Controls the softness of the output mask. Set to 0 to output a binary black/white image.",
66+
"max": 1,
67+
"min": 0,
68+
"name": "falloff",
69+
"shortdesc": "Falloff",
70+
"step": 0.01,
71+
"type": "float"
72+
}
73+
],
74+
"shortdesc": "Pick colors"
75+
},
76+
"type": "shader"
77+
}

‎material_maker/library/base.json

+5
Original file line numberDiff line numberDiff line change
@@ -2751,6 +2751,11 @@
27512751
"tree_item": "Filter/Decompose",
27522752
"type": "decompose"
27532753
},
2754+
{
2755+
"display_name": "Color Pick",
2756+
"tree_item": "Filter/Color Pick",
2757+
"type": "color_pick"
2758+
},
27542759
{
27552760
"display_name": "SwapChannels",
27562761
"icon": "filter_swapchannels",

0 commit comments

Comments
 (0)
Please sign in to comment.