ace tonemapping

This commit is contained in:
Tanasart 2024-05-15 19:27:09 +07:00
parent bc9a2fc05f
commit 2ca1676e3e
16 changed files with 253 additions and 1 deletions

View file

@ -1011,6 +1011,7 @@
{"name":"node_timeline_preview","order":2,"path":"scripts/node_timeline_preview/node_timeline_preview.yy",}, {"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_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_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_tool","order":9,"path":"scripts/node_tool/node_tool.yy",},
{"name":"node_trail","order":15,"path":"scripts/node_trail/node_trail.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",}, {"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_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_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_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_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_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",}, {"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_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_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_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_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_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",}, {"name":"s_node_alpha_cut","order":1,"path":"sprites/s_node_alpha_cut/s_node_alpha_cut.yy",},

View file

@ -1464,6 +1464,7 @@
{"id":{"name":"node_timeline_preview","path":"scripts/node_timeline_preview/node_timeline_preview.yy",},}, {"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_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_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_tool","path":"scripts/node_tool/node_tool.yy",},},
{"id":{"name":"node_trail","path":"scripts/node_trail/node_trail.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",},}, {"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_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_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_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_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_cutoff","path":"shaders/sh_alpha_cutoff/sh_alpha_cutoff.yy",},},
{"id":{"name":"sh_alpha_grey","path":"shaders/sh_alpha_grey/sh_alpha_grey.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_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_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_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_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_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",},}, {"id":{"name":"s_node_alpha_cut","path":"sprites/s_node_alpha_cut/s_node_alpha_cut.yy",},},

View file

@ -55,7 +55,7 @@
CURRENT_COLOR = c_white; CURRENT_COLOR = c_white;
#endregion #endregion
#region inputs #region inputsdis
globalvar FOCUS, FOCUS_STR, HOVER, HOVERING_ELEMENT, _HOVERING_ELEMENT; globalvar FOCUS, FOCUS_STR, HOVER, HOVERING_ELEMENT, _HOVERING_ELEMENT;
globalvar DOUBLE_CLICK, DOUBLE_CLICK_POS; globalvar DOUBLE_CLICK, DOUBLE_CLICK_POS;
globalvar DIALOG_CLICK; globalvar DIALOG_CLICK;

View file

@ -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, "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, "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, "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"); 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."); 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.");

View file

@ -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",
}

View file

@ -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",
}

View file

@ -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",
}

View file

@ -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",
}

View file

@ -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
}

View file

@ -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",
}

20
shaders/sh_ace/sh_ace.fsh Normal file
View file

@ -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);
}

19
shaders/sh_ace/sh_ace.vsh Normal file
View file

@ -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;
}

12
shaders/sh_ace/sh_ace.yy Normal file
View file

@ -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,
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 963 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 963 B

View file

@ -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<MessageEventKeyframe>":"",
"Keyframes":[],
"resourceType":"KeyframeStore<MessageEventKeyframe>",
"resourceVersion":"2.0",
},
"eventStubScript":null,
"eventToFunction":{},
"length":1.0,
"lockOrigin":false,
"moments":{
"$KeyframeStore<MomentsEventKeyframe>":"",
"Keyframes":[],
"resourceType":"KeyframeStore<MomentsEventKeyframe>",
"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<SpriteFrameKeyframe>":"","Keyframes":[
{"$Keyframe<SpriteFrameKeyframe>":"","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<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
],"resourceType":"KeyframeStore<SpriteFrameKeyframe>","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,
}