diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index fc219ad6f..cb8a1700a 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -1011,6 +1011,7 @@ {"name":"node_timeline_preview","order":2,"path":"scripts/node_timeline_preview/node_timeline_preview.yy",}, {"name":"node_to_number","order":13,"path":"scripts/node_to_number/node_to_number.yy",}, {"name":"node_to_text","order":11,"path":"scripts/node_to_text/node_to_text.yy",}, + {"name":"node_tonemap_ace","order":16,"path":"scripts/node_tonemap_ace/node_tonemap_ace.yy",}, {"name":"node_tool","order":9,"path":"scripts/node_tool/node_tool.yy",}, {"name":"node_trail","order":15,"path":"scripts/node_trail/node_trail.yy",}, {"name":"node_transform_array","order":15,"path":"scripts/node_transform_array/node_transform_array.yy",}, @@ -1182,6 +1183,7 @@ {"name":"sh_3d_extrude_corner","order":7,"path":"shaders/sh_3d_extrude_corner/sh_3d_extrude_corner.yy",}, {"name":"sh_3d_extrude_filler_depth","order":9,"path":"shaders/sh_3d_extrude_filler_depth/sh_3d_extrude_filler_depth.yy",}, {"name":"sh_3d_extrude_filler","order":8,"path":"shaders/sh_3d_extrude_filler/sh_3d_extrude_filler.yy",}, + {"name":"sh_ace","order":22,"path":"shaders/sh_ace/sh_ace.yy",}, {"name":"sh_active_canvas_ink","order":13,"path":"shaders/sh_active_canvas_ink/sh_active_canvas_ink.yy",}, {"name":"sh_alpha_grey","order":1,"path":"shaders/sh_alpha_grey/sh_alpha_grey.yy",}, {"name":"sh_alpha_hash","order":2,"path":"shaders/sh_alpha_hash/sh_alpha_hash.yy",}, @@ -1538,6 +1540,7 @@ {"name":"s_node_3d_sphere","order":8,"path":"sprites/s_node_3d_sphere/s_node_3d_sphere.yy",}, {"name":"s_node_3d_transform_scene","order":22,"path":"sprites/s_node_3d_transform_scene/s_node_3d_transform_scene.yy",}, {"name":"s_node_3d_transform","order":4,"path":"sprites/s_node_3d_transform/s_node_3d_transform.yy",}, + {"name":"s_node_ace","order":61,"path":"sprites/s_node_ace/s_node_ace.yy",}, {"name":"s_node_active_canvas","order":22,"path":"sprites/s_node_active_canvas/s_node_active_canvas.yy",}, {"name":"s_node_alignment","order":4,"path":"sprites/s_node_alignment/s_node_alignment.yy",}, {"name":"s_node_alpha_cut","order":1,"path":"sprites/s_node_alpha_cut/s_node_alpha_cut.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 80d24e5d7..d4c3baaa7 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -1464,6 +1464,7 @@ {"id":{"name":"node_timeline_preview","path":"scripts/node_timeline_preview/node_timeline_preview.yy",},}, {"id":{"name":"node_to_number","path":"scripts/node_to_number/node_to_number.yy",},}, {"id":{"name":"node_to_text","path":"scripts/node_to_text/node_to_text.yy",},}, + {"id":{"name":"node_tonemap_ace","path":"scripts/node_tonemap_ace/node_tonemap_ace.yy",},}, {"id":{"name":"node_tool","path":"scripts/node_tool/node_tool.yy",},}, {"id":{"name":"node_trail","path":"scripts/node_trail/node_trail.yy",},}, {"id":{"name":"node_transform_array","path":"scripts/node_transform_array/node_transform_array.yy",},}, @@ -1672,6 +1673,7 @@ {"id":{"name":"sh_3d_extrude_corner","path":"shaders/sh_3d_extrude_corner/sh_3d_extrude_corner.yy",},}, {"id":{"name":"sh_3d_extrude_filler_depth","path":"shaders/sh_3d_extrude_filler_depth/sh_3d_extrude_filler_depth.yy",},}, {"id":{"name":"sh_3d_extrude_filler","path":"shaders/sh_3d_extrude_filler/sh_3d_extrude_filler.yy",},}, + {"id":{"name":"sh_ace","path":"shaders/sh_ace/sh_ace.yy",},}, {"id":{"name":"sh_active_canvas_ink","path":"shaders/sh_active_canvas_ink/sh_active_canvas_ink.yy",},}, {"id":{"name":"sh_alpha_cutoff","path":"shaders/sh_alpha_cutoff/sh_alpha_cutoff.yy",},}, {"id":{"name":"sh_alpha_grey","path":"shaders/sh_alpha_grey/sh_alpha_grey.yy",},}, @@ -2085,6 +2087,7 @@ {"id":{"name":"s_node_3d_transform_scene","path":"sprites/s_node_3d_transform_scene/s_node_3d_transform_scene.yy",},}, {"id":{"name":"s_node_3d_transform","path":"sprites/s_node_3d_transform/s_node_3d_transform.yy",},}, {"id":{"name":"s_node_9patch","path":"sprites/s_node_9patch/s_node_9patch.yy",},}, + {"id":{"name":"s_node_ace","path":"sprites/s_node_ace/s_node_ace.yy",},}, {"id":{"name":"s_node_active_canvas","path":"sprites/s_node_active_canvas/s_node_active_canvas.yy",},}, {"id":{"name":"s_node_alignment","path":"sprites/s_node_alignment/s_node_alignment.yy",},}, {"id":{"name":"s_node_alpha_cut","path":"sprites/s_node_alpha_cut/s_node_alpha_cut.yy",},}, diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index 1d4bc3949..4db6a2651 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -55,7 +55,7 @@ CURRENT_COLOR = c_white; #endregion -#region inputs +#region inputsdis globalvar FOCUS, FOCUS_STR, HOVER, HOVERING_ELEMENT, _HOVERING_ELEMENT; globalvar DOUBLE_CLICK, DOUBLE_CLICK_POS; globalvar DIALOG_CLICK; diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index 8d7057288..175a238ee 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -620,6 +620,7 @@ function __initNodes() { addNodeObject(filter, "Threshold", s_node_threshold, "Node_Threshold", [1, Node_Threshold],, "Set a threshold where pixel darker will becomes black, and brighter to white. Also works with alpha.").setVersion(1080); addNodeObject(filter, "Alpha Cutoff", s_node_alpha_cut, "Node_Alpha_Cutoff", [1, Node_Alpha_Cutoff], ["remove alpha"], "Remove pixel with low alpha value."); addNodeObject(filter, "Gamma Map", s_node_gamma_map, "Node_Gamma_Map", [1, Node_Gamma_Map]).setVersion(11660); + addNodeObject(filter, "ACE", s_node_ace, "Node_Tonemap_ACE", [1, Node_Tonemap_ACE],, "Apply ACE tonemapping.").setVersion(11710); ds_list_add(filter, "Conversions"); addNodeObject(filter, "RGBA Extract", s_node_RGB, "Node_RGB_Channel", [1, Node_RGB_Channel], ["channel extract"], "Extract RGBA channel on an image, each channel becomes its own image."); diff --git a/scripts/node_tonemap_ace/node_color_adjustment.yy b/scripts/node_tonemap_ace/node_color_adjustment.yy new file mode 100644 index 000000000..8df16cc8c --- /dev/null +++ b/scripts/node_tonemap_ace/node_color_adjustment.yy @@ -0,0 +1,12 @@ +{ + "isDnD": false, + "isCompatibility": false, + "parent": { + "name": "filter", + "path": "folders/nodes/data/filter.yy", + }, + "resourceVersion": "1.0", + "name": "node_color_adjustment", + "tags": [], + "resourceType": "GMScript", +} \ No newline at end of file diff --git a/scripts/node_tonemap_ace/node_color_replacement.yy b/scripts/node_tonemap_ace/node_color_replacement.yy new file mode 100644 index 000000000..024aa6a80 --- /dev/null +++ b/scripts/node_tonemap_ace/node_color_replacement.yy @@ -0,0 +1,12 @@ +{ + "isDnD": false, + "isCompatibility": false, + "parent": { + "name": "process", + "path": "folders/nodes/data/process.yy", + }, + "resourceVersion": "1.0", + "name": "node_color_replacement", + "tags": [], + "resourceType": "GMScript", +} \ No newline at end of file diff --git a/scripts/node_tonemap_ace/node_greyscale.yy b/scripts/node_tonemap_ace/node_greyscale.yy new file mode 100644 index 000000000..ee372977e --- /dev/null +++ b/scripts/node_tonemap_ace/node_greyscale.yy @@ -0,0 +1,12 @@ +{ + "isDnD": false, + "isCompatibility": false, + "parent": { + "name": "filter", + "path": "folders/nodes/data/filter.yy", + }, + "resourceVersion": "1.0", + "name": "node_greyscale", + "tags": [], + "resourceType": "GMScript", +} \ No newline at end of file diff --git a/scripts/node_tonemap_ace/node_outline.yy b/scripts/node_tonemap_ace/node_outline.yy new file mode 100644 index 000000000..86468bc09 --- /dev/null +++ b/scripts/node_tonemap_ace/node_outline.yy @@ -0,0 +1,12 @@ +{ + "isDnD": false, + "isCompatibility": false, + "parent": { + "name": "process", + "path": "folders/nodes/data/process.yy", + }, + "resourceVersion": "1.0", + "name": "node_outline", + "tags": [], + "resourceType": "GMScript", +} \ No newline at end of file diff --git a/scripts/node_tonemap_ace/node_tonemap_ace.gml b/scripts/node_tonemap_ace/node_tonemap_ace.gml new file mode 100644 index 000000000..86ad9c437 --- /dev/null +++ b/scripts/node_tonemap_ace/node_tonemap_ace.gml @@ -0,0 +1,43 @@ +function Node_Tonemap_ACE(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { + name = "ACE"; + + inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone); + + inputs[| 1] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone); + + inputs[| 2] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) + .setDisplay(VALUE_DISPLAY.slider); + + inputs[| 3] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); + active_index = 3; + + inputs[| 4] = nodeValue("Channel", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b1111) + .setDisplay(VALUE_DISPLAY.toggle, { data: array_create(4, THEME.inspector_channel) }); + + __init_mask_modifier(1); // inputs 5, 6 + + input_display_list = [ 3, 4, + ["Surfaces", true], 0, 1, 2, 5, 6, + ] + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + attribute_surface_depth(); + + static step = function() { #region + __step_mask_modifier(); + } #endregion + + static processData = function(_outSurf, _data, _output_index, _array_index) { #region + + surface_set_shader(_outSurf, sh_ace); + draw_surface_safe(_data[0]); + surface_reset_shader(); + + __process_mask_modifier(_data); + _outSurf = mask_apply(_data[0], _outSurf, _data[1], _data[2]); + _outSurf = channel_apply(_data[0], _outSurf, _data[4]); + + return _outSurf; + } #endregion +} \ No newline at end of file diff --git a/scripts/node_tonemap_ace/node_tonemap_ace.yy b/scripts/node_tonemap_ace/node_tonemap_ace.yy new file mode 100644 index 000000000..862f35ad2 --- /dev/null +++ b/scripts/node_tonemap_ace/node_tonemap_ace.yy @@ -0,0 +1,13 @@ +{ + "$GMScript":"", + "%Name":"node_tonemap_ace", + "isCompatibility":false, + "isDnD":false, + "name":"node_tonemap_ace", + "parent":{ + "name":"colors", + "path":"folders/nodes/data/filter/colors.yy", + }, + "resourceType":"GMScript", + "resourceVersion":"2.0", +} \ No newline at end of file diff --git a/shaders/sh_ace/sh_ace.fsh b/shaders/sh_ace/sh_ace.fsh new file mode 100644 index 000000000..a81f3ba00 --- /dev/null +++ b/shaders/sh_ace/sh_ace.fsh @@ -0,0 +1,20 @@ +// +// Simple passthrough fragment shader +// +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +vec3 ACESFilm(vec3 x) { + float a = 2.51; + float b = 0.03; + float c = 2.43; + float d = 0.59; + float e = 0.14; + + return clamp((x * (a * x + b)) / (x * (c * x + d) + e), 0.0, 1.0); +} + +void main() { + vec4 cc = texture2D( gm_BaseTexture, v_vTexcoord ); + gl_FragColor = vec4(ACESFilm(cc.rgb), cc.a); +} diff --git a/shaders/sh_ace/sh_ace.vsh b/shaders/sh_ace/sh_ace.vsh new file mode 100644 index 000000000..3900c20f4 --- /dev/null +++ b/shaders/sh_ace/sh_ace.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_ace/sh_ace.yy b/shaders/sh_ace/sh_ace.yy new file mode 100644 index 000000000..908f4a7ba --- /dev/null +++ b/shaders/sh_ace/sh_ace.yy @@ -0,0 +1,12 @@ +{ + "$GMShader":"", + "%Name":"sh_ace", + "name":"sh_ace", + "parent":{ + "name":"color", + "path":"folders/shader/filter/color.yy", + }, + "resourceType":"GMShader", + "resourceVersion":"2.0", + "type":1, +} \ No newline at end of file diff --git a/sprites/s_node_ace/ab304183-462c-460d-beef-5cc5490c1526.png b/sprites/s_node_ace/ab304183-462c-460d-beef-5cc5490c1526.png new file mode 100644 index 000000000..bee5c3282 Binary files /dev/null and b/sprites/s_node_ace/ab304183-462c-460d-beef-5cc5490c1526.png differ diff --git a/sprites/s_node_ace/layers/ab304183-462c-460d-beef-5cc5490c1526/da2b5552-ae26-41c6-abb7-8d8123d558ab.png b/sprites/s_node_ace/layers/ab304183-462c-460d-beef-5cc5490c1526/da2b5552-ae26-41c6-abb7-8d8123d558ab.png new file mode 100644 index 000000000..bee5c3282 Binary files /dev/null and b/sprites/s_node_ace/layers/ab304183-462c-460d-beef-5cc5490c1526/da2b5552-ae26-41c6-abb7-8d8123d558ab.png differ diff --git a/sprites/s_node_ace/s_node_ace.yy b/sprites/s_node_ace/s_node_ace.yy new file mode 100644 index 000000000..a20381cdc --- /dev/null +++ b/sprites/s_node_ace/s_node_ace.yy @@ -0,0 +1,90 @@ +{ + "$GMSprite":"", + "%Name":"s_node_ace", + "bboxMode":0, + "bbox_bottom":43, + "bbox_left":5, + "bbox_right":57, + "bbox_top":21, + "collisionKind":1, + "collisionTolerance":0, + "DynamicTexturePage":false, + "edgeFiltering":false, + "For3D":false, + "frames":[ + {"$GMSpriteFrame":"","%Name":"ab304183-462c-460d-beef-5cc5490c1526","name":"ab304183-462c-460d-beef-5cc5490c1526","resourceType":"GMSpriteFrame","resourceVersion":"2.0",}, + ], + "gridX":0, + "gridY":0, + "height":64, + "HTile":false, + "layers":[ + {"$GMImageLayer":"","%Name":"da2b5552-ae26-41c6-abb7-8d8123d558ab","blendMode":0,"displayName":"default","isLocked":false,"name":"da2b5552-ae26-41c6-abb7-8d8123d558ab","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,}, + ], + "name":"s_node_ace", + "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_ace", + "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_ace", + "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":"ab304183-462c-460d-beef-5cc5490c1526","path":"sprites/s_node_ace/s_node_ace.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"50856454-728c-4bf5-a8c4-1334904d30a4","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