diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index 22851e4fb..93dca1688 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -1675,6 +1675,7 @@ {"name":"s_node_bend_type","order":21,"path":"sprites/s_node_bend_type/s_node_bend_type.yy",}, {"name":"s_node_bend","order":20,"path":"sprites/s_node_bend/s_node_bend.yy",}, {"name":"s_node_bevel","order":4,"path":"sprites/s_node_bevel/s_node_bevel.yy",}, + {"name":"s_node_blend_edge","order":67,"path":"sprites/s_node_blend_edge/s_node_blend_edge.yy",}, {"name":"s_node_blend","order":5,"path":"sprites/s_node_blend/s_node_blend.yy",}, {"name":"s_node_blobify","order":6,"path":"sprites/s_node_blobify/s_node_blobify.yy",}, {"name":"s_node_bloom","order":7,"path":"sprites/s_node_bloom/s_node_bloom.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 77de05efb..e485dfb95 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -2221,6 +2221,7 @@ {"id":{"name":"s_node_bend_type","path":"sprites/s_node_bend_type/s_node_bend_type.yy",},}, {"id":{"name":"s_node_bend","path":"sprites/s_node_bend/s_node_bend.yy",},}, {"id":{"name":"s_node_bevel","path":"sprites/s_node_bevel/s_node_bevel.yy",},}, + {"id":{"name":"s_node_blend_edge","path":"sprites/s_node_blend_edge/s_node_blend_edge.yy",},}, {"id":{"name":"s_node_blend","path":"sprites/s_node_blend/s_node_blend.yy",},}, {"id":{"name":"s_node_blobify","path":"sprites/s_node_blobify/s_node_blobify.yy",},}, {"id":{"name":"s_node_bloom","path":"sprites/s_node_bloom/s_node_bloom.yy",},}, diff --git a/scripts/node_blend_edge/node_blend_edge.gml b/scripts/node_blend_edge/node_blend_edge.gml index 61b4010de..6dbce05aa 100644 --- a/scripts/node_blend_edge/node_blend_edge.gml +++ b/scripts/node_blend_edge/node_blend_edge.gml @@ -26,9 +26,12 @@ function Node_Blend_Edge(_x, _y, _group = noone) : Node_Processor(_x, _y, _group inputs[| 6] = nodeValue("Blending", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) .setDisplay(VALUE_DISPLAY.slider); + inputs[| 7] = nodeValue("Smoothness", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0) + .setDisplay(VALUE_DISPLAY.slider); + input_display_list = [ 3, 4, ["Surfaces", true], 0, - ["Blend", false], 2, 1, 5, 6, + ["Blend", false], 2, 1, 5, 6, 7, ] outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); @@ -48,16 +51,36 @@ function Node_Blend_Edge(_x, _y, _group = noone) : Node_Processor(_x, _y, _group for( var i = 0, n = array_length(temp_surface); i < n; i++ ) temp_surface[i] = surface_verify(temp_surface[i], _sw, _sh); - surface_set_shader(_outSurf, sh_blend_edge); - shader_set_f("dimension", _sw, _sh); - shader_set_f_map("width", clamp(_data[1], 0.001, 0.999), _data[5], inputs[| 1]); - shader_set_i("edge" , _data[2]); - shader_set_f("blend" , clamp(_data[6], 0.001, 0.999)); - - draw_surface(_data[0], 0, 0); - surface_reset_shader(); + var _edg = _data[2]; - //return temp_surface[0]; + if(_edg == 0) { + surface_set_shader(temp_surface[0], sh_blend_edge); + shader_set_f("dimension", _sw, _sh); + shader_set_f_map("width", _data[1], _data[5], inputs[| 1]); + shader_set_i("edge" , 0); + shader_set_f("blend" , clamp(_data[6], 0.001, 0.999)); + shader_set_f("smooth" , _data[7]); + + draw_surface(_data[0], 0, 0); + surface_reset_shader(); + + surface_set_shader(_outSurf, sh_blend_edge); + shader_set_i("edge" , 1); + + draw_surface(temp_surface[0], 0, 0); + surface_reset_shader(); + + } else { + surface_set_shader(_outSurf, sh_blend_edge); + shader_set_f("dimension", _sw, _sh); + shader_set_f_map("width", _data[1], _data[5], inputs[| 1]); + shader_set_i("edge" , _edg - 1); + shader_set_f("blend" , clamp(_data[6], 0.001, 0.999)); + + draw_surface(_data[0], 0, 0); + surface_reset_shader(); + + } return _outSurf; } diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index a01a80a2d..627a5aad6 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -611,7 +611,7 @@ function __initNodes() { addNodeObject(filter, "Vignette", s_node_vignette, "Node_Vignette", [1, Node_Vignette],, "Apply vignette effect to the border.").setVersion(11630); addNodeObject(filter, "FXAA", s_node_FXAA, "Node_FXAA", [1, Node_FXAA],, "Apply fast approximate anti-aliasing to te image."); addNodeObject(filter, "JPEG", s_node_JPEG, "Node_JPEG", [1, Node_JPEG],, "Apply JPEG compression to the image.").setVersion(11730); - //addNodeObject(filter, "Blend Edge", s_node_FXAA, "Node_Blend_Edge", [1, Node_Blend_Edge]).setVersion(11640); + addNodeObject(filter, "Blend Edge", s_node_blend_edge, "Node_Blend_Edge", [1, Node_Blend_Edge]).setVersion(11740); ds_list_add(filter, "Colors"); addNodeObject(filter, "Replace Palette", s_node_replace_palette, "Node_Color_replace", [1, Node_Color_replace], ["isolate color", "select color", "palette swap", "color replace"], "Replace color that match one palette with another palette."); diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index e31d34463..9823be294 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -370,7 +370,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru if( attributes.mapped) setValue([0, 0]); - if(!attributes.mapped && is_array(def_val)) + if(!attributes.mapped) setValue(def_val); setArrayDepth(attributes.mapped); diff --git a/shaders/sh_blend_edge/sh_blend_edge.fsh b/shaders/sh_blend_edge/sh_blend_edge.fsh index 7b0bbc75f..1c7692465 100644 --- a/shaders/sh_blend_edge/sh_blend_edge.fsh +++ b/shaders/sh_blend_edge/sh_blend_edge.fsh @@ -9,6 +9,7 @@ uniform int widthUseSurf; uniform sampler2D widthSurf; uniform float blend; +uniform float smooth; void main() { float wid = width.x; @@ -20,17 +21,24 @@ void main() { float bnd = 1. - blend; vec4 off; - float m = 0.; - vec2 v = 1. - max(vec2(0.), abs(v_vTexcoord - 0.5) * 2. / wid - bnd) / (1. - bnd); - vec2 vi = 1. - max(vec2(0.), (1. - abs(v_vTexcoord - 0.5) * 2.) / wid - bnd) / (1. - bnd); - float mi = 1. - max(vi.x, vi.y); + float m = 0.; + vec2 v = 1. - max(vec2(0.), (1. - abs(v_vTexcoord - 0.5) * 2.) / wid - bnd) / (1. - bnd); - if(edge == 0) m = min(max(v.x, v.y), max(v.x, v.y) + mi - 1.); - else if(edge == 1) m = v.x; - else if(edge == 2) m = v.y; + vec4 c1 = texture2D( gm_BaseTexture, v_vTexcoord ); + vec4 c2; + + if(edge == 0) { + m = v.x; + c2 = texture2D( gm_BaseTexture, vec2(fract(v_vTexcoord.x + 0.5), v_vTexcoord.y) ); + + } else if(edge == 1) { + m = v.y; + c2 = texture2D( gm_BaseTexture, vec2(v_vTexcoord.x, fract(v_vTexcoord.y + 0.5)) ); + + } m = clamp(m, 0., 1.); - //m = smoothstep(0., 1., m); + m = mix(m, smoothstep(0., 1., m), smooth); - gl_FragColor = vec4(vec3(m), 1.); + gl_FragColor = mix(c1, c2, m); } diff --git a/sprites/s_node_blend_edge/0eab1d7e-c05a-4c81-8014-d441c44b42d9.png b/sprites/s_node_blend_edge/0eab1d7e-c05a-4c81-8014-d441c44b42d9.png new file mode 100644 index 000000000..9cfb8baab Binary files /dev/null and b/sprites/s_node_blend_edge/0eab1d7e-c05a-4c81-8014-d441c44b42d9.png differ diff --git a/sprites/s_node_blend_edge/layers/0eab1d7e-c05a-4c81-8014-d441c44b42d9/1cb8cdda-51c9-4f2e-89b7-2540ea24f5a6.png b/sprites/s_node_blend_edge/layers/0eab1d7e-c05a-4c81-8014-d441c44b42d9/1cb8cdda-51c9-4f2e-89b7-2540ea24f5a6.png new file mode 100644 index 000000000..9cfb8baab Binary files /dev/null and b/sprites/s_node_blend_edge/layers/0eab1d7e-c05a-4c81-8014-d441c44b42d9/1cb8cdda-51c9-4f2e-89b7-2540ea24f5a6.png differ diff --git a/sprites/s_node_blend_edge/s_node_blend_edge.yy b/sprites/s_node_blend_edge/s_node_blend_edge.yy new file mode 100644 index 000000000..cf82a510f --- /dev/null +++ b/sprites/s_node_blend_edge/s_node_blend_edge.yy @@ -0,0 +1,90 @@ +{ + "$GMSprite":"", + "%Name":"s_node_blend_edge", + "bboxMode":0, + "bbox_bottom":63, + "bbox_left":0, + "bbox_right":63, + "bbox_top":0, + "collisionKind":1, + "collisionTolerance":0, + "DynamicTexturePage":false, + "edgeFiltering":false, + "For3D":false, + "frames":[ + {"$GMSpriteFrame":"","%Name":"0eab1d7e-c05a-4c81-8014-d441c44b42d9","name":"0eab1d7e-c05a-4c81-8014-d441c44b42d9","resourceType":"GMSpriteFrame","resourceVersion":"2.0",}, + ], + "gridX":0, + "gridY":0, + "height":64, + "HTile":false, + "layers":[ + {"$GMImageLayer":"","%Name":"1cb8cdda-51c9-4f2e-89b7-2540ea24f5a6","blendMode":0,"displayName":"default","isLocked":false,"name":"1cb8cdda-51c9-4f2e-89b7-2540ea24f5a6","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,}, + ], + "name":"s_node_blend_edge", + "nineSlice":null, + "origin":4, + "parent":{ + "name":"filter", + "path":"folders/nodes/icons/filter.yy", + }, + "preMultiplyAlpha":false, + "resourceType":"GMSprite", + "resourceVersion":"2.0", + "sequence":{ + "$GMSequence":"", + "%Name":"s_node_blend_edge", + "autoRecord":true, + "backdropHeight":768, + "backdropImageOpacity":0.5, + "backdropImagePath":"", + "backdropWidth":1366, + "backdropXOffset":0.0, + "backdropYOffset":0.0, + "events":{ + "$KeyframeStore":"", + "Keyframes":[], + "resourceType":"KeyframeStore", + "resourceVersion":"2.0", + }, + "eventStubScript":null, + "eventToFunction":{}, + "length":1.0, + "lockOrigin":false, + "moments":{ + "$KeyframeStore":"", + "Keyframes":[], + "resourceType":"KeyframeStore", + "resourceVersion":"2.0", + }, + "name":"s_node_blend_edge", + "playback":1, + "playbackSpeed":30.0, + "playbackSpeedType":0, + "resourceType":"GMSequence", + "resourceVersion":"2.0", + "showBackdrop":true, + "showBackdropImage":false, + "timeUnits":1, + "tracks":[ + {"$GMSpriteFramesTrack":"","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"$KeyframeStore":"","Keyframes":[ + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"0eab1d7e-c05a-4c81-8014-d441c44b42d9","path":"sprites/s_node_blend_edge/s_node_blend_edge.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"b1f41c73-2dfc-4e6c-b7ed-310fc9652558","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + ],"resourceType":"KeyframeStore","resourceVersion":"2.0",},"modifiers":[],"name":"frames","resourceType":"GMSpriteFramesTrack","resourceVersion":"2.0","spriteId":null,"trackColour":0,"tracks":[],"traits":0,}, + ], + "visibleRange":null, + "volume":1.0, + "xorigin":32, + "yorigin":32, + }, + "swatchColours":null, + "swfPrecision":0.5, + "textureGroupId":{ + "name":"Default", + "path":"texturegroups/Default", + }, + "type":0, + "VTile":false, + "width":64, +} \ No newline at end of file