diff --git a/addons/procedural_material/common.shader b/addons/procedural_material/common.shader index 1ddc122..42f80d8 100644 --- a/addons/procedural_material/common.shader +++ b/addons/procedural_material/common.shader @@ -261,11 +261,11 @@ float perlin(vec2 uv, vec2 size, int iterations, float persistence, int seed) { float acc = 0.0; for (int i = 0; i < iterations; ++i) { vec2 step = vec2(1.0)/size; - vec2 xy = seed2+floor(fract(uv)*size); - float f0 = rand(xy); - float f1 = rand(xy+vec2(1.0, 0.0)); - float f2 = rand(xy+vec2(0.0, 1.0)); - float f3 = rand(xy+vec2(1.0, 1.0)); + vec2 xy = floor(uv*size); + float f0 = rand(seed2+mod(xy, size)); + float f1 = rand(seed2+mod(xy+vec2(1.0, 0.0), size)); + float f2 = rand(seed2+mod(xy+vec2(0.0, 1.0), size)); + float f3 = rand(seed2+mod(xy+vec2(1.0, 1.0), size)); vec2 mixval = smoothstep(0.0, 1.0, fract(uv*size)); rv += coef * mix(mix(f0, f1, mixval.x), mix(f2, f3, mixval.x), mixval.y); acc += coef; diff --git a/addons/procedural_material/library/base.json b/addons/procedural_material/library/base.json index dfbc17f..d889dc1 100644 --- a/addons/procedural_material/library/base.json +++ b/addons/procedural_material/library/base.json @@ -140,6 +140,10 @@ "tree_item":"Filters/Combine", "type":"combine" }, + { + "tree_item":"Filters/Decompose", + "type":"decompose" + }, { "tree_item":"Filters/Emboss", "type":"emboss", diff --git a/addons/procedural_material/main_window.gd b/addons/procedural_material/main_window.gd index 375f027..663362c 100644 --- a/addons/procedural_material/main_window.gd +++ b/addons/procedural_material/main_window.gd @@ -20,6 +20,7 @@ const MENU = [ { menu="Edit", command="edit_paste", shortcut="Control+V", description="Paste" }, { menu="Tools", command="add_to_user_library", description="Add selected node to user library" }, { menu="Tools", command="save_user_library", description="Save user library" }, + { menu="Help", command="show_doc", description="User manual" }, { menu="Help", command="bug_report", description="Report a bug" }, { menu="Help" }, { menu="Help", command="about", description="About" } @@ -170,6 +171,14 @@ func save_user_library(): print("Saving user library") $VBoxContainer/HBoxContainer/VBoxContainer/Library.save_library("user://library/user.json") +func show_doc(): + var doc_path = OS.get_executable_path() + doc_path = doc_path.replace("\\", "/") + doc_path = doc_path.left(doc_path.rfind("/")+1)+"doc/index.html" + var file = File.new() + if file.exists(doc_path): + OS.shell_open(doc_path) + func bug_report(): OS.shell_open("https://github.com/RodZill4/godot-procedural-textures/issues") diff --git a/addons/procedural_material/main_window.tscn b/addons/procedural_material/main_window.tscn index c48ae92..e360981 100644 --- a/addons/procedural_material/main_window.tscn +++ b/addons/procedural_material/main_window.tscn @@ -4,7 +4,7 @@ [ext_resource path="res://addons/procedural_material/library.gd" type="Script" id=2] [ext_resource path="res://addons/procedural_material/preview.tscn" type="PackedScene" id=3] -[node name="MainWindow" type="Panel"] +[node name="MainWindow" type="Panel" index="0"] anchor_left = 0.0 anchor_top = 0.0 diff --git a/addons/procedural_material/nodes/blend.tscn b/addons/procedural_material/nodes/blend.tscn index f18b8eb..97887b5 100644 --- a/addons/procedural_material/nodes/blend.tscn +++ b/addons/procedural_material/nodes/blend.tscn @@ -48,12 +48,12 @@ slot/2/right_type = 0 slot/2/right_color = Color( 0.5, 0.5, 1, 1 ) slot/3/left_enabled = true slot/3/left_type = 0 -slot/3/left_color = Color( 0.5, 0.5, 1, 1 ) +slot/3/left_color = Color( 0.756863, 0.756863, 0.756863, 1 ) slot/3/right_enabled = false slot/3/right_type = 0 slot/3/right_color = Color( 0.5, 0.5, 1, 1 ) script = ExtResource( 1 ) -_sections_unfolded = [ "Mouse", "Theme", "slot", "slot/1" ] +_sections_unfolded = [ "Mouse", "Theme", "slot", "slot/1", "slot/3" ] [node name="blend_type" type="OptionButton" parent="." index="0"] @@ -80,7 +80,7 @@ group = null text = "Normal" flat = false align = 0 -items = [ "Normal", null, false, 0, null, "Dissolve", null, false, 1, null, "Multiply", null, false, 2, null, "Screen", null, false, 3, null, "Overlay", null, false, 4, null, "Hard Light", null, false, 5, null, "Soft Light", null, false, 6, null, "Burn", null, false, 7, null, "Dodge", null, false, 8, null, "Lighten", null, false, 9, null, "Darken", null, false, 10, null ] +items = [ "Normal", null, false, 0, null, "Dissolve", null, false, 1, null, "Multiply", null, false, 2, null, "Screen", null, false, 3, null, "Overlay", null, false, 4, null, "Hard Light", null, false, 5, null, "Soft Light", null, false, 6, null, "Burn", null, false, 7, null, "Dodge", null, false, 8, null, "Lighten", null, false, 9, null, "Darken", null, false, 10, null, "Difference", null, false, 11, null ] selected = 0 [node name="Label1" type="Label" parent="." index="1"] diff --git a/addons/procedural_material/nodes/blur.tscn b/addons/procedural_material/nodes/blur.tscn index a87b140..ed217af 100644 --- a/addons/procedural_material/nodes/blur.tscn +++ b/addons/procedural_material/nodes/blur.tscn @@ -112,10 +112,11 @@ action_mode = 0 enabled_focus_mode = 2 shortcut = null group = null +text = "1024" flat = false align = 0 -items = [ ] -selected = -1 +items = [ "32", null, false, 0, null, "64", null, false, 1, null, "128", null, false, 2, null, "256", null, false, 3, null, "512", null, false, 4, null, "1024", null, false, 5, null, "2048", null, false, 6, null ] +selected = 5 _sections_unfolded = [ "Anchor", "Caret", "Placeholder", "Rect", "Size Flags" ] [node name="HBoxContainer2" type="HBoxContainer" parent="." index="1"] @@ -180,11 +181,11 @@ action_mode = 0 enabled_focus_mode = 2 shortcut = null group = null -text = "Y" +text = "Both" flat = false align = 0 -items = [ ] -selected = 2 +items = [ "Both", null, false, -1, null, "X", null, false, -1, null, "Y", null, false, -1, null ] +selected = 0 _sections_unfolded = [ "Caret", "Placeholder", "Rect", "Size Flags" ] [node name="HBoxContainer3" type="HBoxContainer" parent="." index="2"] diff --git a/addons/procedural_material/nodes/bricks.tscn b/addons/procedural_material/nodes/bricks.tscn index 66f9fb7..57f9c97 100644 --- a/addons/procedural_material/nodes/bricks.tscn +++ b/addons/procedural_material/nodes/bricks.tscn @@ -33,7 +33,7 @@ slot/0/left_type = 0 slot/0/left_color = Color( 0.5, 0.5, 1, 1 ) slot/0/right_enabled = true slot/0/right_type = 0 -slot/0/right_color = Color( 0.5, 0.5, 1, 1 ) +slot/0/right_color = Color( 0.756863, 0.756863, 0.756863, 1 ) slot/1/left_enabled = false slot/1/left_type = 0 slot/1/left_color = Color( 0.498039, 0.498039, 1, 1 ) @@ -95,10 +95,11 @@ action_mode = 0 enabled_focus_mode = 2 shortcut = null group = null +text = "Running bond" flat = false align = 0 -items = [ ] -selected = -1 +items = [ "Running bond", null, false, -1, null, "Running bond (2)", null, false, -1, null, "HerringBone", null, false, -1, null, "Basket weave", null, false, -1, null, "Spanish bond", null, false, -1, null ] +selected = 0 _sections_unfolded = [ "Size Flags" ] [node name="HBoxContainer6" type="HBoxContainer" parent="." index="1"] diff --git a/addons/procedural_material/nodes/colorize.tscn b/addons/procedural_material/nodes/colorize.tscn index e63ec31..e7297b2 100644 --- a/addons/procedural_material/nodes/colorize.tscn +++ b/addons/procedural_material/nodes/colorize.tscn @@ -6,7 +6,7 @@ [sub_resource type="Theme" id=1] -[node name="Colorize" type="GraphNode"] +[node name="Colorize" type="GraphNode" index="0"] anchor_left = 0.0 anchor_top = 0.0 @@ -32,12 +32,12 @@ comment = false overlay = 0 slot/0/left_enabled = true slot/0/left_type = 0 -slot/0/left_color = Color( 0.5, 0.5, 1, 1 ) +slot/0/left_color = Color( 0.756863, 0.756863, 0.756863, 1 ) slot/0/right_enabled = true slot/0/right_type = 0 slot/0/right_color = Color( 0.5, 0.5, 1, 1 ) script = ExtResource( 1 ) -_sections_unfolded = [ "Theme" ] +_sections_unfolded = [ "Theme", "slot", "slot/0" ] [node name="Control" parent="." index="0" instance=ExtResource( 2 )] diff --git a/addons/procedural_material/nodes/combine.tscn b/addons/procedural_material/nodes/combine.tscn index eec05a8..a06c101 100644 --- a/addons/procedural_material/nodes/combine.tscn +++ b/addons/procedural_material/nodes/combine.tscn @@ -31,19 +31,19 @@ comment = false overlay = 0 slot/0/left_enabled = true slot/0/left_type = 0 -slot/0/left_color = Color( 0.5, 0.5, 1, 1 ) +slot/0/left_color = Color( 0.756863, 0.756863, 0.756863, 1 ) slot/0/right_enabled = true slot/0/right_type = 0 slot/0/right_color = Color( 0.5, 0.5, 1, 1 ) slot/1/left_enabled = true slot/1/left_type = 0 -slot/1/left_color = Color( 0.498039, 0.498039, 1, 1 ) +slot/1/left_color = Color( 0.756863, 0.756863, 0.756863, 1 ) slot/1/right_enabled = false slot/1/right_type = 0 slot/1/right_color = Color( 0.498039, 0.498039, 1, 1 ) slot/2/left_enabled = true slot/2/left_type = 0 -slot/2/left_color = Color( 0.498039, 0.498039, 1, 1 ) +slot/2/left_color = Color( 0.756863, 0.756863, 0.756863, 1 ) slot/2/right_enabled = false slot/2/right_type = 0 slot/2/right_color = Color( 0.498039, 0.498039, 1, 1 ) diff --git a/addons/procedural_material/nodes/decompose.gd b/addons/procedural_material/nodes/decompose.gd new file mode 100644 index 0000000..ee13e05 --- /dev/null +++ b/addons/procedural_material/nodes/decompose.gd @@ -0,0 +1,21 @@ +tool +extends "res://addons/procedural_material/node_base.gd" + +const OUTPUTS = [ "r", "g", "b" ] + +func _get_shader_code(uv, output = 0): + var rv = { defs="", code="" } + var src = get_source() + var src_code = { defs="", code="", rgb="vec3(0.0)" } + if src != null: + src_code = src.get_shader_code(uv) + if generated_variants.empty(): + rv.defs = src_code.defs; + var variant_index = generated_variants.find(uv) + if variant_index == -1: + variant_index = generated_variants.size() + generated_variants.append(uv) + rv.code = src_code.code + rv.code += "vec3 %s_%d_rgb = %s;\n" % [ name, variant_index, src_code.rgb ] + rv.f = "%s_%d_rgb.%s" % [ name, variant_index, OUTPUTS[output] ] + return rv diff --git a/addons/procedural_material/nodes/decompose.tscn b/addons/procedural_material/nodes/decompose.tscn new file mode 100644 index 0000000..8530c52 --- /dev/null +++ b/addons/procedural_material/nodes/decompose.tscn @@ -0,0 +1,119 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://addons/procedural_material/nodes/decompose.gd" type="Script" id=1] + +[sub_resource type="Theme" id=1] + + +[node name="Decompose" type="GraphNode" index="0"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_left = 204.0 +margin_top = 72.0 +margin_right = 306.0 +margin_bottom = 145.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +mouse_filter = 1 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 1 +size_flags_vertical = 1 +theme = SubResource( 1 ) +title = "Decompose" +offset = Vector2( 0, 0 ) +show_close = true +resizable = false +selected = false +comment = false +overlay = 0 +slot/0/left_enabled = true +slot/0/left_type = 0 +slot/0/left_color = Color( 0.498039, 0.498039, 1, 1 ) +slot/0/right_enabled = true +slot/0/right_type = 0 +slot/0/right_color = Color( 0.756863, 0.756863, 0.756863, 1 ) +slot/1/left_enabled = false +slot/1/left_type = 0 +slot/1/left_color = Color( 0.756863, 0.756863, 0.756863, 1 ) +slot/1/right_enabled = true +slot/1/right_type = 0 +slot/1/right_color = Color( 0.756863, 0.756863, 0.756863, 1 ) +slot/2/left_enabled = false +slot/2/left_type = 0 +slot/2/left_color = Color( 0.756863, 0.756863, 0.756863, 1 ) +slot/2/right_enabled = true +slot/2/right_type = 0 +slot/2/right_color = Color( 0.756863, 0.756863, 0.756863, 1 ) +script = ExtResource( 1 ) +_sections_unfolded = [ "Theme", "slot", "slot/0", "slot/1", "slot/2" ] + +[node name="R" type="Label" parent="." index="0"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_left = 16.0 +margin_top = 24.0 +margin_right = 106.0 +margin_bottom = 38.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +mouse_filter = 2 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 1 +size_flags_vertical = 4 +text = "R" +align = 2 +percent_visible = 1.0 +lines_skipped = 0 +max_lines_visible = -1 + +[node name="G" type="Label" parent="." index="1"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_left = 16.0 +margin_top = 38.0 +margin_right = 106.0 +margin_bottom = 52.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +mouse_filter = 2 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 1 +size_flags_vertical = 4 +text = "G" +align = 2 +percent_visible = 1.0 +lines_skipped = 0 +max_lines_visible = -1 + +[node name="B" type="Label" parent="." index="2"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_left = 16.0 +margin_top = 53.0 +margin_right = 106.0 +margin_bottom = 67.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +mouse_filter = 2 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 1 +size_flags_vertical = 4 +text = "B" +align = 2 +percent_visible = 1.0 +lines_skipped = 0 +max_lines_visible = -1 + + diff --git a/addons/procedural_material/nodes/emboss.tscn b/addons/procedural_material/nodes/emboss.tscn index a11b5c3..41e5b7e 100644 --- a/addons/procedural_material/nodes/emboss.tscn +++ b/addons/procedural_material/nodes/emboss.tscn @@ -60,7 +60,7 @@ action_mode = 0 enabled_focus_mode = 2 shortcut = null group = null -text = "Objet 0" +text = "N" flat = false align = 0 items = [ "N", null, false, 0, null, "NE", null, false, 1, null, "E", null, false, 2, null, "SE", null, false, 3, null, "S", null, false, 4, null, "SW", null, false, 5, null, "W", null, false, 6, null, "NW", null, false, 7, null ] diff --git a/addons/procedural_material/nodes/material.tscn b/addons/procedural_material/nodes/material.tscn index 1d06b76..0bdc697 100644 --- a/addons/procedural_material/nodes/material.tscn +++ b/addons/procedural_material/nodes/material.tscn @@ -5,7 +5,7 @@ [sub_resource type="Theme" id=1] -[node name="Material" type="GraphNode"] +[node name="Material" type="GraphNode" index="0"] anchor_left = 0.0 anchor_top = 0.0 @@ -35,13 +35,13 @@ slot/0/right_type = 0 slot/0/right_color = Color( 0.5, 0.5, 1, 1 ) slot/1/left_enabled = true slot/1/left_type = 0 -slot/1/left_color = Color( 0.5, 0.5, 1, 1 ) +slot/1/left_color = Color( 0.756863, 0.756863, 0.756863, 1 ) slot/1/right_enabled = false slot/1/right_type = 0 slot/1/right_color = Color( 0.5, 0.5, 1, 1 ) slot/2/left_enabled = true slot/2/left_type = 0 -slot/2/left_color = Color( 0.498039, 0.498039, 1, 1 ) +slot/2/left_color = Color( 0.756863, 0.756863, 0.756863, 1 ) slot/2/right_enabled = false slot/2/right_type = 0 slot/2/right_color = Color( 0.498039, 0.498039, 1, 1 ) @@ -59,7 +59,7 @@ slot/4/right_type = 0 slot/4/right_color = Color( 0.498039, 0.498039, 1, 1 ) slot/5/left_enabled = true slot/5/left_type = 0 -slot/5/left_color = Color( 0.498039, 0.498039, 1, 1 ) +slot/5/left_color = Color( 0.756863, 0.756863, 0.756863, 1 ) slot/5/right_enabled = false slot/5/right_type = 0 slot/5/right_color = Color( 0.498039, 0.498039, 1, 1 ) @@ -70,7 +70,7 @@ slot/6/right_enabled = false slot/6/right_type = 0 slot/6/right_color = Color( 0.494118, 0.494118, 1, 1 ) script = ExtResource( 1 ) -_sections_unfolded = [ "Theme", "slot" ] +_sections_unfolded = [ "Theme", "slot", "slot/0", "slot/1", "slot/2", "slot/5" ] [node name="Albedo" type="HBoxContainer" parent="." index="0"] diff --git a/addons/procedural_material/nodes/noise.tscn b/addons/procedural_material/nodes/noise.tscn index 8971f5c..b766a81 100644 --- a/addons/procedural_material/nodes/noise.tscn +++ b/addons/procedural_material/nodes/noise.tscn @@ -31,10 +31,10 @@ comment = false overlay = 0 slot/0/left_enabled = false slot/0/left_type = 0 -slot/0/left_color = Color( 0.5, 0.5, 1, 1 ) +slot/0/left_color = Color( 0.756863, 0.756863, 0.756863, 1 ) slot/0/right_enabled = true slot/0/right_type = 0 -slot/0/right_color = Color( 0.5, 0.5, 1, 1 ) +slot/0/right_color = Color( 0.756863, 0.756863, 0.756863, 1 ) slot/1/left_enabled = false slot/1/left_type = 0 slot/1/left_color = Color( 1, 1, 1, 1 ) @@ -42,7 +42,7 @@ slot/1/right_enabled = false slot/1/right_type = 0 slot/1/right_color = Color( 1, 1, 1, 1 ) script = ExtResource( 1 ) -_sections_unfolded = [ "Theme" ] +_sections_unfolded = [ "Theme", "slot", "slot/0" ] [node name="HBoxContainer1" type="HBoxContainer" parent="." index="0"] @@ -104,11 +104,11 @@ action_mode = 0 enabled_focus_mode = 2 shortcut = null group = null -text = "1024" +text = "512" flat = false align = 0 items = [ "32", null, false, 0, null, "64", null, false, 1, null, "128", null, false, 2, null, "256", null, false, 3, null, "512", null, false, 4, null, "1024", null, false, 5, null, "2048", null, false, 6, null ] -selected = 5 +selected = 4 _sections_unfolded = [ "Caret", "Placeholder" ] [node name="HBoxContainer2" type="HBoxContainer" parent="." index="1"] diff --git a/addons/procedural_material/nodes/normal_map.tscn b/addons/procedural_material/nodes/normal_map.tscn index 634dac1..7a15d43 100644 --- a/addons/procedural_material/nodes/normal_map.tscn +++ b/addons/procedural_material/nodes/normal_map.tscn @@ -31,7 +31,7 @@ comment = false overlay = 0 slot/0/left_enabled = true slot/0/left_type = 0 -slot/0/left_color = Color( 0.5, 0.5, 1, 1 ) +slot/0/left_color = Color( 0.756863, 0.756863, 0.756863, 1 ) slot/0/right_enabled = true slot/0/right_type = 0 slot/0/right_color = Color( 0.5, 0.5, 1, 1 ) diff --git a/addons/procedural_material/nodes/pattern.tscn b/addons/procedural_material/nodes/pattern.tscn index a510349..ee6186a 100644 --- a/addons/procedural_material/nodes/pattern.tscn +++ b/addons/procedural_material/nodes/pattern.tscn @@ -5,7 +5,7 @@ [sub_resource type="Theme" id=1] -[node name="Pattern" type="GraphNode"] +[node name="Pattern" type="GraphNode" index="0"] anchor_left = 0.0 anchor_top = 0.0 @@ -33,7 +33,7 @@ slot/0/left_type = 0 slot/0/left_color = Color( 0.5, 0.5, 1, 1 ) slot/0/right_enabled = true slot/0/right_type = 0 -slot/0/right_color = Color( 0.5, 0.5, 1, 1 ) +slot/0/right_color = Color( 0.756863, 0.756863, 0.756863, 1 ) slot/1/left_enabled = false slot/1/left_type = 0 slot/1/left_color = Color( 1, 1, 1, 1 ) @@ -47,7 +47,7 @@ slot/2/right_enabled = false slot/2/right_type = 0 slot/2/right_color = Color( 1, 1, 1, 1 ) script = ExtResource( 1 ) -_sections_unfolded = [ "Theme", "slot" ] +_sections_unfolded = [ "Theme", "slot", "slot/0" ] [node name="HBoxContainer0" type="HBoxContainer" parent="." index="0"] diff --git a/addons/procedural_material/nodes/perlin.tscn b/addons/procedural_material/nodes/perlin.tscn index 92ff09d..a401d4f 100644 --- a/addons/procedural_material/nodes/perlin.tscn +++ b/addons/procedural_material/nodes/perlin.tscn @@ -34,9 +34,9 @@ slot/0/left_type = 0 slot/0/left_color = Color( 0.5, 0.5, 1, 1 ) slot/0/right_enabled = true slot/0/right_type = 0 -slot/0/right_color = Color( 0.5, 0.5, 1, 1 ) +slot/0/right_color = Color( 0.756863, 0.756863, 0.756863, 1 ) script = ExtResource( 1 ) -_sections_unfolded = [ "Theme" ] +_sections_unfolded = [ "Theme", "slot", "slot/0" ] [node name="GridContainer" type="GridContainer" parent="." index="0"] diff --git a/addons/procedural_material/nodes/transform.gd b/addons/procedural_material/nodes/transform.gd index 98863a7..79b2816 100644 --- a/addons/procedural_material/nodes/transform.gd +++ b/addons/procedural_material/nodes/transform.gd @@ -17,16 +17,26 @@ func _get_shader_code(uv): var src = get_source() if src == null: return rv - rv.uv = "%s_uv(%s)" % [ name, uv ] - var src_code = src.get_shader_code(rv.uv) - if !generated: - rv.defs = src_code.defs+"vec2 %s_uv(vec2 uv) { return %s(uv, vec2(%.9f, %.9f), %.9f, vec2(%.9f, %.9f)); }\n" % [ name, "transform_repeat" if repeat else "transform_norepeat", translate_x, translate_y, PI*rotate/180.0, scale_x, scale_y ] - generated = true - rv.code = src_code.code; - if src_code.has("f"): - rv.f = src_code.f - if src_code.has("rgb"): - rv.rgb = src_code.rgb + var variant_index = generated_variants.find(uv) + if variant_index == -1: + variant_index = generated_variants.size() + generated_variants.append(uv) + var inputs = [ "", "", "", "", "" ] + for i in range(5): + var tsrc = get_source(i+1) + if tsrc != null: + var tsrc_code = tsrc.get_shader_code(uv) + if generated_variants.size() == 1: + rv.defs += tsrc_code.defs + rv.code += tsrc_code.code + inputs[i] = "*(2.0*(%s)-1.0)" % tsrc_code.f + rv.code += "vec2 %s_%d_uv = %s(%s, vec2(%.9f%s, %.9f%s), %.9f%s, vec2(%.9f%s, %.9f%s));\n" % [ name, variant_index, "transform_repeat" if repeat else "transform_norepeat", uv, translate_x, inputs[0], translate_y, inputs[1], PI*rotate/180.0, inputs[2], scale_x, inputs[3], scale_y, inputs[4] ] + var src_code = src.get_shader_code("%s_%d_uv" % [ name, variant_index ]) + if rv.code != "": + if generated_variants.size() == 1: + rv.defs += src_code.defs + rv.code += src_code.code + rv.rgb = src_code.rgb return rv func deserialize(data): diff --git a/addons/procedural_material/nodes/transform.tscn b/addons/procedural_material/nodes/transform.tscn index f27f469..bf6b4b3 100644 --- a/addons/procedural_material/nodes/transform.tscn +++ b/addons/procedural_material/nodes/transform.tscn @@ -35,40 +35,46 @@ slot/0/left_color = Color( 0.5, 0.5, 1, 1 ) slot/0/right_enabled = true slot/0/right_type = 0 slot/0/right_color = Color( 0.5, 0.5, 1, 1 ) -slot/1/left_enabled = false +slot/1/left_enabled = true slot/1/left_type = 0 -slot/1/left_color = Color( 1, 1, 1, 1 ) +slot/1/left_color = Color( 0.760784, 0.760784, 0.760784, 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_enabled = true slot/2/left_type = 0 -slot/2/left_color = Color( 1, 1, 1, 1 ) +slot/2/left_color = Color( 0.760784, 0.760784, 0.760784, 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_enabled = true slot/3/left_type = 0 -slot/3/left_color = Color( 1, 1, 1, 1 ) +slot/3/left_color = Color( 0.760784, 0.760784, 0.760784, 1 ) slot/3/right_enabled = false slot/3/right_type = 0 slot/3/right_color = Color( 1, 1, 1, 1 ) -slot/4/left_enabled = false +slot/4/left_enabled = true slot/4/left_type = 0 -slot/4/left_color = Color( 1, 1, 1, 1 ) +slot/4/left_color = Color( 0.760784, 0.760784, 0.760784, 1 ) slot/4/right_enabled = false slot/4/right_type = 0 slot/4/right_color = Color( 1, 1, 1, 1 ) -slot/5/left_enabled = false +slot/5/left_enabled = true slot/5/left_type = 0 -slot/5/left_color = Color( 1, 1, 1, 1 ) +slot/5/left_color = Color( 0.761719, 0.761719, 0.761719, 1 ) slot/5/right_enabled = false slot/5/right_type = 0 slot/5/right_color = Color( 1, 1, 1, 1 ) +slot/6/left_enabled = false +slot/6/left_type = 0 +slot/6/left_color = Color( 1, 1, 1, 1 ) +slot/6/right_enabled = false +slot/6/right_type = 0 +slot/6/right_color = Color( 1, 1, 1, 1 ) script = ExtResource( 1 ) -_sections_unfolded = [ "Theme" ] +_sections_unfolded = [ "Theme", "slot", "slot/0", "slot/1", "slot/2" ] -[node name="HBoxContainer1" type="HBoxContainer" parent="." index="0"] +[node name="HBoxContainer0" type="HBoxContainer" parent="." index="0"] anchor_left = 0.0 anchor_top = 0.0 @@ -77,7 +83,69 @@ anchor_bottom = 0.0 margin_left = 16.0 margin_top = 24.0 margin_right = 168.0 -margin_bottom = 48.0 +margin_bottom = 44.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +mouse_filter = 1 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 1 +size_flags_vertical = 1 +alignment = 0 + +[node name="Input" type="Label" parent="HBoxContainer0" index="0"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_right = 74.0 +margin_bottom = 20.0 +rect_min_size = Vector2( 0, 20 ) +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +mouse_filter = 2 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 3 +size_flags_vertical = 4 +text = "Input" +valign = 1 +percent_visible = 1.0 +lines_skipped = 0 +max_lines_visible = -1 + +[node name="Output" type="Label" parent="HBoxContainer0" index="1"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_left = 78.0 +margin_right = 152.0 +margin_bottom = 20.0 +rect_min_size = Vector2( 0, 20 ) +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +mouse_filter = 2 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 3 +size_flags_vertical = 4 +text = "Output" +align = 2 +valign = 1 +percent_visible = 1.0 +lines_skipped = 0 +max_lines_visible = -1 + +[node name="HBoxContainer1" type="HBoxContainer" parent="." index="1"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_left = 16.0 +margin_top = 44.0 +margin_right = 168.0 +margin_bottom = 68.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false mouse_filter = 1 @@ -133,16 +201,16 @@ prefix = "" suffix = "" _sections_unfolded = [ "Caret", "Placeholder", "Rect" ] -[node name="HBoxContainer2" type="HBoxContainer" parent="." index="1"] +[node name="HBoxContainer2" type="HBoxContainer" parent="." index="2"] anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 margin_left = 16.0 -margin_top = 48.0 +margin_top = 69.0 margin_right = 168.0 -margin_bottom = 72.0 +margin_bottom = 93.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false mouse_filter = 1 @@ -198,16 +266,16 @@ prefix = "" suffix = "" _sections_unfolded = [ "Caret", "Placeholder" ] -[node name="HBoxContainer3" type="HBoxContainer" parent="." index="2"] +[node name="HBoxContainer3" type="HBoxContainer" parent="." index="3"] anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 margin_left = 16.0 -margin_top = 73.0 +margin_top = 94.0 margin_right = 168.0 -margin_bottom = 97.0 +margin_bottom = 118.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false mouse_filter = 1 @@ -252,8 +320,8 @@ mouse_filter = 0 mouse_default_cursor_shape = 0 size_flags_horizontal = 0 size_flags_vertical = 4 -min_value = 0.0 -max_value = 360.0 +min_value = -720.0 +max_value = 720.0 step = 5.0 page = 0.0 value = 0.0 @@ -264,16 +332,16 @@ prefix = "" suffix = "" _sections_unfolded = [ "Caret", "Placeholder", "Size Flags" ] -[node name="HBoxContainer4" type="HBoxContainer" parent="." index="3"] +[node name="HBoxContainer4" type="HBoxContainer" parent="." index="4"] anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 margin_left = 16.0 -margin_top = 98.0 +margin_top = 119.0 margin_right = 168.0 -margin_bottom = 122.0 +margin_bottom = 143.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false mouse_filter = 1 @@ -330,16 +398,16 @@ prefix = "" suffix = "" _sections_unfolded = [ "Caret", "Placeholder" ] -[node name="HBoxContainer5" type="HBoxContainer" parent="." index="4"] +[node name="HBoxContainer5" type="HBoxContainer" parent="." index="5"] anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 margin_left = 16.0 -margin_top = 123.0 +margin_top = 144.0 margin_right = 168.0 -margin_bottom = 147.0 +margin_bottom = 168.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false mouse_filter = 1 @@ -396,16 +464,16 @@ prefix = "" suffix = "" _sections_unfolded = [ "Caret", "Placeholder" ] -[node name="repeat" type="CheckBox" parent="." index="5"] +[node name="repeat" type="CheckBox" parent="." index="6"] anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 margin_left = 16.0 -margin_top = 148.0 +margin_top = 169.0 margin_right = 168.0 -margin_bottom = 172.0 +margin_bottom = 193.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false focus_mode = 2 diff --git a/addons/procedural_material/nodes/uniform.tscn b/addons/procedural_material/nodes/uniform.tscn index 88abfbf..82b8ddf 100644 --- a/addons/procedural_material/nodes/uniform.tscn +++ b/addons/procedural_material/nodes/uniform.tscn @@ -5,7 +5,7 @@ [sub_resource type="Theme" id=1] -[node name="Uniform" type="GraphNode"] +[node name="Uniform" type="GraphNode" index="0"] anchor_left = 0.0 anchor_top = 0.0 diff --git a/addons/procedural_material/nodes/voronoi.tscn b/addons/procedural_material/nodes/voronoi.tscn index 87fed95..b23f6f0 100644 --- a/addons/procedural_material/nodes/voronoi.tscn +++ b/addons/procedural_material/nodes/voronoi.tscn @@ -34,13 +34,13 @@ slot/0/left_type = 0 slot/0/left_color = Color( 0.5, 0.5, 1, 1 ) slot/0/right_enabled = true slot/0/right_type = 0 -slot/0/right_color = Color( 0.5, 0.5, 1, 1 ) +slot/0/right_color = Color( 0.756863, 0.756863, 0.756863, 1 ) slot/1/left_enabled = false slot/1/left_type = 0 slot/1/left_color = Color( 0.498039, 0.498039, 1, 1 ) slot/1/right_enabled = true slot/1/right_type = 0 -slot/1/right_color = Color( 0.498039, 0.498039, 1, 1 ) +slot/1/right_color = Color( 0.756863, 0.756863, 0.756863, 1 ) slot/2/left_enabled = false slot/2/left_type = 0 slot/2/left_color = Color( 0.498039, 0.498039, 1, 1 ) diff --git a/addons/procedural_material/nodes/warp.gd b/addons/procedural_material/nodes/warp.gd index ae48d82..ee51328 100644 --- a/addons/procedural_material/nodes/warp.gd +++ b/addons/procedural_material/nodes/warp.gd @@ -18,10 +18,10 @@ func _get_shader_code(uv): if variant_index == -1: variant_index = generated_variants.size() generated_variants.append(uv) - var src1_code0 = src1.get_shader_code(uv+"+vec2(0.01, 0.0)") - var src1_code1 = src1.get_shader_code(uv+"-vec2(0.01, 0.0)") - var src1_code2 = src1.get_shader_code(uv+"+vec2(0.0, 0.01)") - var src1_code3 = src1.get_shader_code(uv+"-vec2(0.0, 0.01)") + var src1_code0 = src1.get_shader_code("fract(%s+vec2(0.01, 0.0))" % uv) + var src1_code1 = src1.get_shader_code("fract(%s-vec2(0.01, 0.0))" % uv) + var src1_code2 = src1.get_shader_code("fract(%s+vec2(0.0, 0.01))" % uv) + var src1_code3 = src1.get_shader_code("fract(%s-vec2(0.0, 0.01))" % uv) rv.defs = src1_code0.defs rv.code = src1_code0.code+src1_code1.code+src1_code2.code+src1_code3.code rv.code += "vec2 %s_%d_uv = %s+%.9f*vec2((%s)-(%s), (%s)-(%s));\n" % [ name, variant_index, uv, amount, src1_code0.f, src1_code1.f, src1_code2.f, src1_code3.f ] diff --git a/addons/procedural_material/nodes/warp.tscn b/addons/procedural_material/nodes/warp.tscn index 43d3519..2de7595 100644 --- a/addons/procedural_material/nodes/warp.tscn +++ b/addons/procedural_material/nodes/warp.tscn @@ -37,7 +37,7 @@ slot/0/right_type = 0 slot/0/right_color = Color( 0.5, 0.5, 1, 1 ) slot/1/left_enabled = true slot/1/left_type = 0 -slot/1/left_color = Color( 0.5, 0.5, 1, 1 ) +slot/1/left_color = Color( 0.756863, 0.756863, 0.756863, 1 ) slot/1/right_enabled = false slot/1/right_type = 0 slot/1/right_color = Color( 0.5, 0.5, 1, 1 ) @@ -48,7 +48,7 @@ slot/2/right_enabled = false slot/2/right_type = 0 slot/2/right_color = Color( 1, 1, 1, 1 ) script = ExtResource( 1 ) -_sections_unfolded = [ "Theme" ] +_sections_unfolded = [ "Theme", "slot", "slot/1" ] [node name="Label1" type="Label" parent="." index="0"] diff --git a/doc/images/node_decompose.png b/doc/images/node_decompose.png new file mode 100644 index 0000000..9f1a42a Binary files /dev/null and b/doc/images/node_decompose.png differ diff --git a/doc/images/node_transform.png b/doc/images/node_transform.png index 90de06b..a17c97e 100644 Binary files a/doc/images/node_transform.png and b/doc/images/node_transform.png differ diff --git a/doc/node_combine.rst b/doc/node_combine.rst index 375ed7b..a10c5ce 100644 --- a/doc/node_combine.rst +++ b/doc/node_combine.rst @@ -1,14 +1,14 @@ Combine node ~~~~~~~~~~~~ -The combine three greyscale inputs into a color output texture. +The combine node combines three greyscale inputs into a color output texture. .. image:: images/node_combine.png Inputs ++++++ -The combine node has 3 inputs, one for each (read, green and blue) channel. +The combine node has 3 inputs, one for each (red, green and blue) channel. Outputs +++++++ diff --git a/doc/node_decompose.rst b/doc/node_decompose.rst new file mode 100644 index 0000000..486856a --- /dev/null +++ b/doc/node_decompose.rst @@ -0,0 +1,16 @@ +Decompose node +~~~~~~~~~~~~~~ + +The decompose node decomposes a color input into three greyscale outputs. + +.. image:: images/node_decompose.png + +Inputs +++++++ + +The decompose node has a single color input. + +Outputs ++++++++ + +The decompose node outputs 3 greyscale images, one for each (red, green and blue) channel. \ No newline at end of file diff --git a/doc/node_transform.rst b/doc/node_transform.rst index 7ab094b..4e08ffd 100644 --- a/doc/node_transform.rst +++ b/doc/node_transform.rst @@ -8,7 +8,13 @@ The transform node applies a scale operation, a rotation and a translation to th Inputs ++++++ -The transform node accepts a single image as input. +The transform node accepts a color image as input. + +It also accepts a greyscale input image for each transform parameter. In that case, +instead of applying a uniform transform to the input image, the transform parameter +will, for each pixel, be multiplied by a value from -1 to 1 that depends linearly +on the corresponding greyscale input image (a black pixel will multiply the parameter +by -1, a white pixel will not change the parameter, a grey50 pixel will set it to 0). Outputs +++++++ diff --git a/doc/nodes_filters.rst b/doc/nodes_filters.rst index ab7182c..247499c 100644 --- a/doc/nodes_filters.rst +++ b/doc/nodes_filters.rst @@ -9,6 +9,7 @@ The generator nodes are nodes that do not accept any input and generate one or s node_blend node_blur node_combine + node_decompose node_emboss node_normal_map node_transform diff --git a/examples/bricks.ptex b/examples/bricks.ptex index 8f37b4f..79df2ec 100644 --- a/examples/bricks.ptex +++ b/examples/bricks.ptex @@ -1 +1 @@ -{"connections":[{"from":"Perlin","from_port":0,"to":"Warp","to_port":1},{"from":"Warp","from_port":0,"to":"colorize_2","to_port":0},{"from":"colorize_2","from_port":0,"to":"blend_0","to_port":2},{"from":"colorize_1","from_port":0,"to":"blend_0","to_port":0},{"from":"colorize_0","from_port":0,"to":"blend_0","to_port":1},{"from":"blend_0","from_port":0,"to":"Material","to_port":0},{"from":"normal_map_0","from_port":0,"to":"Material","to_port":4},{"from":"colorize_2","from_port":0,"to":"colorize_4","to_port":0},{"from":"colorize_4","from_port":0,"to":"Material","to_port":2},{"from":"Bricks","from_port":0,"to":"Warp","to_port":0},{"from":"blend_1","from_port":0,"to":"colorize_1","to_port":0},{"from":"Bricks","from_port":1,"to":"blend_1","to_port":1},{"from":"Warp","from_port":0,"to":"blend_2","to_port":0},{"from":"Perlin","from_port":0,"to":"blend_2","to_port":1},{"from":"blend_2","from_port":0,"to":"colorize_3","to_port":0},{"from":"blend_2","from_port":0,"to":"colorize_6","to_port":0},{"from":"colorize_6","from_port":0,"to":"normal_map_0","to_port":0},{"from":"Perlin","from_port":0,"to":"blend_1","to_port":0},{"from":"Perlin","from_port":0,"to":"colorize_0","to_port":0},{"from":"uniform_0","from_port":0,"to":"Material","to_port":1},{"from":"colorize_3","from_port":0,"to":"Material","to_port":5},{"from":"uniform_0","from_port":0,"to":"combine_0","to_port":0},{"from":"colorize_4","from_port":0,"to":"combine_0","to_port":1},{"from":"combine_0","from_port":0,"to":"export_0","to_port":0}],"nodes":[{"gradient":[{"b":0,"g":0,"pos":0,"r":0},{"b":1,"g":1,"pos":1,"r":1}],"name":"colorize_0","node_position":{"x":560.943665,"y":50},"type":"colorize"},{"gradient":[{"b":0.0016,"g":0.0016,"pos":0,"r":0.307292},{"b":0,"g":0.180135,"pos":0.2,"r":0.606771},{"b":0,"g":0,"pos":0.345455,"r":0.3125},{"b":0,"g":0.19869,"pos":0.545455,"r":0.669271},{"b":0.019368,"g":0.060224,"pos":0.745455,"r":0.309896},{"b":0,"g":0.180135,"pos":1,"r":0.606771}],"name":"colorize_1","node_position":{"x":562.943665,"y":-65},"type":"colorize"},{"bevel":0.2,"columns":3,"mortar":0.05,"name":"Bricks","node_position":{"x":118,"y":-22},"row_offset":0.5,"rows":6,"type":"bricks"},{"amount":0.04,"name":"Warp","node_position":{"x":384,"y":10.75},"type":"warp"},{"albedo_color":{"a":1,"b":1,"g":1,"r":1,"type":"Color"},"ao_light_affect":1,"depth_scale":0,"emission_energy":1,"metallic":1,"name":"Material","node_position":{"x":1081,"y":208},"normal_scale":1,"roughness":1,"type":"material"},{"amount":0.5,"blend_type":0,"name":"blend_2","node_position":{"x":536,"y":331},"type":"blend"},{"gradient":[{"b":1,"g":1,"pos":0,"r":1},{"b":0.463542,"g":0.463542,"pos":1,"r":0.463542}],"name":"colorize_4","node_position":{"x":708,"y":224},"type":"colorize"},{"amount":0.5,"blend_type":0,"name":"blend_0","node_position":{"x":836.943726,"y":-71},"type":"blend"},{"gradient":[{"b":0,"g":0,"pos":0,"r":0},{"b":1,"g":1,"pos":0.1,"r":1}],"name":"colorize_2","node_position":{"x":544.943665,"y":159},"type":"colorize"},{"amount":0.5,"blend_type":6,"name":"blend_1","node_position":{"x":349,"y":215},"type":"blend"},{"iterations":6,"name":"Perlin","node_position":{"x":115,"y":194},"persistence":0.85,"scale_x":4,"scale_y":4,"type":"perlin"},{"gradient":[{"b":1,"g":1,"pos":0,"r":1},{"b":0,"g":0,"pos":1,"r":0}],"name":"colorize_6","node_position":{"x":743,"y":291},"type":"colorize"},{"gradient":[{"b":0.510417,"g":0.510417,"pos":0.245455,"r":0.510417},{"b":1,"g":1,"pos":0.536364,"r":1}],"name":"colorize_3","node_position":{"x":753,"y":364},"type":"colorize"},{"amount":0.5,"name":"normal_map_0","node_position":{"x":922,"y":297},"type":"normal_map"},{"color":{"a":1,"b":0,"g":0,"r":0,"type":"Color"},"name":"uniform_0","node_position":{"x":764,"y":164},"type":"uniform"},{"name":"combine_0","node_position":{"x":896,"y":86},"type":"combine"},{"name":"export_0","node_position":{"x":1050,"y":79},"suffix":"mr","type":"export"}]} \ No newline at end of file +{"connections":[{"from":"Perlin","from_port":0,"to":"Warp","to_port":1},{"from":"Warp","from_port":0,"to":"colorize_2","to_port":0},{"from":"colorize_2","from_port":0,"to":"blend_0","to_port":2},{"from":"colorize_1","from_port":0,"to":"blend_0","to_port":0},{"from":"colorize_0","from_port":0,"to":"blend_0","to_port":1},{"from":"blend_0","from_port":0,"to":"Material","to_port":0},{"from":"normal_map_0","from_port":0,"to":"Material","to_port":4},{"from":"colorize_2","from_port":0,"to":"colorize_4","to_port":0},{"from":"colorize_4","from_port":0,"to":"Material","to_port":2},{"from":"Bricks","from_port":0,"to":"Warp","to_port":0},{"from":"blend_1","from_port":0,"to":"colorize_1","to_port":0},{"from":"Bricks","from_port":1,"to":"blend_1","to_port":1},{"from":"Warp","from_port":0,"to":"blend_2","to_port":0},{"from":"Perlin","from_port":0,"to":"blend_2","to_port":1},{"from":"blend_2","from_port":0,"to":"colorize_3","to_port":0},{"from":"blend_2","from_port":0,"to":"colorize_6","to_port":0},{"from":"colorize_6","from_port":0,"to":"normal_map_0","to_port":0},{"from":"Perlin","from_port":0,"to":"blend_1","to_port":0},{"from":"Perlin","from_port":0,"to":"colorize_0","to_port":0},{"from":"uniform_0","from_port":0,"to":"Material","to_port":1},{"from":"colorize_3","from_port":0,"to":"Material","to_port":5},{"from":"uniform_0","from_port":0,"to":"combine_0","to_port":0},{"from":"colorize_4","from_port":0,"to":"combine_0","to_port":1},{"from":"combine_0","from_port":0,"to":"export_0","to_port":0}],"nodes":[{"gradient":[{"b":0,"g":0,"pos":0,"r":0},{"b":1,"g":1,"pos":1,"r":1}],"name":"colorize_0","node_position":{"x":560.943665,"y":50},"type":"colorize"},{"gradient":[{"b":0.0016,"g":0.0016,"pos":0,"r":0.307292},{"b":0,"g":0.180135,"pos":0.2,"r":0.606771},{"b":0,"g":0,"pos":0.345455,"r":0.3125},{"b":0,"g":0.19869,"pos":0.545455,"r":0.669271},{"b":0.019368,"g":0.060224,"pos":0.745455,"r":0.309896},{"b":0,"g":0.180135,"pos":1,"r":0.606771}],"name":"colorize_1","node_position":{"x":562.943665,"y":-65},"type":"colorize"},{"amount":0.04,"name":"Warp","node_position":{"x":384,"y":10.75},"type":"warp"},{"albedo_color":{"a":1,"b":1,"g":1,"r":1,"type":"Color"},"ao_light_affect":1,"depth_scale":0,"emission_energy":1,"metallic":1,"name":"Material","node_position":{"x":1081,"y":208},"normal_scale":1,"roughness":1,"type":"material"},{"amount":0.5,"blend_type":0,"name":"blend_2","node_position":{"x":536,"y":331},"type":"blend"},{"gradient":[{"b":1,"g":1,"pos":0,"r":1},{"b":0.463542,"g":0.463542,"pos":1,"r":0.463542}],"name":"colorize_4","node_position":{"x":708,"y":224},"type":"colorize"},{"amount":0.5,"blend_type":0,"name":"blend_0","node_position":{"x":836.943726,"y":-71},"type":"blend"},{"gradient":[{"b":0,"g":0,"pos":0,"r":0},{"b":1,"g":1,"pos":0.1,"r":1}],"name":"colorize_2","node_position":{"x":544.943665,"y":159},"type":"colorize"},{"amount":0.5,"blend_type":6,"name":"blend_1","node_position":{"x":349,"y":215},"type":"blend"},{"gradient":[{"b":1,"g":1,"pos":0,"r":1},{"b":0,"g":0,"pos":1,"r":0}],"name":"colorize_6","node_position":{"x":743,"y":291},"type":"colorize"},{"gradient":[{"b":0.510417,"g":0.510417,"pos":0.245455,"r":0.510417},{"b":1,"g":1,"pos":0.536364,"r":1}],"name":"colorize_3","node_position":{"x":753,"y":364},"type":"colorize"},{"amount":0.5,"name":"normal_map_0","node_position":{"x":922,"y":297},"type":"normal_map"},{"color":{"a":1,"b":0,"g":0,"r":0,"type":"Color"},"name":"uniform_0","node_position":{"x":764,"y":164},"type":"uniform"},{"name":"combine_0","node_position":{"x":896,"y":86},"type":"combine"},{"name":"export_0","node_position":{"x":1050,"y":79},"suffix":"mr","type":"export"},{"bevel":0.2,"columns":3,"mortar":0.05,"name":"Bricks","node_position":{"x":69,"y":-46},"pattern":0,"repeat":1,"row_offset":0.5,"rows":6,"type":"bricks"},{"iterations":6,"name":"Perlin","node_position":{"x":70,"y":192},"persistence":0.85,"scale_x":4,"scale_y":4,"type":"perlin"}]} \ No newline at end of file diff --git a/examples/metal_pattern_3.ptex b/examples/metal_pattern_3.ptex index b94ee8b..64d0a1b 100644 --- a/examples/metal_pattern_3.ptex +++ b/examples/metal_pattern_3.ptex @@ -1 +1 @@ -{"connections":[{"from":"normal_map_0","from_port":0,"to":"Material","to_port":4},{"from":"pattern_0","from_port":0,"to":"colorize_0","to_port":0},{"from":"pattern_1","from_port":0,"to":"colorize_1","to_port":0},{"from":"colorize_0","from_port":0,"to":"blend_0","to_port":1},{"from":"colorize_1","from_port":0,"to":"blend_0","to_port":0},{"from":"blend_0","from_port":0,"to":"normal_map_0","to_port":0},{"from":"uniform_0","from_port":0,"to":"Material","to_port":0},{"from":"uniform_1","from_port":0,"to":"Material","to_port":1},{"from":"uniform_2","from_port":0,"to":"Material","to_port":2}],"nodes":[{"mix":0,"name":"pattern_0","node_position":{"x":-108,"y":304},"type":"pattern","x_scale":16,"x_wave":0,"y_scale":16,"y_wave":0},{"mix":3,"name":"pattern_1","node_position":{"x":-115,"y":188},"type":"pattern","x_scale":1,"x_wave":1,"y_scale":1,"y_wave":1},{"gradient":[{"b":0,"g":0,"pos":0.236364,"r":0},{"b":1,"g":1,"pos":0.263636,"r":1}],"name":"colorize_1","node_position":{"x":119,"y":186},"type":"colorize"},{"gradient":[{"b":0.546875,"g":0.546875,"pos":0.845455,"r":0.546875},{"b":0,"g":0,"pos":1,"r":0}],"name":"colorize_0","node_position":{"x":124,"y":298},"type":"colorize"},{"amount":1,"blend_type":9,"name":"blend_0","node_position":{"x":331,"y":210},"type":"blend"},{"albedo_color":{"a":1,"b":1,"g":1,"r":1,"type":"Color"},"ao_light_affect":1,"depth_scale":1,"emission_energy":1,"metallic":1,"name":"Material","node_position":{"x":669,"y":81},"normal_scale":1,"roughness":1,"type":"material"},{"amount":0.5,"name":"normal_map_0","node_position":{"x":522,"y":205},"type":"normal_map"},{"color":{"a":1,"b":0.855469,"g":0.736813,"r":0.51796,"type":"Color"},"name":"uniform_0","node_position":{"x":507,"y":21},"type":"uniform"},{"color":{"a":1,"b":1,"g":1,"r":1,"type":"Color"},"name":"uniform_1","node_position":{"x":510,"y":73},"type":"uniform"},{"color":{"a":1,"b":0.632813,"g":0.632813,"r":0.632813,"type":"Color"},"name":"uniform_2","node_position":{"x":513,"y":126},"type":"uniform"}]} \ No newline at end of file +{"connections":[{"from":"normal_map_0","from_port":0,"to":"Material","to_port":4},{"from":"pattern_1","from_port":0,"to":"colorize_1","to_port":0},{"from":"colorize_0","from_port":0,"to":"blend_0","to_port":1},{"from":"colorize_1","from_port":0,"to":"blend_0","to_port":0},{"from":"blend_0","from_port":0,"to":"normal_map_0","to_port":0},{"from":"uniform_0","from_port":0,"to":"Material","to_port":0},{"from":"uniform_1","from_port":0,"to":"Material","to_port":1},{"from":"uniform_2","from_port":0,"to":"Material","to_port":2},{"from":"pattern_0","from_port":0,"to":"colorize_0","to_port":0}],"nodes":[{"gradient":[{"b":0,"g":0,"pos":0.236364,"r":0},{"b":1,"g":1,"pos":0.254545,"r":1}],"name":"colorize_1","node_position":{"x":119,"y":186},"type":"colorize"},{"albedo_color":{"a":1,"b":1,"g":1,"r":1,"type":"Color"},"ao_light_affect":1,"depth_scale":1,"emission_energy":1,"metallic":1,"name":"Material","node_position":{"x":669,"y":81},"normal_scale":1,"roughness":1,"type":"material"},{"amount":0.5,"name":"normal_map_0","node_position":{"x":522,"y":205},"type":"normal_map"},{"color":{"a":1,"b":0.855469,"g":0.736813,"r":0.51796,"type":"Color"},"name":"uniform_0","node_position":{"x":507,"y":21},"type":"uniform"},{"color":{"a":1,"b":1,"g":1,"r":1,"type":"Color"},"name":"uniform_1","node_position":{"x":510,"y":73},"type":"uniform"},{"color":{"a":1,"b":0.632813,"g":0.632813,"r":0.632813,"type":"Color"},"name":"uniform_2","node_position":{"x":513,"y":126},"type":"uniform"},{"mix":3,"name":"pattern_1","node_position":{"x":-258,"y":189},"type":"pattern","x_scale":1,"x_wave":1,"y_scale":1,"y_wave":1},{"mix":0,"name":"pattern_0","node_position":{"x":-259,"y":314},"type":"pattern","x_scale":16,"x_wave":0,"y_scale":16,"y_wave":0},{"amount":1,"blend_type":9,"name":"blend_0","node_position":{"x":331,"y":210},"type":"blend"},{"gradient":[{"b":0.546875,"g":0.546875,"pos":0.845455,"r":0.546875},{"b":0,"g":0,"pos":1,"r":0}],"name":"colorize_0","node_position":{"x":124,"y":298},"type":"colorize"}]} \ No newline at end of file diff --git a/examples/wood.ptex b/examples/wood.ptex new file mode 100644 index 0000000..6e965ff --- /dev/null +++ b/examples/wood.ptex @@ -0,0 +1 @@ +{"connections":[{"from":"perlin_0","from_port":0,"to":"warp_0","to_port":0},{"from":"perlin_1","from_port":0,"to":"warp_0","to_port":1},{"from":"perlin_2","from_port":0,"to":"blend_0","to_port":0},{"from":"blend_0","from_port":0,"to":"normal_map_0","to_port":0},{"from":"normal_map_0","from_port":0,"to":"Material","to_port":4},{"from":"blend_0","from_port":0,"to":"colorize_0","to_port":0},{"from":"colorize_0","from_port":0,"to":"Material","to_port":2},{"from":"blend_0","from_port":0,"to":"Material","to_port":1},{"from":"voronoi_0","from_port":0,"to":"colorize_1","to_port":0},{"from":"warp_0","from_port":0,"to":"warp_1","to_port":0},{"from":"colorize_1","from_port":0,"to":"warp_1","to_port":1},{"from":"warp_1","from_port":0,"to":"blend_0","to_port":1}],"nodes":[{"amount":0.15,"name":"normal_map_0","node_position":{"x":319,"y":265.5},"type":"normal_map"},{"albedo_color":{"a":1,"b":0.113434,"g":0.411451,"r":0.691406,"type":"Color"},"ao_light_affect":1,"depth_scale":1,"emission_energy":1,"metallic":1,"name":"Material","node_position":{"x":544,"y":79},"normal_scale":1,"roughness":1,"type":"material"},{"gradient":[{"b":0.53125,"g":0.53125,"pos":0,"r":0.53125},{"b":0.708333,"g":0.708333,"pos":1,"r":0.708333}],"name":"colorize_0","node_position":{"x":313,"y":176.5},"type":"colorize"},{"amount":0.75,"blend_type":2,"name":"blend_0","node_position":{"x":83,"y":245.5},"type":"blend"},{"iterations":6,"name":"perlin_2","node_position":{"x":-312,"y":2.5},"persistence":1,"scale_x":32,"scale_y":4,"type":"perlin"},{"iterations":3,"name":"perlin_1","node_position":{"x":-400,"y":359.5},"persistence":0.5,"scale_x":4,"scale_y":4,"type":"perlin"},{"iterations":3,"name":"perlin_0","node_position":{"x":-393,"y":203.5},"persistence":0.5,"scale_x":32,"scale_y":4,"type":"perlin"},{"amount":0.3,"name":"warp_0","node_position":{"x":-180,"y":317.5},"type":"warp"},{"gradient":[{"b":0.432292,"g":0.432292,"pos":0,"r":0.432292},{"b":0,"g":0,"pos":0.354545,"r":0}],"name":"colorize_1","node_position":{"x":-194,"y":466.5},"type":"colorize"},{"amount":0.1,"name":"warp_1","node_position":{"x":-31,"y":336.5},"type":"warp"},{"intensity":1,"name":"voronoi_0","node_position":{"x":-381,"y":505.5},"scale_x":5,"scale_y":4,"type":"voronoi"}]} \ No newline at end of file diff --git a/examples/wooden_floor.ptex b/examples/wooden_floor.ptex index 3c85226..ee6d911 100644 --- a/examples/wooden_floor.ptex +++ b/examples/wooden_floor.ptex @@ -1 +1 @@ -{"connections":[{"from":"bricks_0","from_port":0,"to":"colorize_0","to_port":0},{"from":"colorize_0","from_port":0,"to":"blend_0","to_port":0},{"from":"perlin_0","from_port":0,"to":"blend_0","to_port":1},{"from":"blend_0","from_port":0,"to":"Material","to_port":0},{"from":"blend_0","from_port":0,"to":"colorize_1","to_port":0},{"from":"colorize_1","from_port":0,"to":"normal_map_0","to_port":0},{"from":"normal_map_0","from_port":0,"to":"Material","to_port":4},{"from":"blend_0","from_port":0,"to":"Material","to_port":2},{"from":"uniform_0","from_port":0,"to":"Material","to_port":1},{"from":"blend_0","from_port":0,"to":"transform_0","to_port":0},{"from":"uniform_0","from_port":0,"to":"combine_0","to_port":0},{"from":"blend_0","from_port":0,"to":"combine_0","to_port":1},{"from":"combine_0","from_port":0,"to":"export_0","to_port":0}],"nodes":[{"gradient":[{"b":0,"g":0,"pos":0,"r":0},{"b":0.213623,"g":0.391325,"pos":0.145455,"r":0.651042}],"name":"colorize_0","node_position":{"x":524,"y":-100.75},"type":"colorize"},{"bevel":0,"columns":1,"mortar":0.05,"name":"bricks_0","node_position":{"x":334,"y":-13.75},"row_offset":0.5,"rows":10,"type":"bricks"},{"amount":0.5,"blend_type":0,"name":"blend_0","node_position":{"x":535,"y":2.25},"type":"blend"},{"iterations":7,"name":"perlin_0","node_position":{"x":327,"y":145.25},"persistence":0.75,"scale_x":4,"scale_y":20,"type":"perlin"},{"name":"transform_0","node_position":{"x":527,"y":115},"repeat":true,"rotate":90,"scale_x":1,"scale_y":1,"translate_x":0,"translate_y":0,"type":"transform"},{"mix":4,"name":"pattern_0","node_position":{"x":515,"y":294},"type":"pattern","x_scale":1,"x_wave":2,"y_scale":1,"y_wave":2},{"amount":0.5,"name":"normal_map_0","node_position":{"x":740,"y":135.25},"type":"normal_map"},{"gradient":[{"b":1,"g":1,"pos":0,"r":1},{"b":0,"g":0,"pos":1,"r":0}],"name":"colorize_1","node_position":{"x":710,"y":208.25},"type":"colorize"},{"color":{"a":1,"b":0,"g":0,"r":0,"type":"Color"},"name":"uniform_0","node_position":{"x":718,"y":73},"type":"uniform"},{"albedo_color":{"a":1,"b":1,"g":1,"r":1,"type":"Color"},"ao_light_affect":1,"depth_scale":1,"emission_energy":1,"metallic":1,"name":"Material","node_position":{"x":930,"y":38},"normal_scale":1,"roughness":1,"type":"material"},{"name":"combine_0","node_position":{"x":866,"y":-78},"type":"combine"},{"name":"export_0","node_position":{"x":1053,"y":-62},"suffix":"mr","type":"export"}]} \ No newline at end of file +{"connections":[{"from":"bricks_0","from_port":0,"to":"colorize_0","to_port":0},{"from":"colorize_0","from_port":0,"to":"blend_0","to_port":0},{"from":"blend_0","from_port":0,"to":"Material","to_port":0},{"from":"blend_0","from_port":0,"to":"colorize_1","to_port":0},{"from":"colorize_1","from_port":0,"to":"normal_map_0","to_port":0},{"from":"normal_map_0","from_port":0,"to":"Material","to_port":4},{"from":"blend_0","from_port":0,"to":"Material","to_port":2},{"from":"uniform_0","from_port":0,"to":"Material","to_port":1},{"from":"blend_0","from_port":0,"to":"transform_0","to_port":0},{"from":"uniform_0","from_port":0,"to":"combine_0","to_port":0},{"from":"blend_0","from_port":0,"to":"combine_0","to_port":1},{"from":"combine_0","from_port":0,"to":"export_0","to_port":0},{"from":"transform_1","from_port":0,"to":"blend_0","to_port":1},{"from":"perlin_0","from_port":0,"to":"transform_1","to_port":0},{"from":"bricks_0","from_port":1,"to":"decompose_0","to_port":0},{"from":"decompose_0","from_port":0,"to":"transform_1","to_port":1},{"from":"decompose_0","from_port":1,"to":"transform_1","to_port":2}],"nodes":[{"gradient":[{"b":0,"g":0,"pos":0,"r":0},{"b":0.213623,"g":0.391325,"pos":0.145455,"r":0.651042}],"name":"colorize_0","node_position":{"x":524,"y":-100.75},"type":"colorize"},{"amount":0.5,"name":"normal_map_0","node_position":{"x":740,"y":135.25},"type":"normal_map"},{"gradient":[{"b":1,"g":1,"pos":0,"r":1},{"b":0,"g":0,"pos":1,"r":0}],"name":"colorize_1","node_position":{"x":710,"y":208.25},"type":"colorize"},{"color":{"a":1,"b":0,"g":0,"r":0,"type":"Color"},"name":"uniform_0","node_position":{"x":718,"y":73},"type":"uniform"},{"albedo_color":{"a":1,"b":1,"g":1,"r":1,"type":"Color"},"ao_light_affect":1,"depth_scale":1,"emission_energy":1,"metallic":1,"name":"Material","node_position":{"x":930,"y":38},"normal_scale":1,"roughness":1,"type":"material"},{"name":"combine_0","node_position":{"x":866,"y":-78},"type":"combine"},{"name":"export_0","node_position":{"x":1053,"y":-62},"suffix":"mr","type":"export"},{"amount":0.5,"blend_type":0,"name":"blend_0","node_position":{"x":535,"y":2.25},"type":"blend"},{"name":"transform_0","node_position":{"x":527,"y":115},"repeat":true,"rotate":90,"scale_x":1,"scale_y":1,"translate_x":0,"translate_y":0,"type":"transform"},{"iterations":7,"name":"perlin_0","node_position":{"x":69,"y":81.25},"persistence":0.75,"scale_x":4,"scale_y":20,"type":"perlin"},{"name":"decompose_0","node_position":{"x":97,"y":236},"type":"decompose"},{"bevel":0,"columns":1,"mortar":0.02,"name":"bricks_0","node_position":{"x":79,"y":-124.75},"pattern":0,"repeat":1,"row_offset":0.5,"rows":10,"type":"bricks"},{"name":"transform_1","node_position":{"x":290,"y":120},"repeat":true,"rotate":0,"scale_x":1,"scale_y":1,"translate_x":1,"translate_y":1,"type":"transform"}]} \ No newline at end of file