diff --git a/addons/procedural_material/graph_edit.gd b/addons/procedural_material/graph_edit.gd index b01a020..0f13114 100644 --- a/addons/procedural_material/graph_edit.gd +++ b/addons/procedural_material/graph_edit.gd @@ -56,3 +56,41 @@ func generate_shader(node, shader_type = 0): #print("GENERATED SHADER:\n"+shader_code) code += shader_code return code + +func setup_material(shader_material, textures, shader_code): + for k in textures.keys(): + shader_material.set_shader_param(k+"_tex", textures[k]) + shader_material.shader.code = shader_code + + +func export_texture(node, filename, size = 256): + if node != null: + $SaveViewport.size = Vector2(size, size) + $SaveViewport/ColorRect.rect_position = Vector2(0, 0) + $SaveViewport/ColorRect.rect_size = Vector2(size, size) + setup_material($SaveViewport/ColorRect.material, node.get_textures(), generate_shader(node)) + $SaveViewport.render_target_update_mode = Viewport.UPDATE_ONCE + $SaveViewport.update_worlds() + $SaveViewport/Timer.start() + yield($SaveViewport/Timer, "timeout") + var viewport_texture = $SaveViewport.get_texture() + var viewport_image = viewport_texture.get_data() + viewport_image.save_png("res://generated_image.png") + +func precalculate_texture(node, size, object, method, args): + if node == null: + return null + $SaveViewport.size = Vector2(size, size) + $SaveViewport/ColorRect.rect_position = Vector2(0, 0) + $SaveViewport/ColorRect.rect_size = Vector2(size, size) + setup_material($SaveViewport/ColorRect.material, node.get_textures(), generate_shader(node)) + $SaveViewport.render_target_update_mode = Viewport.UPDATE_ONCE + $SaveViewport.update_worlds() + $SaveViewport/Timer.start() + yield($SaveViewport/Timer, "timeout") + var viewport_texture = $SaveViewport.get_texture() + var texture = ImageTexture.new() + texture.create_from_image(viewport_texture.get_data()) + args.append(texture) + object.callv(method, args) + diff --git a/addons/procedural_material/nodes/material.gd b/addons/procedural_material/nodes/material.gd index d018104..5c5488a 100644 --- a/addons/procedural_material/nodes/material.gd +++ b/addons/procedural_material/nodes/material.gd @@ -1,9 +1,18 @@ tool extends "res://addons/procedural_material/node_base.gd" +var texture_albedo = null +var texture_metallic = null +var texture_roughness = null +var texture_emission = null +var texture_normal_map = null +var texture_depth_map = null + +var render_queue = [] # render queue for generated textures +var material_list = [] # materials to be updatedwith generated textures + func _ready(): - set_slot(0, true, 0, Color(0.5, 0.5, 1), false, 0, Color(0.5, 0.5, 1)) - set_slot(1, true, 0, Color(0.5, 0.5, 1), false, 0, Color(0.5, 0.5, 1)) + pass func _get_shader_code(uv): var rv = { defs="", code="", f="0.0" } @@ -21,3 +30,53 @@ func _get_shader_code(uv): func _get_state_variables(): return [ ] + +func update_materials(ml): + material_list = ml + render_queue = [ + { port= 0, texture= "albedo" }, + { port= 1, texture= "metallic" }, + { port= 2, texture= "roughness" }, + { port= 3, texture= "emission" }, + { port= 4, texture= "normal_map" }, + { port= 5, texture= "depth_map" } + ] + process_render_queue() + +func process_render_queue(): + while !render_queue.empty(): + var job = render_queue.pop_front() + var source = get_source(job.port) + if source != null: + get_parent().precalculate_texture(source, 1024, self, "store_texture", [ job.texture ]) + return + else: + set("texture_"+job.texture, null) + do_update_materials() + +func store_texture(texture_name, texture): + set("texture_"+texture_name, texture) + process_render_queue() + +func do_update_materials(): + for m in material_list: + if m is SpatialMaterial: + m.albedo_texture = texture_albedo + m.metallic_texture = texture_metallic + m.roughness_texture = texture_roughness + if texture_emission != null: + m.emission_enabled = true + m.emission_texture = texture_emission + else: + m.emission_enabled = false + if texture_normal_map != null: + m.normal_enabled = true + m.normal_texture = texture_normal_map + else: + m.normal_enabled = false + if texture_depth_map != null: + m.depth_enabled = true + m.depth_texture = texture_depth_map + else: + m.depth_enabled = false + diff --git a/addons/procedural_material/nodes/material.tscn b/addons/procedural_material/nodes/material.tscn index 4c6a268..a03f290 100644 --- a/addons/procedural_material/nodes/material.tscn +++ b/addons/procedural_material/nodes/material.tscn @@ -39,8 +39,32 @@ slot/1/left_color = Color( 0.5, 0.5, 1, 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/right_enabled = false +slot/2/right_type = 0 +slot/2/right_color = Color( 0.498039, 0.498039, 1, 1 ) +slot/3/left_enabled = true +slot/3/left_type = 0 +slot/3/left_color = Color( 0.498039, 0.498039, 1, 1 ) +slot/3/right_enabled = false +slot/3/right_type = 0 +slot/3/right_color = Color( 0.498039, 0.498039, 1, 1 ) +slot/4/left_enabled = true +slot/4/left_type = 0 +slot/4/left_color = Color( 0.498039, 0.498039, 1, 1 ) +slot/4/right_enabled = false +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/right_enabled = false +slot/5/right_type = 0 +slot/5/right_color = Color( 0.498039, 0.498039, 1, 1 ) script = ExtResource( 1 ) -_sections_unfolded = [ "Theme" ] +_sections_unfolded = [ "Theme", "slot", "slot/2", "slot/3", "slot/4", "slot/5" ] [node name="Label1" type="Label" parent="." index="0"] @@ -79,9 +103,93 @@ mouse_filter = 2 mouse_default_cursor_shape = 0 size_flags_horizontal = 1 size_flags_vertical = 4 +text = "Metallic" +percent_visible = 1.0 +lines_skipped = 0 +max_lines_visible = -1 + +[node name="Label3" 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 = 95.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 = "Roughness" +percent_visible = 1.0 +lines_skipped = 0 +max_lines_visible = -1 + +[node name="Label4" type="Label" 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 = 68.0 +margin_right = 95.0 +margin_bottom = 82.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 = "Emission" +percent_visible = 1.0 +lines_skipped = 0 +max_lines_visible = -1 + +[node name="Label5" type="Label" 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 = 83.0 +margin_right = 95.0 +margin_bottom = 97.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 = "Normal map" percent_visible = 1.0 lines_skipped = 0 max_lines_visible = -1 +[node name="Label6" type="Label" 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 = 98.0 +margin_right = 95.0 +margin_bottom = 112.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 = "Depth map" +percent_visible = 1.0 +lines_skipped = 0 +max_lines_visible = -1 + diff --git a/addons/procedural_material/nodes/transform.tscn b/addons/procedural_material/nodes/transform.tscn index 1f6383c..8de38ef 100644 --- a/addons/procedural_material/nodes/transform.tscn +++ b/addons/procedural_material/nodes/transform.tscn @@ -5,7 +5,7 @@ [sub_resource type="Theme" id=1] -[node name="Transform" type="GraphNode" index="0"] +[node name="Transform" type="GraphNode"] anchor_left = 0.0 anchor_top = 0.0 diff --git a/addons/procedural_material/nodes/warp.tscn b/addons/procedural_material/nodes/warp.tscn index 14d3aac..2b7697a 100644 --- a/addons/procedural_material/nodes/warp.tscn +++ b/addons/procedural_material/nodes/warp.tscn @@ -5,7 +5,7 @@ [sub_resource type="Theme" id=1] -[node name="Warp" type="GraphNode" index="0"] +[node name="Warp" type="GraphNode"] anchor_left = 0.0 anchor_top = 0.0 @@ -120,6 +120,4 @@ _sections_unfolded = [ "Caret", "Placeholder" ] [connection signal="close_request" from="." to="." method="queue_free"] -[connection signal="text_changed" from="amount" to="." method="_on_Rotate_text_changed"] - diff --git a/addons/procedural_material/pm_editor.gd b/addons/procedural_material/pm_editor.gd index ab245f0..039d334 100644 --- a/addons/procedural_material/pm_editor.gd +++ b/addons/procedural_material/pm_editor.gd @@ -5,7 +5,6 @@ var popup_menu = null var popup_position = Vector2(0, 0) var selected_node = null -var preview_material = null var texture_preview_material = null const MENU = [ @@ -28,7 +27,6 @@ const MENU = [ func _ready(): # Duplicate the material we'll modify and store the shaders - preview_material = $Preview/Preview.preview_material $Preview/Preview/SelectedPreview.material = $Preview/Preview/SelectedPreview.material.duplicate(true) texture_preview_material = $Preview/Preview/SelectedPreview.material $GraphEdit.add_valid_connection_type(0, 0) @@ -137,34 +135,16 @@ func save_file(filename): file.store_string(to_json(data)) file.close() -func export_texture(): - var size = 256 - $SaveViewport.size = Vector2(size, size) - $SaveViewport/ColorRect.rect_position = Vector2(0, 0) - $SaveViewport/ColorRect.rect_size = Vector2(size, size) - setup_material($SaveViewport/ColorRect.material, selected_node.get_textures(), $GraphEdit.generate_shader(selected_node)) - $SaveViewport.render_target_update_mode = Viewport.UPDATE_ONCE - #$SaveViewport/ColorRect.update() - $SaveViewport.update_worlds() - $SaveViewport/Timer.start() - yield($SaveViewport/Timer, "timeout") - var viewport_texture = $SaveViewport.get_texture() - var viewport_image = viewport_texture.get_data() - viewport_image.save_png("res://generated_image.png") - -func setup_material(shader_material, textures, shader_code): - for k in textures.keys(): - #print("Setting param "+k+" to "+str(textures[k])) - shader_material.set_shader_param(k+"_tex", textures[k]) - shader_material.shader.code = shader_code +func export_texture(size = 256): + $GraphEdit.export_texture(selected_node, "res://generated_image.png", size) func generate_shader(): - setup_material(preview_material, $GraphEdit/Material.get_textures(), $GraphEdit.generate_shader($GraphEdit/Material, 1)) + $GraphEdit/Material.update_materials($Preview/Preview.get_materials()) if selected_node != null: - setup_material(texture_preview_material, selected_node.get_textures(), $GraphEdit.generate_shader(selected_node)) + $GraphEdit.setup_material(texture_preview_material, selected_node.get_textures(), $GraphEdit.generate_shader(selected_node)) func _on_GraphEdit_node_selected(node): - if selected_node != node: + if selected_node != node && node is GraphNode: selected_node = node - setup_material(texture_preview_material, selected_node.get_textures(), $GraphEdit.generate_shader(selected_node)) + $GraphEdit.setup_material(texture_preview_material, selected_node.get_textures(), $GraphEdit.generate_shader(selected_node)) diff --git a/addons/procedural_material/pm_editor.tscn b/addons/procedural_material/pm_editor.tscn index 4529150..5430801 100644 --- a/addons/procedural_material/pm_editor.tscn +++ b/addons/procedural_material/pm_editor.tscn @@ -6,298 +6,6 @@ [ext_resource path="res://addons/procedural_material/preview.gd" type="Script" id=4] [ext_resource path="res://addons/procedural_material/panoramas/park.hdr" type="Texture" id=5] -[sub_resource type="Animation" id=3] - -length = 1.0 -loop = true -step = 0.1 -tracks/0/type = "value" -tracks/0/path = NodePath("MaterialPreview/Objects:rotation_degrees") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/keys = { -"times": PoolRealArray( 0, 1 ), -"transitions": PoolRealArray( 1, 1 ), -"update": 0, -"values": [ Vector3( 0, 0, 0 ), Vector3( 0, 360, 0 ) ] -} - -[sub_resource type="ArrayMesh" id=1] - -resource_name = "Cube" -blend_shape_mode = 1 -custom_aabb = AABB( 0, 0, 0, 0, 0, 0 ) -surfaces/0 = { -"aabb": AABB( -1, -1, -1, 2.00001, 2, 2 ), -"array_data": PoolByteArray( 0, 60, 0, 188, 255, 187, 0, 60, 0, 129, 0, 0, 126, 0, 0, 129, 252, 59, 251, 59, 0, 188, 0, 188, 255, 59, 0, 60, 0, 129, 0, 0, 127, 0, 0, 129, 4, 18, 60, 25, 0, 60, 0, 188, 0, 60, 0, 60, 0, 129, 0, 0, 127, 0, 0, 129, 252, 59, 60, 25, 255, 187, 0, 188, 0, 188, 0, 60, 0, 129, 0, 0, 127, 0, 0, 129, 4, 18, 251, 59, 0, 60, 0, 60, 255, 187, 0, 60, 0, 127, 0, 0, 0, 0, 129, 129, 252, 59, 251, 59, 0, 188, 0, 60, 255, 59, 0, 60, 0, 127, 0, 0, 0, 0, 129, 129, 4, 18, 60, 25, 255, 187, 0, 60, 0, 188, 0, 60, 0, 127, 0, 0, 0, 0, 129, 129, 252, 59, 60, 25, 255, 59, 0, 60, 0, 60, 0, 60, 0, 127, 0, 0, 0, 0, 129, 129, 4, 18, 251, 59, 0, 60, 0, 188, 255, 187, 0, 60, 127, 0, 0, 0, 0, 0, 129, 129, 252, 59, 251, 59, 255, 59, 0, 60, 0, 60, 0, 60, 127, 0, 0, 0, 0, 0, 129, 129, 4, 18, 60, 25, 0, 60, 0, 60, 255, 187, 0, 60, 127, 0, 0, 0, 0, 0, 129, 129, 252, 59, 60, 25, 0, 60, 0, 188, 0, 60, 0, 60, 127, 0, 0, 0, 0, 0, 129, 129, 4, 18, 251, 59, 0, 60, 0, 188, 0, 60, 0, 60, 0, 0, 127, 0, 127, 0, 0, 129, 252, 59, 251, 59, 0, 188, 0, 60, 255, 59, 0, 60, 0, 0, 127, 0, 127, 0, 0, 129, 4, 18, 60, 25, 255, 59, 0, 60, 0, 60, 0, 60, 0, 0, 127, 0, 127, 0, 0, 129, 252, 59, 60, 25, 0, 188, 0, 188, 255, 59, 0, 60, 0, 0, 127, 0, 126, 0, 0, 129, 4, 18, 251, 59, 0, 188, 0, 188, 255, 59, 0, 60, 129, 0, 0, 0, 0, 0, 127, 129, 252, 59, 251, 59, 255, 187, 0, 60, 0, 188, 0, 60, 129, 0, 0, 0, 0, 0, 126, 129, 4, 18, 60, 25, 0, 188, 0, 60, 255, 59, 0, 60, 129, 0, 0, 0, 0, 0, 127, 129, 252, 59, 60, 25, 255, 187, 0, 188, 0, 188, 0, 60, 129, 0, 0, 0, 0, 0, 127, 129, 4, 18, 251, 59, 0, 60, 0, 60, 255, 187, 0, 60, 0, 0, 129, 0, 129, 0, 0, 129, 4, 18, 60, 25, 255, 187, 0, 188, 0, 188, 0, 60, 0, 0, 129, 0, 130, 0, 0, 129, 252, 59, 251, 59, 0, 60, 0, 188, 255, 187, 0, 60, 0, 0, 129, 0, 129, 0, 0, 129, 4, 18, 251, 59, 255, 187, 0, 60, 0, 188, 0, 60, 0, 0, 129, 0, 129, 0, 0, 129, 252, 59, 60, 25 ), -"array_index_data": PoolByteArray( 0, 0, 1, 0, 2, 0, 0, 0, 3, 0, 1, 0, 4, 0, 5, 0, 6, 0, 4, 0, 7, 0, 5, 0, 8, 0, 9, 0, 10, 0, 8, 0, 11, 0, 9, 0, 12, 0, 13, 0, 14, 0, 12, 0, 15, 0, 13, 0, 16, 0, 17, 0, 18, 0, 16, 0, 19, 0, 17, 0, 20, 0, 21, 0, 22, 0, 20, 0, 23, 0, 21, 0 ), -"blend_shape_data": [ ], -"format": 98071, -"index_count": 36, -"name": "Material", -"primitive": 4, -"skeleton_aabb": [ ], -"vertex_count": 24 -} -_sections_unfolded = [ "surface_1" ] - -[sub_resource type="SpatialMaterial" id=12] - -render_priority = 0 -flags_transparent = false -flags_unshaded = false -flags_vertex_lighting = false -flags_no_depth_test = false -flags_use_point_size = false -flags_world_triplanar = false -flags_fixed_size = false -flags_albedo_tex_force_srgb = false -vertex_color_use_as_albedo = false -vertex_color_is_srgb = false -params_diffuse_mode = 0 -params_specular_mode = 0 -params_blend_mode = 0 -params_cull_mode = 0 -params_depth_draw_mode = 0 -params_line_width = 1.0 -params_point_size = 1.0 -params_billboard_mode = 0 -params_grow = false -params_use_alpha_scissor = false -albedo_color = Color( 1, 1, 1, 1 ) -metallic = 0.0 -metallic_specular = 0.5 -metallic_texture_channel = 0 -roughness = 0.0 -roughness_texture_channel = 0 -emission_enabled = false -normal_enabled = false -rim_enabled = false -clearcoat_enabled = false -anisotropy_enabled = false -ao_enabled = false -depth_enabled = false -subsurf_scatter_enabled = false -transmission_enabled = false -refraction_enabled = false -detail_enabled = false -uv1_scale = Vector3( 1, 1, 1 ) -uv1_offset = Vector3( 0, 0, 0 ) -uv1_triplanar = false -uv1_triplanar_sharpness = 1.0 -uv2_scale = Vector3( 1, 1, 1 ) -uv2_offset = Vector3( 0, 0, 0 ) -uv2_triplanar = false -uv2_triplanar_sharpness = 1.0 -proximity_fade_enable = false -distance_fade_enable = false - -[sub_resource type="ArrayMesh" id=2] - -resource_name = "Cylinder" -blend_shape_mode = 1 -custom_aabb = AABB( 0, 0, 0, 0, 0, 0 ) -surfaces/0 = { -"aabb": AABB( -1, -1, -1, 2, 2, 2 ), -"array_data": PoolByteArray( 0, 0, 0, 188, 0, 188, 0, 60, 0, 172, 162, 0, 129, 0, 0, 129, 201, 58, 209, 59, 31, 54, 0, 60, 100, 187, 0, 60, 36, 84, 169, 0, 139, 0, 208, 129, 73, 57, 198, 37, 0, 0, 0, 60, 0, 188, 0, 60, 0, 84, 162, 0, 129, 0, 0, 129, 201, 58, 198, 37, 31, 54, 0, 188, 100, 187, 0, 60, 36, 172, 169, 0, 139, 0, 208, 129, 73, 57, 209, 59, 168, 57, 0, 60, 168, 185, 0, 60, 67, 84, 189, 0, 167, 0, 167, 129, 147, 55, 198, 37, 168, 57, 0, 188, 168, 185, 0, 60, 67, 172, 189, 0, 167, 0, 167, 129, 147, 55, 209, 59, 100, 59, 0, 60, 31, 182, 0, 60, 87, 84, 220, 0, 208, 0, 139, 129, 147, 52, 198, 37, 100, 59, 0, 188, 31, 182, 0, 60, 87, 172, 220, 0, 208, 0, 139, 129, 147, 52, 209, 59, 0, 60, 0, 60, 0, 0, 0, 60, 94, 84, 0, 0, 0, 0, 130, 129, 77, 46, 198, 37, 0, 60, 0, 188, 0, 0, 0, 60, 94, 172, 0, 0, 0, 0, 129, 129, 77, 46, 209, 59, 100, 59, 0, 60, 31, 54, 0, 60, 87, 84, 36, 0, 48, 0, 139, 129, 178, 173, 198, 37, 100, 59, 0, 188, 31, 54, 0, 60, 87, 172, 36, 0, 48, 0, 139, 129, 178, 173, 209, 59, 168, 57, 0, 60, 168, 57, 0, 60, 67, 84, 67, 0, 89, 0, 167, 129, 108, 180, 198, 37, 168, 57, 0, 188, 168, 57, 0, 60, 67, 172, 67, 0, 89, 0, 167, 129, 108, 180, 209, 59, 31, 54, 0, 60, 100, 59, 0, 60, 36, 84, 87, 0, 117, 0, 208, 129, 108, 183, 198, 37, 31, 54, 0, 188, 100, 59, 0, 60, 36, 172, 87, 0, 117, 0, 208, 129, 108, 183, 209, 59, 0, 0, 0, 60, 0, 60, 0, 60, 0, 84, 94, 0, 127, 0, 0, 129, 54, 185, 198, 37, 0, 0, 0, 188, 0, 60, 0, 60, 0, 172, 94, 0, 127, 0, 0, 129, 54, 185, 209, 59, 31, 182, 0, 60, 100, 59, 0, 60, 220, 84, 87, 0, 117, 0, 48, 129, 182, 186, 198, 37, 31, 182, 0, 188, 100, 59, 0, 60, 220, 172, 87, 0, 117, 0, 48, 129, 182, 186, 209, 59, 168, 185, 0, 60, 168, 57, 0, 60, 189, 84, 67, 0, 89, 0, 89, 129, 27, 188, 198, 37, 168, 185, 0, 188, 168, 57, 0, 60, 189, 172, 67, 0, 89, 0, 89, 129, 27, 188, 209, 59, 100, 187, 0, 60, 31, 54, 0, 60, 169, 84, 36, 0, 48, 0, 117, 129, 219, 188, 198, 37, 100, 187, 0, 188, 31, 54, 0, 60, 169, 172, 36, 0, 48, 0, 117, 129, 219, 188, 209, 59, 0, 188, 0, 60, 0, 0, 0, 60, 162, 84, 0, 0, 11, 12, 125, 129, 155, 189, 198, 37, 0, 188, 0, 188, 0, 0, 0, 60, 162, 172, 0, 0, 11, 244, 125, 129, 155, 189, 209, 59, 0, 188, 0, 188, 0, 0, 0, 60, 162, 172, 0, 0, 245, 12, 125, 129, 100, 62, 209, 59, 100, 187, 0, 60, 31, 182, 0, 60, 169, 84, 220, 0, 208, 0, 117, 129, 164, 61, 198, 37, 0, 188, 0, 60, 0, 0, 0, 60, 162, 84, 0, 0, 245, 244, 125, 129, 100, 62, 198, 37, 100, 187, 0, 188, 31, 182, 0, 60, 169, 172, 220, 0, 208, 0, 117, 129, 164, 61, 209, 59, 168, 185, 0, 60, 168, 185, 0, 60, 189, 84, 189, 0, 167, 0, 89, 129, 228, 60, 198, 37, 168, 185, 0, 188, 168, 185, 0, 60, 189, 172, 189, 0, 167, 0, 89, 129, 228, 60, 209, 59, 31, 54, 0, 60, 100, 187, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 81, 57, 138, 43, 31, 182, 0, 60, 100, 187, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 201, 52, 138, 43, 0, 0, 0, 60, 0, 188, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 181, 55, 198, 37, 168, 185, 0, 60, 168, 185, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 157, 48, 50, 49, 100, 187, 0, 60, 31, 182, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 56, 41, 19, 53, 0, 188, 0, 60, 0, 0, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 140, 28, 0, 56, 100, 187, 0, 60, 31, 54, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 56, 41, 118, 57, 168, 185, 0, 60, 168, 57, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 157, 48, 179, 58, 31, 182, 0, 60, 100, 59, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 201, 52, 135, 59, 0, 0, 0, 60, 0, 60, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 181, 55, 209, 59, 31, 54, 0, 60, 100, 59, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 81, 57, 135, 59, 168, 57, 0, 60, 168, 57, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 142, 58, 179, 58, 100, 59, 0, 60, 31, 54, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 98, 59, 118, 57, 0, 60, 0, 60, 0, 0, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 172, 59, 0, 56, 100, 59, 0, 60, 31, 182, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 98, 59, 19, 53, 168, 57, 0, 60, 168, 185, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 142, 58, 50, 49, 31, 182, 0, 60, 100, 187, 0, 60, 220, 84, 169, 0, 139, 0, 48, 129, 36, 60, 198, 37, 31, 182, 0, 188, 100, 187, 0, 60, 220, 172, 169, 0, 139, 0, 48, 129, 36, 60, 209, 59, 0, 0, 0, 188, 0, 188, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 181, 55, 198, 37, 168, 57, 0, 188, 168, 185, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 142, 58, 50, 49, 31, 54, 0, 188, 100, 187, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 81, 57, 138, 43, 100, 59, 0, 188, 31, 182, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 98, 59, 19, 53, 0, 60, 0, 188, 0, 0, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 172, 59, 0, 56, 100, 59, 0, 188, 31, 54, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 98, 59, 118, 57, 168, 57, 0, 188, 168, 57, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 142, 58, 179, 58, 31, 54, 0, 188, 100, 59, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 81, 57, 135, 59, 0, 0, 0, 188, 0, 60, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 181, 55, 209, 59, 31, 182, 0, 188, 100, 59, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 201, 52, 135, 59, 168, 185, 0, 188, 168, 57, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 157, 48, 179, 58, 100, 187, 0, 188, 31, 54, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 56, 41, 118, 57, 0, 188, 0, 188, 0, 0, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 140, 28, 0, 56, 100, 187, 0, 188, 31, 182, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 56, 41, 19, 53, 168, 185, 0, 188, 168, 185, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 157, 48, 50, 49, 31, 182, 0, 188, 100, 187, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 201, 52, 138, 43 ), -"array_index_data": PoolByteArray( 0, 0, 1, 0, 2, 0, 0, 0, 3, 0, 1, 0, 3, 0, 4, 0, 1, 0, 3, 0, 5, 0, 4, 0, 5, 0, 6, 0, 4, 0, 5, 0, 7, 0, 6, 0, 7, 0, 8, 0, 6, 0, 7, 0, 9, 0, 8, 0, 9, 0, 10, 0, 8, 0, 9, 0, 11, 0, 10, 0, 11, 0, 12, 0, 10, 0, 11, 0, 13, 0, 12, 0, 13, 0, 14, 0, 12, 0, 13, 0, 15, 0, 14, 0, 15, 0, 16, 0, 14, 0, 15, 0, 17, 0, 16, 0, 17, 0, 18, 0, 16, 0, 17, 0, 19, 0, 18, 0, 19, 0, 20, 0, 18, 0, 19, 0, 21, 0, 20, 0, 21, 0, 22, 0, 20, 0, 21, 0, 23, 0, 22, 0, 23, 0, 24, 0, 22, 0, 23, 0, 25, 0, 24, 0, 26, 0, 27, 0, 28, 0, 26, 0, 29, 0, 27, 0, 29, 0, 30, 0, 27, 0, 29, 0, 31, 0, 30, 0, 32, 0, 33, 0, 34, 0, 32, 0, 35, 0, 33, 0, 32, 0, 36, 0, 35, 0, 32, 0, 37, 0, 36, 0, 32, 0, 38, 0, 37, 0, 32, 0, 39, 0, 38, 0, 32, 0, 40, 0, 39, 0, 32, 0, 41, 0, 40, 0, 32, 0, 42, 0, 41, 0, 32, 0, 43, 0, 42, 0, 32, 0, 44, 0, 43, 0, 32, 0, 45, 0, 44, 0, 32, 0, 46, 0, 45, 0, 32, 0, 47, 0, 46, 0, 31, 0, 48, 0, 30, 0, 31, 0, 49, 0, 48, 0, 49, 0, 2, 0, 48, 0, 49, 0, 0, 0, 2, 0, 50, 0, 51, 0, 52, 0, 50, 0, 53, 0, 51, 0, 50, 0, 54, 0, 53, 0, 50, 0, 55, 0, 54, 0, 50, 0, 56, 0, 55, 0, 50, 0, 57, 0, 56, 0, 50, 0, 58, 0, 57, 0, 50, 0, 59, 0, 58, 0, 50, 0, 60, 0, 59, 0, 50, 0, 61, 0, 60, 0, 50, 0, 62, 0, 61, 0, 50, 0, 63, 0, 62, 0, 50, 0, 64, 0, 63, 0, 50, 0, 65, 0, 64, 0 ), -"blend_shape_data": [ ], -"format": 98071, -"index_count": 180, -"primitive": 4, -"skeleton_aabb": [ ], -"vertex_count": 66 -} -_sections_unfolded = [ "surface_1" ] - -[sub_resource type="PanoramaSky" id=4] - -radiance_size = 2 -panorama = ExtResource( 5 ) - -[sub_resource type="Environment" id=5] - -background_mode = 2 -background_sky = SubResource( 4 ) -background_sky_custom_fov = 0.0 -background_color = Color( 0, 0, 0, 1 ) -background_energy = 1.0 -background_canvas_max_layer = 0 -ambient_light_color = Color( 0, 0, 0, 1 ) -ambient_light_energy = 1.0 -ambient_light_sky_contribution = 1.0 -fog_enabled = false -fog_color = Color( 0.5, 0.6, 0.7, 1 ) -fog_sun_color = Color( 1, 0.9, 0.7, 1 ) -fog_sun_amount = 0.0 -fog_depth_enabled = true -fog_depth_begin = 10.0 -fog_depth_curve = 1.0 -fog_transmit_enabled = false -fog_transmit_curve = 1.0 -fog_height_enabled = false -fog_height_min = 0.0 -fog_height_max = 100.0 -fog_height_curve = 1.0 -tonemap_mode = 0 -tonemap_exposure = 1.0 -tonemap_white = 1.0 -auto_exposure_enabled = false -auto_exposure_scale = 0.4 -auto_exposure_min_luma = 0.05 -auto_exposure_max_luma = 8.0 -auto_exposure_speed = 0.5 -ss_reflections_enabled = false -ss_reflections_max_steps = 64 -ss_reflections_fade_in = 0.15 -ss_reflections_fade_out = 2.0 -ss_reflections_depth_tolerance = 0.2 -ss_reflections_roughness = true -ssao_enabled = false -ssao_radius = 1.0 -ssao_intensity = 1.0 -ssao_radius2 = 0.0 -ssao_intensity2 = 1.0 -ssao_bias = 0.01 -ssao_light_affect = 0.0 -ssao_color = Color( 0, 0, 0, 1 ) -ssao_quality = 0 -ssao_blur = 3 -ssao_edge_sharpness = 4.0 -dof_blur_far_enabled = false -dof_blur_far_distance = 10.0 -dof_blur_far_transition = 5.0 -dof_blur_far_amount = 0.1 -dof_blur_far_quality = 1 -dof_blur_near_enabled = false -dof_blur_near_distance = 2.0 -dof_blur_near_transition = 1.0 -dof_blur_near_amount = 0.1 -dof_blur_near_quality = 1 -glow_enabled = false -glow_levels/1 = false -glow_levels/2 = false -glow_levels/3 = true -glow_levels/4 = false -glow_levels/5 = true -glow_levels/6 = false -glow_levels/7 = false -glow_intensity = 0.8 -glow_strength = 1.0 -glow_bloom = 0.0 -glow_blend_mode = 2 -glow_hdr_threshold = 1.0 -glow_hdr_scale = 2.0 -glow_bicubic_upscale = false -adjustment_enabled = false -adjustment_brightness = 1.0 -adjustment_contrast = 1.0 -adjustment_saturation = 1.0 -_sections_unfolded = [ "Background" ] - -[sub_resource type="Shader" id=6] - -code = "shader_type canvas_item; - -void fragment() { - COLOR = vec4(1.0); -} -" -_sections_unfolded = [ "Resource" ] - -[sub_resource type="ShaderMaterial" id=7] - -render_priority = 0 -shader = SubResource( 6 ) - -[sub_resource type="Animation" id=8] - -resource_name = "maximize" -length = 0.2 -loop = false -step = 0.1 -tracks/0/type = "value" -tracks/0/path = NodePath("SelectedPreview:rect_position") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/keys = { -"times": PoolRealArray( 0, 0.2 ), -"transitions": PoolRealArray( 1, 1 ), -"update": 0, -"values": [ Vector2( 2, 194 ), Vector2( 2, 2 ) ] -} -tracks/1/type = "value" -tracks/1/path = NodePath("SelectedPreview:rect_size") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/keys = { -"times": PoolRealArray( 0, 0.2 ), -"transitions": PoolRealArray( 1, 1 ), -"update": 0, -"values": [ Vector2( 64, 64 ), Vector2( 256, 256 ) ] -} -tracks/2/type = "value" -tracks/2/path = NodePath("MaterialPreview:render_target_update_mode") -tracks/2/interp = 1 -tracks/2/loop_wrap = true -tracks/2/imported = false -tracks/2/enabled = true -tracks/2/keys = { -"times": PoolRealArray( 0.2 ), -"transitions": PoolRealArray( 1 ), -"update": 1, -"values": [ 0 ] -} - -[sub_resource type="Animation" id=9] - -resource_name = "minimize" -length = 0.2 -loop = false -step = 0.1 -tracks/0/type = "value" -tracks/0/path = NodePath("SelectedPreview:rect_position") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/keys = { -"times": PoolRealArray( 0, 0.2 ), -"transitions": PoolRealArray( 1, 1 ), -"update": 0, -"values": [ Vector2( 2, 2 ), Vector2( 2, 194 ) ] -} -tracks/1/type = "value" -tracks/1/path = NodePath("SelectedPreview:rect_size") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/keys = { -"times": PoolRealArray( 0, 0.2 ), -"transitions": PoolRealArray( 1, 1 ), -"update": 0, -"values": [ Vector2( 256, 256 ), Vector2( 64, 64 ) ] -} -tracks/2/type = "value" -tracks/2/path = NodePath("MaterialPreview:render_target_update_mode") -tracks/2/interp = 1 -tracks/2/loop_wrap = true -tracks/2/imported = false -tracks/2/enabled = true -tracks/2/keys = { -"times": PoolRealArray( 0 ), -"transitions": PoolRealArray( 1 ), -"update": 1, -"values": [ 3 ] -} - [sub_resource type="Shader" id=10] code = "shader_type canvas_item; @@ -468,10 +176,19 @@ vec4 voronoi(vec2 uv, vec2 size, float intensity, int seed) { return vec4(point0, best_distance0*length(size)*intensity, edge_distance); } -vec4 voronoi_0_xyzw(vec2 uv) { return voronoi(uv, vec2(4.000000, 4.000000), 1.000000000, 3766); } +vec4 voronoi_0_xyzw(vec2 uv) { return voronoi(uv, vec2(6.000000, 6.000000), 0.550000000, 1014); } +vec3 colorize_2_gradient(float x) { + if (x < 0.000000000) { + return vec3(0.195312500,0.195312500,0.195312500); + } else if (x < 1.000000000) { + return vec3(0.195312500,0.195312500,0.195312500)+x*vec3(-0.195312500,-0.195312500,-0.195312500); + } + return vec3(0.000000000,0.000000000,0.000000000); +} void fragment() { vec4 voronoi_0_0_xyzw = voronoi_0_xyzw(UV); -COLOR = vec4(vec3(voronoi_0_0_xyzw.z), 1.0); +vec3 colorize_2_0_rgb = colorize_2_gradient(voronoi_0_0_xyzw.z); +COLOR = vec4(colorize_2_0_rgb, 1.0); } " @@ -480,6 +197,301 @@ COLOR = vec4(vec3(voronoi_0_0_xyzw.z), 1.0); render_priority = 0 shader = SubResource( 10 ) +[sub_resource type="Animation" id=3] + +length = 1.0 +loop = true +step = 0.1 +tracks/0/type = "value" +tracks/0/path = NodePath("MaterialPreview/Objects:rotation_degrees") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 1 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ Vector3( 0, 0, 0 ), Vector3( 0, 360, 0 ) ] +} + +[sub_resource type="ArrayMesh" id=1] + +resource_name = "Cube" +blend_shape_mode = 1 +custom_aabb = AABB( 0, 0, 0, 0, 0, 0 ) +surfaces/0 = { +"aabb": AABB( -1, -1, -1, 2.00001, 2, 2 ), +"array_data": PoolByteArray( 0, 60, 0, 188, 255, 187, 0, 60, 0, 129, 0, 0, 126, 0, 0, 129, 252, 59, 251, 59, 0, 188, 0, 188, 255, 59, 0, 60, 0, 129, 0, 0, 127, 0, 0, 129, 4, 18, 60, 25, 0, 60, 0, 188, 0, 60, 0, 60, 0, 129, 0, 0, 127, 0, 0, 129, 252, 59, 60, 25, 255, 187, 0, 188, 0, 188, 0, 60, 0, 129, 0, 0, 127, 0, 0, 129, 4, 18, 251, 59, 0, 60, 0, 60, 255, 187, 0, 60, 0, 127, 0, 0, 0, 0, 129, 129, 252, 59, 251, 59, 0, 188, 0, 60, 255, 59, 0, 60, 0, 127, 0, 0, 0, 0, 129, 129, 4, 18, 60, 25, 255, 187, 0, 60, 0, 188, 0, 60, 0, 127, 0, 0, 0, 0, 129, 129, 252, 59, 60, 25, 255, 59, 0, 60, 0, 60, 0, 60, 0, 127, 0, 0, 0, 0, 129, 129, 4, 18, 251, 59, 0, 60, 0, 188, 255, 187, 0, 60, 127, 0, 0, 0, 0, 0, 129, 129, 252, 59, 251, 59, 255, 59, 0, 60, 0, 60, 0, 60, 127, 0, 0, 0, 0, 0, 129, 129, 4, 18, 60, 25, 0, 60, 0, 60, 255, 187, 0, 60, 127, 0, 0, 0, 0, 0, 129, 129, 252, 59, 60, 25, 0, 60, 0, 188, 0, 60, 0, 60, 127, 0, 0, 0, 0, 0, 129, 129, 4, 18, 251, 59, 0, 60, 0, 188, 0, 60, 0, 60, 0, 0, 127, 0, 127, 0, 0, 129, 252, 59, 251, 59, 0, 188, 0, 60, 255, 59, 0, 60, 0, 0, 127, 0, 127, 0, 0, 129, 4, 18, 60, 25, 255, 59, 0, 60, 0, 60, 0, 60, 0, 0, 127, 0, 127, 0, 0, 129, 252, 59, 60, 25, 0, 188, 0, 188, 255, 59, 0, 60, 0, 0, 127, 0, 126, 0, 0, 129, 4, 18, 251, 59, 0, 188, 0, 188, 255, 59, 0, 60, 129, 0, 0, 0, 0, 0, 127, 129, 252, 59, 251, 59, 255, 187, 0, 60, 0, 188, 0, 60, 129, 0, 0, 0, 0, 0, 126, 129, 4, 18, 60, 25, 0, 188, 0, 60, 255, 59, 0, 60, 129, 0, 0, 0, 0, 0, 127, 129, 252, 59, 60, 25, 255, 187, 0, 188, 0, 188, 0, 60, 129, 0, 0, 0, 0, 0, 127, 129, 4, 18, 251, 59, 0, 60, 0, 60, 255, 187, 0, 60, 0, 0, 129, 0, 129, 0, 0, 129, 4, 18, 60, 25, 255, 187, 0, 188, 0, 188, 0, 60, 0, 0, 129, 0, 130, 0, 0, 129, 252, 59, 251, 59, 0, 60, 0, 188, 255, 187, 0, 60, 0, 0, 129, 0, 129, 0, 0, 129, 4, 18, 251, 59, 255, 187, 0, 60, 0, 188, 0, 60, 0, 0, 129, 0, 129, 0, 0, 129, 252, 59, 60, 25 ), +"array_index_data": PoolByteArray( 0, 0, 1, 0, 2, 0, 0, 0, 3, 0, 1, 0, 4, 0, 5, 0, 6, 0, 4, 0, 7, 0, 5, 0, 8, 0, 9, 0, 10, 0, 8, 0, 11, 0, 9, 0, 12, 0, 13, 0, 14, 0, 12, 0, 15, 0, 13, 0, 16, 0, 17, 0, 18, 0, 16, 0, 19, 0, 17, 0, 20, 0, 21, 0, 22, 0, 20, 0, 23, 0, 21, 0 ), +"blend_shape_data": [ ], +"format": 98071, +"index_count": 36, +"name": "Material", +"primitive": 4, +"skeleton_aabb": [ ], +"vertex_count": 24 +} +_sections_unfolded = [ "surface_1" ] + +[sub_resource type="SpatialMaterial" id=12] + +render_priority = 0 +flags_transparent = false +flags_unshaded = false +flags_vertex_lighting = false +flags_no_depth_test = false +flags_use_point_size = false +flags_world_triplanar = false +flags_fixed_size = false +flags_albedo_tex_force_srgb = false +vertex_color_use_as_albedo = false +vertex_color_is_srgb = false +params_diffuse_mode = 0 +params_specular_mode = 0 +params_blend_mode = 0 +params_cull_mode = 0 +params_depth_draw_mode = 0 +params_line_width = 1.0 +params_point_size = 1.0 +params_billboard_mode = 0 +params_grow = false +params_use_alpha_scissor = false +albedo_color = Color( 1, 1, 1, 1 ) +metallic = 0.0 +metallic_specular = 0.0 +metallic_texture_channel = 0 +roughness = 1.0 +roughness_texture_channel = 0 +emission_enabled = false +normal_enabled = false +rim_enabled = false +clearcoat_enabled = false +anisotropy_enabled = false +ao_enabled = false +depth_enabled = true +depth_scale = 0.05 +depth_deep_parallax = false +subsurf_scatter_enabled = false +transmission_enabled = false +refraction_enabled = false +detail_enabled = false +uv1_scale = Vector3( 1, 1, 1 ) +uv1_offset = Vector3( 0, 0, 0 ) +uv1_triplanar = false +uv1_triplanar_sharpness = 1.0 +uv2_scale = Vector3( 1, 1, 1 ) +uv2_offset = Vector3( 0, 0, 0 ) +uv2_triplanar = false +uv2_triplanar_sharpness = 1.0 +proximity_fade_enable = false +distance_fade_enable = false +_sections_unfolded = [ "Depth" ] + +[sub_resource type="ArrayMesh" id=2] + +resource_name = "Cylinder" +blend_shape_mode = 1 +custom_aabb = AABB( 0, 0, 0, 0, 0, 0 ) +surfaces/0 = { +"aabb": AABB( -1, -1, -1, 2, 2, 2 ), +"array_data": PoolByteArray( 0, 0, 0, 188, 0, 188, 0, 60, 0, 172, 162, 0, 129, 0, 0, 129, 201, 58, 209, 59, 31, 54, 0, 60, 100, 187, 0, 60, 36, 84, 169, 0, 139, 0, 208, 129, 73, 57, 198, 37, 0, 0, 0, 60, 0, 188, 0, 60, 0, 84, 162, 0, 129, 0, 0, 129, 201, 58, 198, 37, 31, 54, 0, 188, 100, 187, 0, 60, 36, 172, 169, 0, 139, 0, 208, 129, 73, 57, 209, 59, 168, 57, 0, 60, 168, 185, 0, 60, 67, 84, 189, 0, 167, 0, 167, 129, 147, 55, 198, 37, 168, 57, 0, 188, 168, 185, 0, 60, 67, 172, 189, 0, 167, 0, 167, 129, 147, 55, 209, 59, 100, 59, 0, 60, 31, 182, 0, 60, 87, 84, 220, 0, 208, 0, 139, 129, 147, 52, 198, 37, 100, 59, 0, 188, 31, 182, 0, 60, 87, 172, 220, 0, 208, 0, 139, 129, 147, 52, 209, 59, 0, 60, 0, 60, 0, 0, 0, 60, 94, 84, 0, 0, 0, 0, 130, 129, 77, 46, 198, 37, 0, 60, 0, 188, 0, 0, 0, 60, 94, 172, 0, 0, 0, 0, 129, 129, 77, 46, 209, 59, 100, 59, 0, 60, 31, 54, 0, 60, 87, 84, 36, 0, 48, 0, 139, 129, 178, 173, 198, 37, 100, 59, 0, 188, 31, 54, 0, 60, 87, 172, 36, 0, 48, 0, 139, 129, 178, 173, 209, 59, 168, 57, 0, 60, 168, 57, 0, 60, 67, 84, 67, 0, 89, 0, 167, 129, 108, 180, 198, 37, 168, 57, 0, 188, 168, 57, 0, 60, 67, 172, 67, 0, 89, 0, 167, 129, 108, 180, 209, 59, 31, 54, 0, 60, 100, 59, 0, 60, 36, 84, 87, 0, 117, 0, 208, 129, 108, 183, 198, 37, 31, 54, 0, 188, 100, 59, 0, 60, 36, 172, 87, 0, 117, 0, 208, 129, 108, 183, 209, 59, 0, 0, 0, 60, 0, 60, 0, 60, 0, 84, 94, 0, 127, 0, 0, 129, 54, 185, 198, 37, 0, 0, 0, 188, 0, 60, 0, 60, 0, 172, 94, 0, 127, 0, 0, 129, 54, 185, 209, 59, 31, 182, 0, 60, 100, 59, 0, 60, 220, 84, 87, 0, 117, 0, 48, 129, 182, 186, 198, 37, 31, 182, 0, 188, 100, 59, 0, 60, 220, 172, 87, 0, 117, 0, 48, 129, 182, 186, 209, 59, 168, 185, 0, 60, 168, 57, 0, 60, 189, 84, 67, 0, 89, 0, 89, 129, 27, 188, 198, 37, 168, 185, 0, 188, 168, 57, 0, 60, 189, 172, 67, 0, 89, 0, 89, 129, 27, 188, 209, 59, 100, 187, 0, 60, 31, 54, 0, 60, 169, 84, 36, 0, 48, 0, 117, 129, 219, 188, 198, 37, 100, 187, 0, 188, 31, 54, 0, 60, 169, 172, 36, 0, 48, 0, 117, 129, 219, 188, 209, 59, 0, 188, 0, 60, 0, 0, 0, 60, 162, 84, 0, 0, 11, 12, 125, 129, 155, 189, 198, 37, 0, 188, 0, 188, 0, 0, 0, 60, 162, 172, 0, 0, 11, 244, 125, 129, 155, 189, 209, 59, 0, 188, 0, 188, 0, 0, 0, 60, 162, 172, 0, 0, 245, 12, 125, 129, 100, 62, 209, 59, 100, 187, 0, 60, 31, 182, 0, 60, 169, 84, 220, 0, 208, 0, 117, 129, 164, 61, 198, 37, 0, 188, 0, 60, 0, 0, 0, 60, 162, 84, 0, 0, 245, 244, 125, 129, 100, 62, 198, 37, 100, 187, 0, 188, 31, 182, 0, 60, 169, 172, 220, 0, 208, 0, 117, 129, 164, 61, 209, 59, 168, 185, 0, 60, 168, 185, 0, 60, 189, 84, 189, 0, 167, 0, 89, 129, 228, 60, 198, 37, 168, 185, 0, 188, 168, 185, 0, 60, 189, 172, 189, 0, 167, 0, 89, 129, 228, 60, 209, 59, 31, 54, 0, 60, 100, 187, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 81, 57, 138, 43, 31, 182, 0, 60, 100, 187, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 201, 52, 138, 43, 0, 0, 0, 60, 0, 188, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 181, 55, 198, 37, 168, 185, 0, 60, 168, 185, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 157, 48, 50, 49, 100, 187, 0, 60, 31, 182, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 56, 41, 19, 53, 0, 188, 0, 60, 0, 0, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 140, 28, 0, 56, 100, 187, 0, 60, 31, 54, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 56, 41, 118, 57, 168, 185, 0, 60, 168, 57, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 157, 48, 179, 58, 31, 182, 0, 60, 100, 59, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 201, 52, 135, 59, 0, 0, 0, 60, 0, 60, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 181, 55, 209, 59, 31, 54, 0, 60, 100, 59, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 81, 57, 135, 59, 168, 57, 0, 60, 168, 57, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 142, 58, 179, 58, 100, 59, 0, 60, 31, 54, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 98, 59, 118, 57, 0, 60, 0, 60, 0, 0, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 172, 59, 0, 56, 100, 59, 0, 60, 31, 182, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 98, 59, 19, 53, 168, 57, 0, 60, 168, 185, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 142, 58, 50, 49, 31, 182, 0, 60, 100, 187, 0, 60, 220, 84, 169, 0, 139, 0, 48, 129, 36, 60, 198, 37, 31, 182, 0, 188, 100, 187, 0, 60, 220, 172, 169, 0, 139, 0, 48, 129, 36, 60, 209, 59, 0, 0, 0, 188, 0, 188, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 181, 55, 198, 37, 168, 57, 0, 188, 168, 185, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 142, 58, 50, 49, 31, 54, 0, 188, 100, 187, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 81, 57, 138, 43, 100, 59, 0, 188, 31, 182, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 98, 59, 19, 53, 0, 60, 0, 188, 0, 0, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 172, 59, 0, 56, 100, 59, 0, 188, 31, 54, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 98, 59, 118, 57, 168, 57, 0, 188, 168, 57, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 142, 58, 179, 58, 31, 54, 0, 188, 100, 59, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 81, 57, 135, 59, 0, 0, 0, 188, 0, 60, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 181, 55, 209, 59, 31, 182, 0, 188, 100, 59, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 201, 52, 135, 59, 168, 185, 0, 188, 168, 57, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 157, 48, 179, 58, 100, 187, 0, 188, 31, 54, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 56, 41, 118, 57, 0, 188, 0, 188, 0, 0, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 140, 28, 0, 56, 100, 187, 0, 188, 31, 182, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 56, 41, 19, 53, 168, 185, 0, 188, 168, 185, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 157, 48, 50, 49, 31, 182, 0, 188, 100, 187, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 201, 52, 138, 43 ), +"array_index_data": PoolByteArray( 0, 0, 1, 0, 2, 0, 0, 0, 3, 0, 1, 0, 3, 0, 4, 0, 1, 0, 3, 0, 5, 0, 4, 0, 5, 0, 6, 0, 4, 0, 5, 0, 7, 0, 6, 0, 7, 0, 8, 0, 6, 0, 7, 0, 9, 0, 8, 0, 9, 0, 10, 0, 8, 0, 9, 0, 11, 0, 10, 0, 11, 0, 12, 0, 10, 0, 11, 0, 13, 0, 12, 0, 13, 0, 14, 0, 12, 0, 13, 0, 15, 0, 14, 0, 15, 0, 16, 0, 14, 0, 15, 0, 17, 0, 16, 0, 17, 0, 18, 0, 16, 0, 17, 0, 19, 0, 18, 0, 19, 0, 20, 0, 18, 0, 19, 0, 21, 0, 20, 0, 21, 0, 22, 0, 20, 0, 21, 0, 23, 0, 22, 0, 23, 0, 24, 0, 22, 0, 23, 0, 25, 0, 24, 0, 26, 0, 27, 0, 28, 0, 26, 0, 29, 0, 27, 0, 29, 0, 30, 0, 27, 0, 29, 0, 31, 0, 30, 0, 32, 0, 33, 0, 34, 0, 32, 0, 35, 0, 33, 0, 32, 0, 36, 0, 35, 0, 32, 0, 37, 0, 36, 0, 32, 0, 38, 0, 37, 0, 32, 0, 39, 0, 38, 0, 32, 0, 40, 0, 39, 0, 32, 0, 41, 0, 40, 0, 32, 0, 42, 0, 41, 0, 32, 0, 43, 0, 42, 0, 32, 0, 44, 0, 43, 0, 32, 0, 45, 0, 44, 0, 32, 0, 46, 0, 45, 0, 32, 0, 47, 0, 46, 0, 31, 0, 48, 0, 30, 0, 31, 0, 49, 0, 48, 0, 49, 0, 2, 0, 48, 0, 49, 0, 0, 0, 2, 0, 50, 0, 51, 0, 52, 0, 50, 0, 53, 0, 51, 0, 50, 0, 54, 0, 53, 0, 50, 0, 55, 0, 54, 0, 50, 0, 56, 0, 55, 0, 50, 0, 57, 0, 56, 0, 50, 0, 58, 0, 57, 0, 50, 0, 59, 0, 58, 0, 50, 0, 60, 0, 59, 0, 50, 0, 61, 0, 60, 0, 50, 0, 62, 0, 61, 0, 50, 0, 63, 0, 62, 0, 50, 0, 64, 0, 63, 0, 50, 0, 65, 0, 64, 0 ), +"blend_shape_data": [ ], +"format": 98071, +"index_count": 180, +"primitive": 4, +"skeleton_aabb": [ ], +"vertex_count": 66 +} +_sections_unfolded = [ "surface_1" ] + +[sub_resource type="PanoramaSky" id=4] + +radiance_size = 2 +panorama = ExtResource( 5 ) + +[sub_resource type="Environment" id=5] + +background_mode = 2 +background_sky = SubResource( 4 ) +background_sky_custom_fov = 0.0 +background_color = Color( 0, 0, 0, 1 ) +background_energy = 1.0 +background_canvas_max_layer = 0 +ambient_light_color = Color( 0, 0, 0, 1 ) +ambient_light_energy = 1.0 +ambient_light_sky_contribution = 1.0 +fog_enabled = false +fog_color = Color( 0.5, 0.6, 0.7, 1 ) +fog_sun_color = Color( 1, 0.9, 0.7, 1 ) +fog_sun_amount = 0.0 +fog_depth_enabled = true +fog_depth_begin = 10.0 +fog_depth_curve = 1.0 +fog_transmit_enabled = false +fog_transmit_curve = 1.0 +fog_height_enabled = false +fog_height_min = 0.0 +fog_height_max = 100.0 +fog_height_curve = 1.0 +tonemap_mode = 0 +tonemap_exposure = 1.0 +tonemap_white = 1.0 +auto_exposure_enabled = false +auto_exposure_scale = 0.4 +auto_exposure_min_luma = 0.05 +auto_exposure_max_luma = 8.0 +auto_exposure_speed = 0.5 +ss_reflections_enabled = false +ss_reflections_max_steps = 64 +ss_reflections_fade_in = 0.15 +ss_reflections_fade_out = 2.0 +ss_reflections_depth_tolerance = 0.2 +ss_reflections_roughness = true +ssao_enabled = false +ssao_radius = 1.0 +ssao_intensity = 1.0 +ssao_radius2 = 0.0 +ssao_intensity2 = 1.0 +ssao_bias = 0.01 +ssao_light_affect = 0.0 +ssao_color = Color( 0, 0, 0, 1 ) +ssao_quality = 0 +ssao_blur = 3 +ssao_edge_sharpness = 4.0 +dof_blur_far_enabled = false +dof_blur_far_distance = 10.0 +dof_blur_far_transition = 5.0 +dof_blur_far_amount = 0.1 +dof_blur_far_quality = 1 +dof_blur_near_enabled = false +dof_blur_near_distance = 2.0 +dof_blur_near_transition = 1.0 +dof_blur_near_amount = 0.1 +dof_blur_near_quality = 1 +glow_enabled = false +glow_levels/1 = false +glow_levels/2 = false +glow_levels/3 = true +glow_levels/4 = false +glow_levels/5 = true +glow_levels/6 = false +glow_levels/7 = false +glow_intensity = 0.8 +glow_strength = 1.0 +glow_bloom = 0.0 +glow_blend_mode = 2 +glow_hdr_threshold = 1.0 +glow_hdr_scale = 2.0 +glow_bicubic_upscale = false +adjustment_enabled = false +adjustment_brightness = 1.0 +adjustment_contrast = 1.0 +adjustment_saturation = 1.0 +_sections_unfolded = [ "Background" ] + +[sub_resource type="Shader" id=13] + +code = "shader_type canvas_item; + +void fragment() { + COLOR = vec4(1.0); +} +" +_sections_unfolded = [ "Resource" ] + +[sub_resource type="ShaderMaterial" id=14] + +render_priority = 0 +shader = SubResource( 13 ) + +[sub_resource type="Animation" id=8] + +resource_name = "maximize" +length = 0.2 +loop = false +step = 0.1 +tracks/0/type = "value" +tracks/0/path = NodePath("SelectedPreview:rect_position") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 0.2 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ Vector2( 2, 194 ), Vector2( 2, 2 ) ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("SelectedPreview:rect_size") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0, 0.2 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ Vector2( 64, 64 ), Vector2( 256, 256 ) ] +} +tracks/2/type = "value" +tracks/2/path = NodePath("MaterialPreview:render_target_update_mode") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/keys = { +"times": PoolRealArray( 0.2 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ 0 ] +} + +[sub_resource type="Animation" id=9] + +resource_name = "minimize" +length = 0.2 +loop = false +step = 0.1 +tracks/0/type = "value" +tracks/0/path = NodePath("SelectedPreview:rect_position") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 0.2 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ Vector2( 2, 2 ), Vector2( 2, 194 ) ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("SelectedPreview:rect_size") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0, 0.2 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ Vector2( 256, 256 ), Vector2( 64, 64 ) ] +} +tracks/2/type = "value" +tracks/2/path = NodePath("MaterialPreview:render_target_update_mode") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ 3 ] +} + [node name="ProceduralMaterialEditor" type="MarginContainer" index="0"] anchor_left = 0.0 @@ -521,8 +533,8 @@ _sections_unfolded = [ "Mouse" ] [node name="Material" parent="GraphEdit" index="0" instance=ExtResource( 3 )] margin_right = 111.0 -margin_bottom = 58.0 -_sections_unfolded = [ "Anchor", "Margin", "Mouse", "Theme", "slot" ] +margin_bottom = 118.0 +_sections_unfolded = [ "Anchor", "Margin", "Mouse", "Theme", "slot", "slot/2", "slot/3", "slot/4", "slot/5" ] [node name="Timer" type="Timer" parent="GraphEdit" index="1"] @@ -531,6 +543,58 @@ wait_time = 0.25 one_shot = true autostart = false +[node name="SaveViewport" type="Viewport" parent="GraphEdit" index="2"] + +arvr = false +size = Vector2( 0, 0 ) +own_world = true +world = null +transparent_bg = false +msaa = 0 +hdr = true +disable_3d = false +usage = 2 +debug_draw = 0 +render_target_v_flip = true +render_target_clear_mode = 0 +render_target_update_mode = 1 +audio_listener_enable_2d = false +audio_listener_enable_3d = false +physics_object_picking = false +gui_disable_input = true +gui_snap_controls_to_pixels = true +shadow_atlas_size = 0 +shadow_atlas_quad_0 = 2 +shadow_atlas_quad_1 = 2 +shadow_atlas_quad_2 = 3 +shadow_atlas_quad_3 = 4 +_sections_unfolded = [ "GUI", "Render Target" ] + +[node name="ColorRect" type="ColorRect" parent="GraphEdit/SaveViewport" index="0"] + +material = SubResource( 11 ) +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_right = 40.0 +margin_bottom = 40.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +mouse_filter = 0 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 1 +size_flags_vertical = 1 +color = Color( 1, 1, 1, 1 ) +_sections_unfolded = [ "Material", "Rect" ] + +[node name="Timer" type="Timer" parent="GraphEdit/SaveViewport" index="1"] + +process_mode = 1 +wait_time = 0.1 +one_shot = true +autostart = false + [node name="TexturePreview" type="ColorRect" parent="." index="1"] visible = false @@ -628,7 +692,7 @@ _sections_unfolded = [ "GUI", "Render Target" ] [node name="Objects" type="Spatial" parent="Preview/Preview/MaterialPreview" index="0"] -transform = Transform( 0.722041, 0, -0.691848, 0, 1, 0, 0.691848, 0, 0.722041, 0, 0, 0 ) +transform = Transform( -0.324656, 0, -0.94583, 0, 1, 0, 0.94583, 0, -0.324656, 0, 0, 0 ) _sections_unfolded = [ "Transform" ] [node name="Cube" type="MeshInstance" parent="Preview/Preview/MaterialPreview/Objects" index="0"] @@ -766,7 +830,7 @@ selected = 3 [node name="SelectedPreview" type="ColorRect" parent="Preview/Preview" index="4"] -material = SubResource( 7 ) +material = SubResource( 14 ) anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 @@ -796,58 +860,6 @@ anims/maximize = SubResource( 8 ) anims/minimize = SubResource( 9 ) blend_times = [ ] -[node name="SaveViewport" type="Viewport" parent="." index="3"] - -arvr = false -size = Vector2( 0, 0 ) -own_world = true -world = null -transparent_bg = false -msaa = 0 -hdr = true -disable_3d = false -usage = 2 -debug_draw = 0 -render_target_v_flip = true -render_target_clear_mode = 0 -render_target_update_mode = 1 -audio_listener_enable_2d = false -audio_listener_enable_3d = false -physics_object_picking = false -gui_disable_input = true -gui_snap_controls_to_pixels = true -shadow_atlas_size = 0 -shadow_atlas_quad_0 = 2 -shadow_atlas_quad_1 = 2 -shadow_atlas_quad_2 = 3 -shadow_atlas_quad_3 = 4 -_sections_unfolded = [ "GUI", "Render Target" ] - -[node name="ColorRect" type="ColorRect" parent="SaveViewport" index="0"] - -material = SubResource( 11 ) -anchor_left = 0.0 -anchor_top = 0.0 -anchor_right = 0.0 -anchor_bottom = 0.0 -margin_right = 40.0 -margin_bottom = 40.0 -rect_pivot_offset = Vector2( 0, 0 ) -rect_clip_content = false -mouse_filter = 0 -mouse_default_cursor_shape = 0 -size_flags_horizontal = 1 -size_flags_vertical = 1 -color = Color( 1, 1, 1, 1 ) -_sections_unfolded = [ "Material", "Rect" ] - -[node name="Timer" type="Timer" parent="SaveViewport" index="1"] - -process_mode = 1 -wait_time = 0.0962963 -one_shot = true -autostart = false - [connection signal="connection_request" from="GraphEdit" to="." method="_on_GraphEdit_connection_request"] [connection signal="graph_changed" from="GraphEdit" to="." method="generate_shader"] diff --git a/addons/procedural_material/preview.gd b/addons/procedural_material/preview.gd index c60afbb..9cf0293 100644 --- a/addons/procedural_material/preview.gd +++ b/addons/procedural_material/preview.gd @@ -1,7 +1,6 @@ tool extends ViewportContainer -var preview_material = null var preview_maximized = false const ENVIRONMENTS = [ @@ -9,11 +8,9 @@ const ENVIRONMENTS = [ ] func _ready(): - preview_material = ShaderMaterial.new() - preview_material.shader = Shader.new() - preview_material.shader.set_code("shader_type spatial;\nvoid fragment() {\n ALBEDO=vec3(0.5);\n}\n") - $MaterialPreview/Objects/Cube.set_surface_material(0, preview_material) - $MaterialPreview/Objects/Cylinder.set_surface_material(0, preview_material) + var m = $MaterialPreview/Objects/Cube.get_surface_material(0).duplicate() + $MaterialPreview/Objects/Cube.set_surface_material(0, m) + $MaterialPreview/Objects/Cylinder.set_surface_material(0, m) $ObjectRotate.play("rotate") _on_Environment_item_selected($Environment.selected) @@ -32,3 +29,6 @@ func _on_Model_item_selected(id): var model = $Model.get_item_text(id) for c in $MaterialPreview/Objects.get_children(): c.visible = (c.get_name() == model) + +func get_materials(): + return [ $MaterialPreview/Objects/Cube.get_surface_material(0) ] diff --git a/examples/bricks.ptex b/examples/bricks.ptex index 0d658b4..ef4ab5f 100644 --- a/examples/bricks.ptex +++ b/examples/bricks.ptex @@ -1 +1 @@ -{"connections":[{"from":"Bricks","from_port":0,"to":"Warp","to_port":0},{"from":"Perlin","from_port":0,"to":"Warp","to_port":1},{"from":"Warp","from_port":0,"to":"NormalMap","to_port":0},{"from":"Perlin2","from_port":0,"to":"colorize_0","to_port":0},{"from":"Perlin2","from_port":0,"to":"colorize_1","to_port":0},{"from":"Warp","from_port":0,"to":"colorize_2","to_port":0},{"from":"colorize_2","from_port":0,"to":"blend_0","to_port":2},{"from":"blend_0","from_port":0,"to":"transform_0","to_port":0},{"from":"transform_0","from_port":0,"to":"Material","to_port":0},{"from":"NormalMap","from_port":0,"to":"transform_1","to_port":0},{"from":"transform_1","from_port":0,"to":"Material","to_port":1},{"from":"colorize_1","from_port":0,"to":"blend_0","to_port":0},{"from":"colorize_0","from_port":0,"to":"blend_0","to_port":1}],"nodes":[{"iterations":7,"name":"Perlin2","node_position":{"x":258,"y":-32},"persistence":0.5,"scale_x":8,"scale_y":8,"type":"perlin"},{"bevel":0.6,"columns":6,"mortar":0.05,"name":"Bricks","node_position":{"x":260,"y":132},"row_offset":0.5,"rows":12,"type":"bricks"},{"amount":0.5,"name":"NormalMap","node_position":{"x":694,"y":297},"type":"normal_map"},{"iterations":6,"name":"Perlin","node_position":{"x":255,"y":322},"persistence":0.5,"scale_x":4,"scale_y":4,"type":"perlin"},{"amount":0.1,"name":"Warp","node_position":{"x":504,"y":199.75},"type":"warp"},{"gradient":[{"b":0,"g":0,"pos":0,"r":0},{"b":1,"g":1,"pos":0.090909,"r":1}],"name":"colorize_2","node_position":{"x":639.943665,"y":152},"type":"colorize"},{"name":"transform_1","node_position":{"x":944.779785,"y":262.75},"rotate":0,"scale":1,"type":"transform"},{"name":"Material","node_position":{"x":1165,"y":171},"type":"material"},{"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.002889,"g":0.102424,"pos":0,"r":0.184896},{"b":0,"g":0.19869,"pos":0.327273,"r":0.669271},{"b":0.019368,"g":0.060224,"pos":0.681818,"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"},{"name":"transform_0","node_position":{"x":938.779785,"y":129.75},"rotate":0,"scale":1,"type":"transform"},{"amount":0.5,"blend_type":0,"name":"blend_0","node_position":{"x":820.943726,"y":-33},"type":"blend"}]} \ No newline at end of file +{"connections":[{"from":"Bricks","from_port":0,"to":"Warp","to_port":0},{"from":"Perlin","from_port":0,"to":"Warp","to_port":1},{"from":"Perlin2","from_port":0,"to":"colorize_0","to_port":0},{"from":"Perlin2","from_port":0,"to":"colorize_1","to_port":0},{"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":"Warp","from_port":0,"to":"normal_map_0","to_port":0},{"from":"normal_map_0","from_port":0,"to":"Material","to_port":1},{"from":"Warp","from_port":0,"to":"colorize_3","to_port":0},{"from":"blend_0","from_port":0,"to":"Material","to_port":0},{"from":"colorize_3","from_port":0,"to":"Material","to_port":2}],"nodes":[{"iterations":7,"name":"Perlin2","node_position":{"x":258,"y":-32},"persistence":0.5,"scale_x":8,"scale_y":8,"type":"perlin"},{"bevel":0.2,"columns":3,"mortar":0.05,"name":"Bricks","node_position":{"x":260,"y":132},"row_offset":0.5,"rows":6,"type":"bricks"},{"iterations":6,"name":"Perlin","node_position":{"x":255,"y":322},"persistence":0.5,"scale_x":4,"scale_y":4,"type":"perlin"},{"amount":0.1,"name":"Warp","node_position":{"x":504,"y":199.75},"type":"warp"},{"gradient":[{"b":0,"g":0,"pos":0,"r":0},{"b":1,"g":1,"pos":0.072727,"r":1}],"name":"colorize_2","node_position":{"x":639.943665,"y":152},"type":"colorize"},{"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.002889,"g":0.102424,"pos":0,"r":0.184896},{"b":0,"g":0.19869,"pos":0.327273,"r":0.669271},{"b":0.019368,"g":0.060224,"pos":0.663636,"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.5,"blend_type":0,"name":"blend_0","node_position":{"x":820.943726,"y":-33},"type":"blend"},{"name":"Material","node_position":{"x":1024,"y":204},"type":"material"},{"gradient":[{"b":0.273438,"g":0.273438,"pos":0,"r":0.273438},{"b":0,"g":0,"pos":1,"r":0}],"name":"colorize_3","node_position":{"x":688,"y":355},"type":"colorize"},{"amount":0.5,"name":"normal_map_0","node_position":{"x":721,"y":244},"type":"normal_map"}]} \ No newline at end of file diff --git a/examples/lava.ptex b/examples/lava.ptex new file mode 100644 index 0000000..3902720 --- /dev/null +++ b/examples/lava.ptex @@ -0,0 +1 @@ +{"connections":[{"from":"perlin_0","from_port":0,"to":"blend_0","to_port":0},{"from":"blend_0","from_port":0,"to":"colorize_0","to_port":0},{"from":"colorize_0","from_port":0,"to":"Material","to_port":0},{"from":"perlin_0","from_port":0,"to":"warp_0","to_port":1},{"from":"voronoi_0","from_port":0,"to":"warp_0","to_port":0},{"from":"warp_0","from_port":0,"to":"blend_0","to_port":1},{"from":"warp_0","from_port":0,"to":"colorize_1","to_port":0},{"from":"warp_0","from_port":0,"to":"Material","to_port":1},{"from":"warp_0","from_port":0,"to":"colorize_2","to_port":0},{"from":"colorize_2","from_port":0,"to":"Material","to_port":2},{"from":"warp_0","from_port":0,"to":"normal_map_0","to_port":0},{"from":"normal_map_0","from_port":0,"to":"Material","to_port":4},{"from":"colorize_1","from_port":0,"to":"Material","to_port":3}],"nodes":[{"name":"Material","node_position":{"x":956,"y":271},"type":"material"},{"iterations":8,"name":"perlin_0","node_position":{"x":-63,"y":-34},"persistence":0.75,"scale_x":4,"scale_y":4,"type":"perlin"},{"intensity":0.55,"name":"voronoi_0","node_position":{"x":-2,"y":204},"scale_x":6,"scale_y":6,"type":"voronoi"},{"amount":0.3,"name":"warp_0","node_position":{"x":242,"y":23},"type":"warp"},{"gradient":[{"b":0.032597,"g":0.032597,"pos":0.072727,"r":0.032597},{"b":0.111979,"g":0.111979,"pos":0.3,"r":0.111979},{"b":0.029781,"g":0.029781,"pos":0.518182,"r":0.029781},{"b":0.069093,"g":0.069093,"pos":0.818182,"r":0.069093},{"b":0,"g":0,"pos":1,"r":0}],"name":"colorize_0","node_position":{"x":666,"y":27},"type":"colorize"},{"gradient":[{"b":1,"g":1,"pos":0.290909,"r":1},{"b":0,"g":0,"pos":0.8,"r":0}],"name":"colorize_2","node_position":{"x":535,"y":123.5},"type":"colorize"},{"gradient":[{"b":0,"g":0.765625,"pos":0,"r":1},{"b":0,"g":0,"pos":0.181818,"r":1},{"b":0,"g":0,"pos":0.245455,"r":0}],"name":"colorize_1","node_position":{"x":479,"y":215},"type":"colorize"},{"amount":0.9,"name":"normal_map_0","node_position":{"x":501,"y":314.5},"type":"normal_map"},{"amount":0.45,"blend_type":1,"name":"blend_0","node_position":{"x":433,"y":-87},"type":"blend"}]} \ No newline at end of file diff --git a/examples/wood_with_blood.ptex b/examples/wood_with_blood.ptex new file mode 100644 index 0000000..e2c04ce --- /dev/null +++ b/examples/wood_with_blood.ptex @@ -0,0 +1 @@ +{"connections":[{"from":"perlin_0","from_port":0,"to":"colorize_0","to_port":0},{"from":"bricks_0","from_port":0,"to":"blend_0","to_port":0},{"from":"perlin_0","from_port":0,"to":"blend_0","to_port":1},{"from":"normal_map_0","from_port":0,"to":"Material","to_port":4},{"from":"blend_0","from_port":0,"to":"normal_map_0","to_port":0},{"from":"blend_0","from_port":0,"to":"colorize_1","to_port":0},{"from":"perlin_1","from_port":0,"to":"colorize_2","to_port":0},{"from":"colorize_2","from_port":0,"to":"blend_1","to_port":0},{"from":"colorize_0","from_port":0,"to":"blend_1","to_port":1},{"from":"perlin_2","from_port":0,"to":"colorize_3","to_port":0},{"from":"colorize_3","from_port":0,"to":"blend_1","to_port":2},{"from":"blend_1","from_port":0,"to":"Material","to_port":0},{"from":"colorize_1","from_port":0,"to":"blend_2","to_port":1},{"from":"colorize_3","from_port":0,"to":"blend_2","to_port":0},{"from":"blend_2","from_port":0,"to":"Material","to_port":2}],"nodes":[{"gradient":[{"b":0.004367,"g":0.004367,"pos":0,"r":0.059896},{"b":0.012831,"g":0.012831,"pos":0.172727,"r":0.111979},{"b":0.006687,"g":0.006687,"pos":0.463636,"r":0.075521},{"b":0.007871,"g":0.007871,"pos":0.754545,"r":0.144176},{"b":0.002062,"g":0.002062,"pos":1,"r":0.049479}],"name":"colorize_2","node_position":{"x":487.633789,"y":-144.5},"type":"colorize"},{"gradient":[{"b":0.025567,"g":0.207086,"pos":0,"r":0.377604},{"b":0.013346,"g":0.061518,"pos":0.163636,"r":0.106771},{"b":0.017965,"g":0.174595,"pos":0.345455,"r":0.321733},{"b":0.015933,"g":0.124841,"pos":0.527273,"r":0.22715},{"b":0.017148,"g":0.148096,"pos":0.681818,"r":0.271107},{"b":0.015842,"g":0.105696,"pos":0.854545,"r":0.190104},{"b":0.011393,"g":0.14651,"pos":1,"r":0.273438}],"name":"colorize_0","node_position":{"x":468,"y":62.5},"type":"colorize"},{"gradient":[{"b":0,"g":0,"pos":0.454545,"r":0},{"b":1,"g":1,"pos":0.563636,"r":1}],"name":"colorize_3","node_position":{"x":494.633789,"y":-32},"type":"colorize"},{"amount":0.35,"blend_type":0,"name":"blend_2","node_position":{"x":687.633789,"y":201.5},"type":"blend"},{"gradient":[{"b":0.690104,"g":0.690104,"pos":0,"r":0.690104},{"b":0.492188,"g":0.492188,"pos":1,"r":0.492188}],"name":"colorize_1","node_position":{"x":495.633789,"y":220.5},"type":"colorize"},{"amount":0.5,"name":"normal_map_0","node_position":{"x":724.633789,"y":345.5},"type":"normal_map"},{"iterations":3,"name":"perlin_0","node_position":{"x":29,"y":214.5},"persistence":0.5,"scale_x":20,"scale_y":3,"type":"perlin"},{"bevel":0,"columns":5,"mortar":0.05,"name":"bricks_0","node_position":{"x":-1,"y":30.5},"row_offset":0.5,"rows":1,"type":"bricks"},{"iterations":6,"name":"perlin_2","node_position":{"x":220.633789,"y":19},"persistence":0.65,"scale_x":4,"scale_y":4,"type":"perlin"},{"iterations":7,"name":"perlin_1","node_position":{"x":110.633789,"y":-137.5},"persistence":0.55,"scale_x":4,"scale_y":4,"type":"perlin"},{"name":"Material","node_position":{"x":938,"y":96},"type":"material"},{"amount":0.2,"blend_type":0,"name":"blend_0","node_position":{"x":280,"y":302.5},"type":"blend"},{"amount":0.5,"blend_type":0,"name":"blend_1","node_position":{"x":694.633789,"y":-2},"type":"blend"}]} \ No newline at end of file