Skip to content

Commit

Permalink
Added density input to noise node
Browse files Browse the repository at this point in the history
  • Loading branch information
RodZill4 committed Jan 21, 2024
1 parent 2049199 commit de62a1b
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions addons/material_maker/nodes/noise.mmg
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,22 @@
},
"seed_int": 0,
"shader_model": {
"code": "",
"global": [
"float dots(vec2 uv, float size, float density, float seed) {",
"\tvec2 seed2 = rand2(vec2(seed, 1.0-seed));",
"\tuv /= size;",
"\tvec2 point_pos = floor(uv)+vec2(0.5);",
"\tfloat color = step(rand(seed2+point_pos), density);",
"\treturn color;",
"}"
],
"code": "vec2 $(name_uv)_uv = floor($uv*$size)/$size;",
"global": "",
"inputs": [

],
"instance": [
"",
"\t\tfloat $(name)_f(vec2 uv) {",
"\t\t\treturn dots(uv, 1.0/$(size), $(density), $(seed));",
"\t\t}"
{
"default": "$density",
"label": "2:",
"name": "density_in",
"type": "f"
}
],
"instance": "",
"longdesc": "Generates a grid made of black and white squares",
"name": "Noise",
"outputs": [
{
"f": "$(name)_f($(uv))",
"f": "step(rand($(name_uv)_uv+vec2($seed)), $density_in($(name_uv)_uv))",
"longdesc": "Shows the noise pattern",
"shortdesc": "Output",
"type": "f"
Expand Down

0 comments on commit de62a1b

Please sign in to comment.