material-maker/material_maker/nodes/tones.tscn

214 lines
5.3 KiB
Plaintext
Raw Normal View History

2020-03-21 17:44:41 +01:00
[gd_scene load_steps=14 format=2]
[ext_resource path="res://material_maker/nodes/tones.gd" type="Script" id=1]
2020-03-21 17:44:41 +01:00
[sub_resource type="Shader" id=1]
code = "shader_type canvas_item;
2020-03-22 05:45:29 +01:00
render_mode blend_disabled;
2020-03-21 17:44:41 +01:00
uniform sampler2D tex;
void fragment() {
COLOR = texture(tex, UV);
}
"
[sub_resource type="ImageTexture" id=2]
2020-03-21 17:44:41 +01:00
[sub_resource type="ShaderMaterial" id=3]
2020-03-21 17:44:41 +01:00
resource_local_to_scene = true
shader = SubResource( 1 )
shader_param/tex = SubResource( 2 )
2020-03-21 17:44:41 +01:00
[sub_resource type="Shader" id=4]
2020-03-21 17:44:41 +01:00
code = "shader_type canvas_item;
2020-03-22 05:45:29 +01:00
render_mode blend_disabled;
2020-03-21 17:44:41 +01:00
uniform sampler2D tex;
void fragment() {
vec4 sum = vec4(0.0);
for (int i = 0; i < 128; ++i) {
sum += step(abs(texture(tex, vec2(UV.x, float(i)/127.0))-UV.y), vec4(0.02));
}
2020-03-22 05:45:29 +01:00
COLOR = sum/255.0;
2020-03-21 17:44:41 +01:00
}
"
[sub_resource type="ViewportTexture" id=5]
2020-03-21 17:44:41 +01:00
viewport_path = NodePath("ViewportImage")
[sub_resource type="ShaderMaterial" id=6]
2020-03-21 17:44:41 +01:00
resource_local_to_scene = true
shader = SubResource( 4 )
shader_param/tex = SubResource( 5 )
2020-03-21 17:44:41 +01:00
[sub_resource type="Shader" id=7]
2020-03-21 17:44:41 +01:00
code = "shader_type canvas_item;
2020-03-22 05:45:29 +01:00
render_mode blend_disabled;
2020-03-21 17:44:41 +01:00
uniform sampler2D tex;
void fragment() {
vec4 sum = vec4(0.0);
for (int i = 0; i < 128; ++i) {
sum += texture(tex, vec2(float(i)/127.0, UV.x));
}
2020-03-22 05:45:29 +01:00
COLOR = sum/255.0;
2020-03-21 17:44:41 +01:00
}"
[sub_resource type="ViewportTexture" id=8]
2020-03-21 17:44:41 +01:00
viewport_path = NodePath("ViewportHistogram1")
[sub_resource type="ShaderMaterial" id=9]
2020-03-21 17:44:41 +01:00
resource_local_to_scene = true
shader = SubResource( 7 )
shader_param/tex = SubResource( 8 )
2020-03-21 17:44:41 +01:00
[sub_resource type="Shader" id=10]
2020-03-21 17:44:41 +01:00
code = "shader_type canvas_item;
uniform sampler2D tex;
2020-03-22 05:45:29 +01:00
render_mode blend_disabled;
2020-03-21 17:44:41 +01:00
void fragment() {
if (abs(fract(UV.y+0.05)) < 0.1) {
COLOR = vec4(vec3(UV.x), 1.0);
} else {
vec4 highest = vec4(0.0);
for (int i = 0; i < 128; ++i) {
highest = max(highest, texture(tex, vec2(float(i)/128.0, 0.0)));
}
2020-03-22 05:45:29 +01:00
vec4 value = step(vec4(0.95-UV.y)*highest/0.9, 0.5*(texture(tex, vec2(max(0.0, UV.x-0.015), 0.0))+texture(tex, vec2(min(1.0, UV.x+0.015), 0.0))));
float alpha = step(0.1, dot(value, vec4(1.0)));
COLOR = vec4(mix(value.rgb, vec3(0.5), 0.3*value.a), alpha);
2020-03-21 17:44:41 +01:00
}
}"
[sub_resource type="ViewportTexture" id=11]
2020-03-21 17:44:41 +01:00
viewport_path = NodePath("ViewportHistogram2")
[sub_resource type="ShaderMaterial" id=12]
2020-03-21 17:44:41 +01:00
resource_local_to_scene = true
shader = SubResource( 10 )
shader_param/tex = SubResource( 11 )
2020-03-21 17:44:41 +01:00
[node name="Tones" type="GraphNode"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 2.75074
margin_top = 1.78928
margin_right = -1053.25
margin_bottom = -529.211
2020-03-21 17:44:41 +01:00
title = "Tones"
show_close = true
slot/0/left_enabled = true
slot/0/left_type = 0
slot/0/left_color = Color( 0, 0.396078, 1, 1 )
slot/0/right_enabled = true
slot/0/right_type = 0
slot/0/right_color = Color( 0, 0.415686, 1, 1 )
slot/1/left_enabled = false
slot/1/left_type = 0
slot/1/left_color = Color( 1, 1, 1, 1 )
slot/1/right_enabled = false
slot/1/right_type = 0
slot/1/right_color = Color( 1, 1, 1, 1 )
slot/2/left_enabled = false
slot/2/left_type = 0
slot/2/left_color = Color( 1, 1, 1, 1 )
slot/2/right_enabled = false
slot/2/right_type = 0
slot/2/right_color = Color( 1, 1, 1, 1 )
slot/3/left_enabled = false
slot/3/left_type = 0
slot/3/left_color = Color( 1, 1, 1, 1 )
slot/3/right_enabled = false
slot/3/right_type = 0
slot/3/right_color = Color( 1, 1, 1, 1 )
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ViewportImage" type="Viewport" parent="."]
size = Vector2( 256, 256 )
2020-03-22 05:45:29 +01:00
transparent_bg = true
hdr = false
2020-03-21 17:44:41 +01:00
usage = 0
render_target_v_flip = true
render_target_update_mode = 3
[node name="ColorRect" type="ColorRect" parent="ViewportImage"]
material = SubResource( 3 )
2020-03-21 17:44:41 +01:00
margin_right = 256.0
margin_bottom = 128.0
rect_min_size = Vector2( 256, 256 )
[node name="ViewportHistogram1" type="Viewport" parent="."]
size = Vector2( 128, 128 )
2020-03-22 05:45:29 +01:00
own_world = true
transparent_bg = true
hdr = false
2020-03-21 17:44:41 +01:00
usage = 0
render_target_v_flip = true
render_target_update_mode = 3
[node name="ColorRect" type="ColorRect" parent="ViewportHistogram1"]
material = SubResource( 6 )
2020-03-21 17:44:41 +01:00
margin_right = 128.0
margin_bottom = 128.0
rect_min_size = Vector2( 128, 128 )
[node name="ViewportHistogram2" type="Viewport" parent="."]
size = Vector2( 128, 2 )
2020-03-22 05:45:29 +01:00
transparent_bg = true
2020-03-21 17:44:41 +01:00
disable_3d = true
keep_3d_linear = true
usage = 0
render_target_v_flip = true
render_target_update_mode = 3
[node name="ColorRect" type="ColorRect" parent="ViewportHistogram2"]
material = SubResource( 9 )
2020-03-21 17:44:41 +01:00
margin_right = 128.0
margin_bottom = 2.0
rect_min_size = Vector2( 128, 2 )
[node name="Mode" type="OptionButton" parent="."]
margin_left = 16.0
margin_top = 24.0
margin_right = 208.0
margin_bottom = 44.0
text = "Luminance"
items = [ "Luminance", null, false, 0, null, "Red", null, false, 1, null, "Green", null, false, 2, null, "Blue", null, false, 3, null, "Alpha", null, false, 4, null ]
selected = 0
[node name="Spacer1" type="Control" parent="."]
margin_left = 16.0
margin_top = 45.0
margin_right = 208.0
margin_bottom = 49.0
rect_min_size = Vector2( 0, 4 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Histogram" type="ColorRect" parent="."]
material = SubResource( 12 )
2020-03-21 17:44:41 +01:00
margin_left = 16.0
margin_top = 50.0
margin_right = 208.0
margin_bottom = 178.0
rect_min_size = Vector2( 192, 128 )
[node name="Spacer2" type="Control" parent="."]
margin_left = 16.0
margin_top = 179.0
margin_right = 208.0
margin_bottom = 183.0
rect_min_size = Vector2( 0, 4 )
__meta__ = {
"_edit_use_anchors_": false
}