From 79baea6a2fc5f7524161c5ca602ede1b26b10413 Mon Sep 17 00:00:00 2001 From: Tanasart Date: Mon, 10 Jun 2024 15:02:51 +0700 Subject: [PATCH] - [Supporter] New Honeycomb noise node. --- PixelComposer.resource_order | 24 +++- PixelComposer.yyp | 4 +- scripts/node_honey_noise/node_gradient.yy | 12 ++ scripts/node_honey_noise/node_honey_noise.gml | 37 ++++++ scripts/node_honey_noise/node_honey_noise.yy | 13 ++ scripts/node_registry/node_registry.gml | 1 + shaders/sh_ani_noise/sh_ani_noise.yy | 2 +- shaders/sh_noise/sh_noise.yy | 2 +- shaders/sh_noise_bubble/sh_noise_bubble.yy | 2 +- shaders/sh_noise_cristal/sh_noise_cristal.yy | 2 +- shaders/sh_noise_fbm/sh_noise_fbm.yy | 2 +- shaders/sh_noise_flow/sh_noise_flow.yy | 2 +- shaders/sh_noise_fold/sh_noise_fold.yy | 2 +- shaders/sh_noise_gabor/sh_noise_gabor.yy | 2 +- .../sh_noise_grid_hex/sh_noise_grid_hex.yy | 2 +- .../sh_noise_grid_tri/sh_noise_grid_tri.yy | 2 +- shaders/sh_noise_honey/sh_noise_honey.fsh | 112 ++++++++++++++++++ shaders/sh_noise_honey/sh_noise_honey.vsh | 19 +++ shaders/sh_noise_honey/sh_noise_honey.yy | 12 ++ shaders/sh_noise_shard/sh_noise_shard.yy | 2 +- shaders/sh_noise_strand/sh_noise_strand.yy | 2 +- shaders/sh_noise_wavelet/sh_noise_wavelet.yy | 2 +- shaders/sh_perlin/sh_perlin.yy | 2 +- shaders/sh_perlin_extra/sh_perlin_extra.yy | 2 +- shaders/sh_perlin_smear/sh_perlin_smear.yy | 2 +- shaders/sh_perlin_tiled/sh_perlin_tiled.yy | 2 +- shaders/sh_simplex/sh_simplex.yy | 2 +- shaders/sh_voronoi_extra/sh_voronoi_extra.yy | 2 +- 28 files changed, 249 insertions(+), 23 deletions(-) create mode 100644 scripts/node_honey_noise/node_gradient.yy create mode 100644 scripts/node_honey_noise/node_honey_noise.gml create mode 100644 scripts/node_honey_noise/node_honey_noise.yy create mode 100644 shaders/sh_noise_honey/sh_noise_honey.fsh create mode 100644 shaders/sh_noise_honey/sh_noise_honey.vsh create mode 100644 shaders/sh_noise_honey/sh_noise_honey.yy diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index 4c50e7f8b..8343f7d84 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -136,9 +136,16 @@ {"name":"components","order":3,"path":"folders/panels/inspectors/components.yy",}, {"name":"overlay","order":6,"path":"folders/panels/preview/overlay.yy",}, {"name":"sprites","order":7,"path":"folders/panels/preview/sprites.yy",}, + {"name":"3d","order":1,"path":"folders/shader/3d.yy",}, {"name":"2d effect","order":12,"path":"folders/shader/3d/2d effect.yy",}, {"name":"legacy","order":13,"path":"folders/shader/3d/legacy.yy",}, {"name":"ssao","order":14,"path":"folders/shader/3d/ssao.yy",}, + {"name":"blend","order":2,"path":"folders/shader/blend.yy",}, + {"name":"canvas","order":3,"path":"folders/shader/canvas.yy",}, + {"name":"color_picker","order":4,"path":"folders/shader/color_picker.yy",}, + {"name":"color_selector","order":5,"path":"folders/shader/color_selector.yy",}, + {"name":"draw","order":6,"path":"folders/shader/draw.yy",}, + {"name":"filter","order":7,"path":"folders/shader/filter.yy",}, {"name":"blend_edge","order":40,"path":"folders/shader/filter/blend_edge.yy",}, {"name":"blur","order":50,"path":"folders/shader/filter/blur.yy",}, {"name":"channels","order":41,"path":"folders/shader/filter/channels.yy",}, @@ -152,20 +159,29 @@ {"name":"shape_seperator","order":47,"path":"folders/shader/filter/shape_seperator.yy",}, {"name":"surface_replace","order":48,"path":"folders/shader/filter/surface_replace.yy",}, {"name":"warp","order":49,"path":"folders/shader/filter/warp.yy",}, + {"name":"flood_fill","order":8,"path":"folders/shader/flood_fill.yy",}, + {"name":"generator","order":9,"path":"folders/shader/generator.yy",}, {"name":"blinker","order":19,"path":"folders/shader/generator/blinker.yy",}, {"name":"cell","order":20,"path":"folders/shader/generator/cell.yy",}, {"name":"grid","order":18,"path":"folders/shader/generator/grid.yy",}, {"name":"interpret","order":17,"path":"folders/shader/generator/interpret.yy",}, - {"name":"noise","order":16,"path":"folders/shader/generator/noise.yy",}, + {"name":"noise","order":19,"path":"folders/shader/noise.yy",}, {"name":"random_shape","order":21,"path":"folders/shader/generator/random_shape.yy",}, {"name":"reaction_diffusion","order":22,"path":"folders/shader/generator/reaction_diffusion.yy",}, {"name":"region","order":23,"path":"folders/shader/generator/region.yy",}, {"name":"vector_mapper","order":24,"path":"folders/shader/generator/vector_mapper.yy",}, + {"name":"mask","order":10,"path":"folders/shader/mask.yy",}, + {"name":"misc","order":11,"path":"folders/shader/misc.yy",}, {"name":"find_boundary","order":7,"path":"folders/shader/misc/find_boundary.yy",}, + {"name":"MK effects","order":12,"path":"folders/shader/MK effects.yy",}, {"name":"Flag","order":3,"path":"folders/shader/MK effects/Flag.yy",}, {"name":"Tile","order":4,"path":"folders/shader/MK effects/Tile.yy",}, - {"name":"ray march","order":1,"path":"folders/shader/ray march.yy",}, - {"name":"svg","order":2,"path":"folders/shader/svg.yy",}, + {"name":"pixel_builder","order":13,"path":"folders/shader/pixel_builder.yy",}, + {"name":"ray march","order":17,"path":"folders/shader/ray march.yy",}, + {"name":"sprites","order":14,"path":"folders/shader/sprites.yy",}, + {"name":"svg","order":18,"path":"folders/shader/svg.yy",}, + {"name":"transition","order":15,"path":"folders/shader/transition.yy",}, + {"name":"UI","order":16,"path":"folders/shader/UI.yy",}, {"name":"histogram","order":3,"path":"folders/shader/UI/histogram.yy",}, {"name":"node","order":5,"path":"folders/shader/UI/node.yy",}, {"name":"palette mixer","order":2,"path":"folders/shader/UI/palette mixer.yy",}, @@ -797,6 +813,7 @@ {"name":"node_guide","order":10,"path":"scripts/node_guide/node_guide.yy",}, {"name":"node_herringbone_tile","order":7,"path":"scripts/node_herringbone_tile/node_herringbone_tile.yy",}, {"name":"node_hlsl","order":13,"path":"scripts/node_hlsl/node_hlsl.yy",}, + {"name":"node_honey_noise","order":20,"path":"scripts/node_honey_noise/node_honey_noise.yy",}, {"name":"node_hsv_channel","order":1,"path":"scripts/node_hsv_channel/node_hsv_channel.yy",}, {"name":"node_image_animated","order":1,"path":"scripts/node_image_animated/node_image_animated.yy",}, {"name":"node_image_gif","order":2,"path":"scripts/node_image_gif/node_image_gif.yy",}, @@ -1450,6 +1467,7 @@ {"name":"sh_noise_gabor","order":6,"path":"shaders/sh_noise_gabor/sh_noise_gabor.yy",}, {"name":"sh_noise_grid_hex","order":7,"path":"shaders/sh_noise_grid_hex/sh_noise_grid_hex.yy",}, {"name":"sh_noise_grid_tri","order":8,"path":"shaders/sh_noise_grid_tri/sh_noise_grid_tri.yy",}, + {"name":"sh_noise_honey","order":19,"path":"shaders/sh_noise_honey/sh_noise_honey.yy",}, {"name":"sh_noise_shard","order":9,"path":"shaders/sh_noise_shard/sh_noise_shard.yy",}, {"name":"sh_noise_strand","order":10,"path":"shaders/sh_noise_strand/sh_noise_strand.yy",}, {"name":"sh_noise_wavelet","order":11,"path":"shaders/sh_noise_wavelet/sh_noise_wavelet.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 4393d649d..8d8000a6a 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -287,7 +287,7 @@ {"$GMFolder":"","%Name":"cell","folderPath":"folders/shader/generator/cell.yy","name":"cell","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"grid","folderPath":"folders/shader/generator/grid.yy","name":"grid","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"interpret","folderPath":"folders/shader/generator/interpret.yy","name":"interpret","resourceType":"GMFolder","resourceVersion":"2.0",}, - {"$GMFolder":"","%Name":"noise","folderPath":"folders/shader/generator/noise.yy","name":"noise","resourceType":"GMFolder","resourceVersion":"2.0",}, + {"$GMFolder":"","%Name":"noise","folderPath":"folders/shader/noise.yy","name":"noise","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"random_shape","folderPath":"folders/shader/generator/random_shape.yy","name":"random_shape","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"reaction_diffusion","folderPath":"folders/shader/generator/reaction_diffusion.yy","name":"reaction_diffusion","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"region","folderPath":"folders/shader/generator/region.yy","name":"region","resourceType":"GMFolder","resourceVersion":"2.0",}, @@ -1219,6 +1219,7 @@ {"id":{"name":"node_guide","path":"scripts/node_guide/node_guide.yy",},}, {"id":{"name":"node_herringbone_tile","path":"scripts/node_herringbone_tile/node_herringbone_tile.yy",},}, {"id":{"name":"node_hlsl","path":"scripts/node_hlsl/node_hlsl.yy",},}, + {"id":{"name":"node_honey_noise","path":"scripts/node_honey_noise/node_honey_noise.yy",},}, {"id":{"name":"node_hsv_channel","path":"scripts/node_hsv_channel/node_hsv_channel.yy",},}, {"id":{"name":"node_image_animated","path":"scripts/node_image_animated/node_image_animated.yy",},}, {"id":{"name":"node_image_gif","path":"scripts/node_image_gif/node_image_gif.yy",},}, @@ -1978,6 +1979,7 @@ {"id":{"name":"sh_noise_gabor","path":"shaders/sh_noise_gabor/sh_noise_gabor.yy",},}, {"id":{"name":"sh_noise_grid_hex","path":"shaders/sh_noise_grid_hex/sh_noise_grid_hex.yy",},}, {"id":{"name":"sh_noise_grid_tri","path":"shaders/sh_noise_grid_tri/sh_noise_grid_tri.yy",},}, + {"id":{"name":"sh_noise_honey","path":"shaders/sh_noise_honey/sh_noise_honey.yy",},}, {"id":{"name":"sh_noise_shard","path":"shaders/sh_noise_shard/sh_noise_shard.yy",},}, {"id":{"name":"sh_noise_strand","path":"shaders/sh_noise_strand/sh_noise_strand.yy",},}, {"id":{"name":"sh_noise_wavelet","path":"shaders/sh_noise_wavelet/sh_noise_wavelet.yy",},}, diff --git a/scripts/node_honey_noise/node_gradient.yy b/scripts/node_honey_noise/node_gradient.yy new file mode 100644 index 000000000..fa813bb58 --- /dev/null +++ b/scripts/node_honey_noise/node_gradient.yy @@ -0,0 +1,12 @@ +{ + "isDnD": false, + "isCompatibility": false, + "parent": { + "name": "generator", + "path": "folders/nodes/data/generator.yy", + }, + "resourceVersion": "1.0", + "name": "node_gradient", + "tags": [], + "resourceType": "GMScript", +} \ No newline at end of file diff --git a/scripts/node_honey_noise/node_honey_noise.gml b/scripts/node_honey_noise/node_honey_noise.gml new file mode 100644 index 000000000..a9edd659d --- /dev/null +++ b/scripts/node_honey_noise/node_honey_noise.gml @@ -0,0 +1,37 @@ +function Node_Honeycomb_Noise(_x, _y, _group = noone) : Node_Shader_Generator(_x, _y, _group) constructor { + name = "Honeycomb Noise"; + shader = sh_noise_honey; + + inputs[| 1] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) + .setDisplay(VALUE_DISPLAY.vector) + .setUnitRef(function(index) { return getDimension(index); }); + addShaderProp(SHADER_UNIFORM.float, "position"); + + inputs[| 2] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 2, 2 ]) + .setDisplay(VALUE_DISPLAY.vector); + addShaderProp(SHADER_UNIFORM.float, "scale"); + + inputs[| 3] = nodeValue("Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + .setDisplay(VALUE_DISPLAY.rotation); + addShaderProp(SHADER_UNIFORM.float, "rotation"); + + inputs[| 4] = nodeValue("Mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_button, [ "Hexagon", "Star" ]); + addShaderProp(SHADER_UNIFORM.integer, "mode"); + + inputs[| 5] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6)) + .setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 5].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) }) + addShaderProp(SHADER_UNIFORM.float, "seed"); + + inputs[| 6] = nodeValue("Iteration", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1); + addShaderProp(SHADER_UNIFORM.integer, "iteration"); + + input_display_list = [ 5, + ["Output", true], 0, + ["Noise", false], 1, 2, 3, 4, 6. + ]; + + static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { + inputs[| 1].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny); + } +} \ No newline at end of file diff --git a/scripts/node_honey_noise/node_honey_noise.yy b/scripts/node_honey_noise/node_honey_noise.yy new file mode 100644 index 000000000..9fa760b09 --- /dev/null +++ b/scripts/node_honey_noise/node_honey_noise.yy @@ -0,0 +1,13 @@ +{ + "$GMScript":"", + "%Name":"node_honey_noise", + "isCompatibility":false, + "isDnD":false, + "name":"node_honey_noise", + "parent":{ + "name":"noise", + "path":"folders/nodes/data/generator/noise.yy", + }, + "resourceType":"GMScript", + "resourceVersion":"2.0", +} \ No newline at end of file diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index ed7d1fdbd..c1fd98066 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -725,6 +725,7 @@ function __initNodes() { addNodeObject(generator, "Bubble Noise", s_node_bubble_noise, "Node_Noise_Bubble", [1, Node_Noise_Bubble]).patreonExtra(); addNodeObject(generator, "Flow Noise", s_node_flow_noise, "Node_Flow_Noise", [1, Node_Flow_Noise]).patreonExtra(); addNodeObject(generator, "Cristal Noise", s_node_cristal, "Node_Noise_Cristal", [1, Node_Noise_Cristal]).patreonExtra(); + addNodeObject(generator, "Honeycomb Noise", s_node_honey, "Node_Honeycomb_Noise", [1, Node_Honeycomb_Noise]).patreonExtra(); ds_list_add(generator, "Patterns"); addNodeObject(generator, "Stripe", s_node_stripe, "Node_Stripe", [1, Node_Stripe],, "Generate stripe pattern."); diff --git a/shaders/sh_ani_noise/sh_ani_noise.yy b/shaders/sh_ani_noise/sh_ani_noise.yy index dceebef4b..3b248891f 100644 --- a/shaders/sh_ani_noise/sh_ani_noise.yy +++ b/shaders/sh_ani_noise/sh_ani_noise.yy @@ -4,7 +4,7 @@ "name":"sh_ani_noise", "parent":{ "name":"noise", - "path":"folders/shader/generator/noise.yy", + "path":"folders/shader/noise.yy", }, "resourceType":"GMShader", "resourceVersion":"2.0", diff --git a/shaders/sh_noise/sh_noise.yy b/shaders/sh_noise/sh_noise.yy index c61961bb8..28c4e857f 100644 --- a/shaders/sh_noise/sh_noise.yy +++ b/shaders/sh_noise/sh_noise.yy @@ -4,7 +4,7 @@ "name":"sh_noise", "parent":{ "name":"noise", - "path":"folders/shader/generator/noise.yy", + "path":"folders/shader/noise.yy", }, "resourceType":"GMShader", "resourceVersion":"2.0", diff --git a/shaders/sh_noise_bubble/sh_noise_bubble.yy b/shaders/sh_noise_bubble/sh_noise_bubble.yy index e19de5ba6..fb2d8586d 100644 --- a/shaders/sh_noise_bubble/sh_noise_bubble.yy +++ b/shaders/sh_noise_bubble/sh_noise_bubble.yy @@ -4,7 +4,7 @@ "name":"sh_noise_bubble", "parent":{ "name":"noise", - "path":"folders/shader/generator/noise.yy", + "path":"folders/shader/noise.yy", }, "resourceType":"GMShader", "resourceVersion":"2.0", diff --git a/shaders/sh_noise_cristal/sh_noise_cristal.yy b/shaders/sh_noise_cristal/sh_noise_cristal.yy index a81a48308..8cb477a51 100644 --- a/shaders/sh_noise_cristal/sh_noise_cristal.yy +++ b/shaders/sh_noise_cristal/sh_noise_cristal.yy @@ -4,7 +4,7 @@ "name":"sh_noise_cristal", "parent":{ "name":"noise", - "path":"folders/shader/generator/noise.yy", + "path":"folders/shader/noise.yy", }, "resourceType":"GMShader", "resourceVersion":"2.0", diff --git a/shaders/sh_noise_fbm/sh_noise_fbm.yy b/shaders/sh_noise_fbm/sh_noise_fbm.yy index 3e5f37090..25c06f8f0 100644 --- a/shaders/sh_noise_fbm/sh_noise_fbm.yy +++ b/shaders/sh_noise_fbm/sh_noise_fbm.yy @@ -4,7 +4,7 @@ "name":"sh_noise_fbm", "parent":{ "name":"noise", - "path":"folders/shader/generator/noise.yy", + "path":"folders/shader/noise.yy", }, "resourceType":"GMShader", "resourceVersion":"2.0", diff --git a/shaders/sh_noise_flow/sh_noise_flow.yy b/shaders/sh_noise_flow/sh_noise_flow.yy index 9e44ed5ad..029a03aae 100644 --- a/shaders/sh_noise_flow/sh_noise_flow.yy +++ b/shaders/sh_noise_flow/sh_noise_flow.yy @@ -4,7 +4,7 @@ "name":"sh_noise_flow", "parent":{ "name":"noise", - "path":"folders/shader/generator/noise.yy", + "path":"folders/shader/noise.yy", }, "resourceType":"GMShader", "resourceVersion":"2.0", diff --git a/shaders/sh_noise_fold/sh_noise_fold.yy b/shaders/sh_noise_fold/sh_noise_fold.yy index 4672dd01c..0fe5bf7ae 100644 --- a/shaders/sh_noise_fold/sh_noise_fold.yy +++ b/shaders/sh_noise_fold/sh_noise_fold.yy @@ -4,7 +4,7 @@ "name":"sh_noise_fold", "parent":{ "name":"noise", - "path":"folders/shader/generator/noise.yy", + "path":"folders/shader/noise.yy", }, "resourceType":"GMShader", "resourceVersion":"2.0", diff --git a/shaders/sh_noise_gabor/sh_noise_gabor.yy b/shaders/sh_noise_gabor/sh_noise_gabor.yy index 9a7984ebc..9c97c41c8 100644 --- a/shaders/sh_noise_gabor/sh_noise_gabor.yy +++ b/shaders/sh_noise_gabor/sh_noise_gabor.yy @@ -4,7 +4,7 @@ "name":"sh_noise_gabor", "parent":{ "name":"noise", - "path":"folders/shader/generator/noise.yy", + "path":"folders/shader/noise.yy", }, "resourceType":"GMShader", "resourceVersion":"2.0", diff --git a/shaders/sh_noise_grid_hex/sh_noise_grid_hex.yy b/shaders/sh_noise_grid_hex/sh_noise_grid_hex.yy index 29975dc61..8b3918e80 100644 --- a/shaders/sh_noise_grid_hex/sh_noise_grid_hex.yy +++ b/shaders/sh_noise_grid_hex/sh_noise_grid_hex.yy @@ -4,7 +4,7 @@ "name":"sh_noise_grid_hex", "parent":{ "name":"noise", - "path":"folders/shader/generator/noise.yy", + "path":"folders/shader/noise.yy", }, "resourceType":"GMShader", "resourceVersion":"2.0", diff --git a/shaders/sh_noise_grid_tri/sh_noise_grid_tri.yy b/shaders/sh_noise_grid_tri/sh_noise_grid_tri.yy index 5059639dd..3abb38b81 100644 --- a/shaders/sh_noise_grid_tri/sh_noise_grid_tri.yy +++ b/shaders/sh_noise_grid_tri/sh_noise_grid_tri.yy @@ -4,7 +4,7 @@ "name":"sh_noise_grid_tri", "parent":{ "name":"noise", - "path":"folders/shader/generator/noise.yy", + "path":"folders/shader/noise.yy", }, "resourceType":"GMShader", "resourceVersion":"2.0", diff --git a/shaders/sh_noise_honey/sh_noise_honey.fsh b/shaders/sh_noise_honey/sh_noise_honey.fsh new file mode 100644 index 000000000..fda5ed4d2 --- /dev/null +++ b/shaders/sh_noise_honey/sh_noise_honey.fsh @@ -0,0 +1,112 @@ +//Honeycomb Noise by foxes +//https://www.shadertoy.com/view/ltsSW7 + +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +uniform vec2 u_resolution; +uniform vec2 position; +uniform float rotation; +uniform vec2 scale; +uniform float seed; + +uniform int mode; +uniform int iteration; + +float hash(float x) { return fract(fract(x * (0.3183098861 + seed / 100000.)) * fract(x * (0.15915494309 + seed / 100000.)) * 265871.1723); } +vec3 hash(vec3 x) { return fract(fract(x * (0.3183098861 + seed / 100000.)) * fract(x * (0.15915494309 + seed / 100000.)) * 265871.1723); } + +float hash2(vec2 x) { return hash(dot(mod(x, 100.0), vec2(127.1, 311.7))); } +vec3 hash3x2(vec2 x1,vec2 x2,vec2 x3) { return hash(vec3(dot(mod(x1, 100.0), vec2(127.1, 311.7)), + dot(mod(x2, 100.0), vec2(127.1, 311.7)), + dot(mod(x3, 100.0), vec2(127.1, 311.7)) )); } + +vec4 hash4( vec4 n ) { return fract(sin(n) * (753.5453123 + seed / 100000.)); } + +float noise2( vec2 x ) { + vec3 p = floor(vec3(x, x.y + 0.5)); + vec3 f = fract(vec3(x, x.y + 0.5)); + + float n = p.x + p.y * 157.0; + vec4 s1 = hash4(vec4(n) + vec4(0.0, 1.0, 157.0, 158.0)); + s1.xy = mix(s1.xz, s1.yw, vec2(f.x)); + + return mix(s1.x, s1.y, f.y); +} + +float noiseHoneycomb(vec2 i) { + vec2 c3; + i.x *= 1.15470053837925; + c3.x = floor(i.x) + 1.0; + + vec2 b = vec2(i.y + i.x * 0.5, i.y - i.x * 0.5); + c3.y = floor(b.x) + floor(b.y); + vec3 o = fract(vec3(i.x, b.xy)); + + vec4 s; + vec3 m1 = hash3x2(c3 + vec2(1.0, 0.0), c3 + vec2(-1.0, -1.0), c3 + vec2(-1.0, 1.0)); + vec3 m2 = hash3x2(c3, c3 + vec2(0.0, 1.0), c3 + vec2(0.0, -1.0)); + vec3 m3 = hash3x2(c3 + vec2(-1.0, 0.0), c3 + vec2(1.0, 1.0), c3 + vec2(1.0, -1.0)); + vec3 m4 = vec3(m2.x, m2.z, m2.y); + + vec3 w1 = vec3(o.x, (1.0 - o.y), o.z); + vec3 w2 = vec3((1.0 - o.x), o.y, (1.0 - o.z)); + + vec2 d = fract(c3 * 0.5) * 2.0; + + s = fract(vec4(dot(m1, w1), dot(m2, w2), dot(m3, w2), dot(m4, w1))); + + return fract(mix(mix(s.z, s.w, d.x), mix(s.x, s.y, d.x), d.y)); +} + +float noiseHoneycombStar(vec2 i) { + vec2 c3; + i.x *= 1.154700538379251; + c3.x = floor(i.x) + 1.0; + vec2 b = vec2(i.y + i.x * 0.5, i.y - i.x * 0.5); + c3.y = floor(b.x) + floor(b.y); + vec3 o = fract(vec3(i.x, b.xy)); + + vec4 s; + vec3 m1 = vec3(hash2(c3 + vec2(1.0, 0.0)), hash2(c3 + vec2(-1.0, -1.0)), hash2(c3 + vec2(-1.0, 1.0))); + vec3 m2 = vec3(hash2(c3), hash2(c3 + vec2(0.0, 1.0)), hash2(c3 + vec2(0.0, -1.0))); + vec3 m3 = vec3(hash2(c3 + vec2(-1.0, 0.0)), hash2(c3 + vec2(1.0, 1.0)), hash2(c3 + vec2(1.0, -1.0))); + vec3 m4 = vec3(m2.x, m2.z, m2.y); + + vec3 w1 = vec3(o.x, (1.0 - o.y), o.z); + vec3 w2 = vec3((1.0 - o.x), o.y, (1.0 - o.z)); + w1 = w1 * w1 * (3.0 - 2.0 * w1); + w2 = w2 * w2 * (3.0 - 2.0 * w2); + + vec2 d = fract(c3 * 0.5) * 2.0; + + s = fract(vec4(dot(m1, w1), dot(m2, w2), dot(m3, w2), dot(m4, w1))); + + return fract(mix(mix(s.z, s.w, d.x), mix(s.x, s.y, d.x), d.y)); +} + +float iterateNoise ( vec2 pos, int iteration ) { + float amp = pow(2., float(iteration) - 1.) / (pow(2., float(iteration)) - 1.); + float n = 0.; + + for(int i = 0; i < iteration; i++) { + if(mode == 0) n += vec3(noiseHoneycomb(pos)) * amp; + else if(mode == 1) n += vec3(noiseHoneycombStar(pos)) * amp; + + amp *= .5; + pos *= 2.; + } + + return n; +} + +void main() { + float ang = radians(rotation); + vec2 pos = (v_vTexcoord - position / u_resolution) * mat2(cos(ang), -sin(ang), sin(ang), cos(ang)) * scale * 4.; + vec3 col = vec3(iterateNoise(pos, iteration)); + + // if(mode == 0) col = vec3(noiseHoneycomb(pos)); + // else if(mode == 1) col = vec3(noiseHoneycombStar(pos)); + + gl_FragColor = vec4(col, 1.); +} diff --git a/shaders/sh_noise_honey/sh_noise_honey.vsh b/shaders/sh_noise_honey/sh_noise_honey.vsh new file mode 100644 index 000000000..3900c20f4 --- /dev/null +++ b/shaders/sh_noise_honey/sh_noise_honey.vsh @@ -0,0 +1,19 @@ +// +// Simple passthrough vertex shader +// +attribute vec3 in_Position; // (x,y,z) +//attribute vec3 in_Normal; // (x,y,z) unused in this shader. +attribute vec4 in_Colour; // (r,g,b,a) +attribute vec2 in_TextureCoord; // (u,v) + +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +void main() +{ + vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0); + gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos; + + v_vColour = in_Colour; + v_vTexcoord = in_TextureCoord; +} diff --git a/shaders/sh_noise_honey/sh_noise_honey.yy b/shaders/sh_noise_honey/sh_noise_honey.yy new file mode 100644 index 000000000..c640217ad --- /dev/null +++ b/shaders/sh_noise_honey/sh_noise_honey.yy @@ -0,0 +1,12 @@ +{ + "$GMShader":"", + "%Name":"sh_noise_honey", + "name":"sh_noise_honey", + "parent":{ + "name":"noise", + "path":"folders/shader/noise.yy", + }, + "resourceType":"GMShader", + "resourceVersion":"2.0", + "type":1, +} \ No newline at end of file diff --git a/shaders/sh_noise_shard/sh_noise_shard.yy b/shaders/sh_noise_shard/sh_noise_shard.yy index a4e7bda0e..44f9e58d8 100644 --- a/shaders/sh_noise_shard/sh_noise_shard.yy +++ b/shaders/sh_noise_shard/sh_noise_shard.yy @@ -4,7 +4,7 @@ "name":"sh_noise_shard", "parent":{ "name":"noise", - "path":"folders/shader/generator/noise.yy", + "path":"folders/shader/noise.yy", }, "resourceType":"GMShader", "resourceVersion":"2.0", diff --git a/shaders/sh_noise_strand/sh_noise_strand.yy b/shaders/sh_noise_strand/sh_noise_strand.yy index 91c8cab27..069aded00 100644 --- a/shaders/sh_noise_strand/sh_noise_strand.yy +++ b/shaders/sh_noise_strand/sh_noise_strand.yy @@ -4,7 +4,7 @@ "name":"sh_noise_strand", "parent":{ "name":"noise", - "path":"folders/shader/generator/noise.yy", + "path":"folders/shader/noise.yy", }, "resourceType":"GMShader", "resourceVersion":"2.0", diff --git a/shaders/sh_noise_wavelet/sh_noise_wavelet.yy b/shaders/sh_noise_wavelet/sh_noise_wavelet.yy index 53cf98ff8..4eb71e88a 100644 --- a/shaders/sh_noise_wavelet/sh_noise_wavelet.yy +++ b/shaders/sh_noise_wavelet/sh_noise_wavelet.yy @@ -4,7 +4,7 @@ "name":"sh_noise_wavelet", "parent":{ "name":"noise", - "path":"folders/shader/generator/noise.yy", + "path":"folders/shader/noise.yy", }, "resourceType":"GMShader", "resourceVersion":"2.0", diff --git a/shaders/sh_perlin/sh_perlin.yy b/shaders/sh_perlin/sh_perlin.yy index 49187e1af..3c2fe4bfd 100644 --- a/shaders/sh_perlin/sh_perlin.yy +++ b/shaders/sh_perlin/sh_perlin.yy @@ -4,7 +4,7 @@ "name":"sh_perlin", "parent":{ "name":"noise", - "path":"folders/shader/generator/noise.yy", + "path":"folders/shader/noise.yy", }, "resourceType":"GMShader", "resourceVersion":"2.0", diff --git a/shaders/sh_perlin_extra/sh_perlin_extra.yy b/shaders/sh_perlin_extra/sh_perlin_extra.yy index 3d584e58c..ff9b4aaf2 100644 --- a/shaders/sh_perlin_extra/sh_perlin_extra.yy +++ b/shaders/sh_perlin_extra/sh_perlin_extra.yy @@ -4,7 +4,7 @@ "name":"sh_perlin_extra", "parent":{ "name":"noise", - "path":"folders/shader/generator/noise.yy", + "path":"folders/shader/noise.yy", }, "resourceType":"GMShader", "resourceVersion":"2.0", diff --git a/shaders/sh_perlin_smear/sh_perlin_smear.yy b/shaders/sh_perlin_smear/sh_perlin_smear.yy index d5aa73ef9..3897f8184 100644 --- a/shaders/sh_perlin_smear/sh_perlin_smear.yy +++ b/shaders/sh_perlin_smear/sh_perlin_smear.yy @@ -4,7 +4,7 @@ "name":"sh_perlin_smear", "parent":{ "name":"noise", - "path":"folders/shader/generator/noise.yy", + "path":"folders/shader/noise.yy", }, "resourceType":"GMShader", "resourceVersion":"2.0", diff --git a/shaders/sh_perlin_tiled/sh_perlin_tiled.yy b/shaders/sh_perlin_tiled/sh_perlin_tiled.yy index 98ed1c21e..6184dc886 100644 --- a/shaders/sh_perlin_tiled/sh_perlin_tiled.yy +++ b/shaders/sh_perlin_tiled/sh_perlin_tiled.yy @@ -4,7 +4,7 @@ "name":"sh_perlin_tiled", "parent":{ "name":"noise", - "path":"folders/shader/generator/noise.yy", + "path":"folders/shader/noise.yy", }, "resourceType":"GMShader", "resourceVersion":"2.0", diff --git a/shaders/sh_simplex/sh_simplex.yy b/shaders/sh_simplex/sh_simplex.yy index 81ffd46d8..0bc8a1af5 100644 --- a/shaders/sh_simplex/sh_simplex.yy +++ b/shaders/sh_simplex/sh_simplex.yy @@ -4,7 +4,7 @@ "name":"sh_simplex", "parent":{ "name":"noise", - "path":"folders/shader/generator/noise.yy", + "path":"folders/shader/noise.yy", }, "resourceType":"GMShader", "resourceVersion":"2.0", diff --git a/shaders/sh_voronoi_extra/sh_voronoi_extra.yy b/shaders/sh_voronoi_extra/sh_voronoi_extra.yy index 66dab6816..980076d5b 100644 --- a/shaders/sh_voronoi_extra/sh_voronoi_extra.yy +++ b/shaders/sh_voronoi_extra/sh_voronoi_extra.yy @@ -4,7 +4,7 @@ "name":"sh_voronoi_extra", "parent":{ "name":"noise", - "path":"folders/shader/generator/noise.yy", + "path":"folders/shader/noise.yy", }, "resourceType":"GMShader", "resourceVersion":"2.0",