├── .gitattributes ├── .gitignore ├── PolyGen.gd ├── PolyGen.tscn ├── README.md ├── gifs ├── island.gif ├── mushroom.gif └── wireframe.gif ├── icon.svg ├── icon.svg.import └── project.godot /.gitattributes: -------------------------------------------------------------------------------- 1 | # Normalize EOL for all files that Git considers text files. 2 | * text=auto eol=lf 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Godot 4+ specific ignores 2 | .godot/ 3 | -------------------------------------------------------------------------------- /PolyGen.gd: -------------------------------------------------------------------------------- 1 | @tool 2 | extends Node3D 3 | 4 | # Author: Jason Rametta 5 | 6 | @export var sides: int = 8 7 | @export var layers: int = 5 8 | @export var width_curve: Curve 9 | @export var height_curve: Curve 10 | @export var x_offset_curve: Curve 11 | @export var material: StandardMaterial3D = StandardMaterial3D.new() 12 | @export var uv_scale: Vector2 = Vector2(1.0, 1.0) 13 | 14 | @onready var mesh_instance: MeshInstance3D = $MeshInstance3D 15 | 16 | func uv(vertex: Vector3) -> Vector2: 17 | var normed = vertex.normalized() 18 | return abs(Vector2(normed.x, normed.y) * uv_scale) 19 | 20 | func _process(_delta) -> void: 21 | var st = SurfaceTool.new() 22 | st.begin(Mesh.PRIMITIVE_TRIANGLES) 23 | st.set_material(material) 24 | 25 | var center = Vector3.ZERO 26 | st.set_uv(uv(center)) 27 | st.add_vertex(center) 28 | 29 | var points_index = 0 30 | 31 | var first_width_sample = width_curve.sample(0) 32 | for side in range(sides): 33 | var u = float(side) / sides 34 | var x = cos(u * PI * 2.0) * first_width_sample 35 | var z = sin(u * PI * 2.0) * first_width_sample 36 | var point = Vector3(x, 0, z) 37 | st.set_uv(uv(point)) 38 | st.add_vertex(point) 39 | points_index += 1 40 | 41 | if side > 1: 42 | st.add_index(side - 1) 43 | st.add_index(side) 44 | st.add_index(0) 45 | 46 | st.add_index(sides) 47 | st.add_index(1) 48 | st.add_index(0) 49 | 50 | st.add_index(0) 51 | st.add_index(sides - 1) 52 | st.add_index(sides) 53 | 54 | for layer in range(layers): 55 | var curve_sample = float(layer) / float(layers) 56 | var width_sample = width_curve.sample(curve_sample) 57 | var height_sample = height_curve.sample(curve_sample) 58 | var x_offset_sample = x_offset_curve.sample(curve_sample) 59 | var y = height_sample * layer 60 | var prev_row_first_index = points_index - sides + 1 61 | var prev_row_last_index = points_index 62 | var this_row_first_index = points_index + 1 63 | 64 | for side in range(sides): 65 | var u = float(side) / sides 66 | var x = cos(u * PI * 2.0) * width_sample + x_offset_sample 67 | var z = sin(u * PI * 2.0) * width_sample 68 | var point = Vector3(x, y, z) 69 | st.set_uv(uv(point)) 70 | st.add_vertex(point) 71 | points_index += 1 72 | 73 | if side > 0: 74 | st.add_index(points_index) 75 | st.add_index(points_index - sides) 76 | st.add_index(points_index - sides - 1) 77 | 78 | st.add_index(points_index - sides - 1) 79 | st.add_index(points_index - 1) 80 | st.add_index(points_index) 81 | 82 | st.add_index(prev_row_first_index) 83 | st.add_index(points_index) 84 | st.add_index(this_row_first_index) 85 | 86 | st.add_index(points_index) 87 | st.add_index(prev_row_first_index) 88 | st.add_index(prev_row_last_index) 89 | 90 | # close the shape 91 | var height_sample_last = height_curve.sample(1) 92 | var y = height_sample_last * (layers - 1) 93 | 94 | var last_center = Vector3(0, y, 0) 95 | st.set_uv(uv(last_center)) 96 | st.add_vertex(last_center) 97 | points_index += 1 98 | 99 | for side in range(sides): 100 | st.add_index(points_index) 101 | st.add_index(points_index - side) 102 | st.add_index(points_index - side - 1) 103 | 104 | st.add_index(points_index - sides) 105 | st.add_index(points_index - 1) 106 | st.add_index(points_index) 107 | 108 | st.generate_normals() 109 | st.generate_tangents() 110 | 111 | mesh_instance.mesh = st.commit() 112 | -------------------------------------------------------------------------------- /PolyGen.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=14 format=3 uid="uid://r2s2ju6nqiw3"] 2 | 3 | [ext_resource type="Script" path="res://PolyGen.gd" id="1_h48lc"] 4 | 5 | [sub_resource type="Curve" id="Curve_dd20f"] 6 | _data = [Vector2(0, 0.219423), 0.0, 0.276619, 0, 0, Vector2(0.112299, 0.521176), 1.53614, 1.53614, 0, 0, Vector2(0.236364, 0.732932), 0.0, 0.0, 0, 0, Vector2(0.295811, 0.897043), 1.40813, 1.40813, 0, 0, Vector2(0.435383, 1), -0.856876, -0.856876, 0, 0, Vector2(0.562032, 0.801752), -4.30121, -4.30121, 0, 0, Vector2(0.642157, 0.177072), 0.0, 0.0, 0, 0, Vector2(0.817914, 0.415298), 0.0, 0.0, 0, 0] 7 | point_count = 8 8 | 9 | [sub_resource type="Curve" id="Curve_adlm1"] 10 | min_value = -1.0 11 | max_value = 2.13163e-14 12 | _data = [Vector2(0.0786988, -0.372946), 0.0, 0.0, 0, 0, Vector2(0.231194, -0.245893), 0.0, 0.0, 0, 0, Vector2(0.399198, -0.208835), -0.146299, -0.146299, 0, 0, Vector2(0.549109, -0.272362), -0.468159, -0.468159, 0, 0, Vector2(0.719697, -0.335889), -0.890519, -0.890519, 0, 0, Vector2(0.81533, -0.441767), 0.0, 0.0, 0, 0] 13 | point_count = 6 14 | 15 | [sub_resource type="Curve" id="Curve_4gl5d"] 16 | 17 | [sub_resource type="Gradient" id="Gradient_viodl"] 18 | offsets = PackedFloat32Array(0, 0.588889, 1) 19 | colors = PackedColorArray(0.966155, 0.46894, 0.508635, 1, 0.972842, 0.28084, 0.31336, 1, 0.780392, 0, 0.0941176, 1) 20 | 21 | [sub_resource type="GradientTexture2D" id="GradientTexture2D_f1luj"] 22 | gradient = SubResource("Gradient_viodl") 23 | fill_from = Vector2(0.5, 1) 24 | fill_to = Vector2(0.520202, 0) 25 | 26 | [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_s8ubs"] 27 | albedo_texture = SubResource("GradientTexture2D_f1luj") 28 | metallic = 0.38 29 | roughness = 0.74 30 | 31 | [sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_3yl16"] 32 | sky_top_color = Color(1, 0.294118, 0.231373, 1) 33 | sky_horizon_color = Color(1, 0.760784, 0.866667, 1) 34 | sky_curve = 0.0284197 35 | ground_bottom_color = Color(0.0392157, 0.278431, 0.870588, 1) 36 | ground_horizon_color = Color(0.501961, 0.784314, 1, 1) 37 | ground_curve = 0.0492457 38 | 39 | [sub_resource type="Sky" id="Sky_ppb2a"] 40 | sky_material = SubResource("ProceduralSkyMaterial_3yl16") 41 | 42 | [sub_resource type="Environment" id="Environment_4dbtl"] 43 | background_mode = 2 44 | sky = SubResource("Sky_ppb2a") 45 | tonemap_mode = 2 46 | glow_enabled = true 47 | 48 | [sub_resource type="ArrayMesh" id="ArrayMesh_fdhwq"] 49 | _surfaces = [{ 50 | "aabb": AABB(-0.897716, -3.09237, -0.971408, 1.89411, 3.09238, 1.94282), 51 | "attribute_data": PackedByteArray(0, 0, 128, 63, 0, 0, 0, 0, 7, 157, 31, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 134, 220, 99, 62, 0, 0, 0, 0, 229, 165, 102, 63, 0, 0, 0, 0, 229, 165, 102, 63, 0, 0, 0, 0, 134, 220, 99, 62, 0, 0, 0, 0, 7, 157, 31, 63, 0, 0, 0, 0, 7, 157, 31, 63, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 134, 220, 99, 62, 0, 0, 0, 0, 229, 165, 102, 63, 0, 0, 0, 0, 229, 165, 102, 63, 0, 0, 0, 0, 134, 220, 99, 62, 0, 0, 0, 0, 7, 157, 31, 63, 0, 0, 0, 0, 163, 188, 6, 63, 31, 128, 6, 63, 229, 25, 88, 63, 30, 128, 6, 63, 31, 89, 64, 62, 31, 128, 6, 63, 78, 179, 66, 63, 30, 128, 6, 63, 78, 179, 66, 63, 30, 128, 6, 63, 31, 89, 64, 62, 31, 128, 6, 63, 163, 188, 6, 63, 31, 128, 6, 63, 142, 207, 5, 63, 249, 195, 8, 63, 165, 157, 86, 63, 249, 195, 8, 63, 170, 6, 63, 62, 249, 195, 8, 63, 182, 92, 65, 63, 249, 195, 8, 63, 182, 92, 65, 63, 249, 195, 8, 63, 170, 6, 63, 62, 249, 195, 8, 63, 142, 207, 5, 63, 249, 195, 8, 63, 33, 55, 7, 63, 20, 79, 5, 63, 91, 222, 88, 63, 20, 79, 5, 63, 252, 7, 65, 62, 20, 79, 5, 63, 79, 100, 67, 63, 20, 79, 5, 63, 79, 100, 67, 63, 20, 79, 5, 63, 252, 7, 65, 62, 20, 79, 5, 63, 33, 55, 7, 63, 20, 79, 5, 63, 31, 123, 221, 62, 180, 172, 52, 63, 42, 157, 49, 63, 180, 172, 52, 63, 93, 23, 30, 62, 180, 172, 52, 63, 76, 6, 32, 63, 179, 172, 52, 63, 76, 6, 32, 63, 179, 172, 52, 63, 93, 23, 30, 62, 180, 172, 52, 63, 31, 123, 221, 62, 180, 172, 52, 63, 192, 234, 204, 61, 223, 160, 119, 63, 167, 84, 36, 62, 223, 160, 119, 63, 160, 68, 18, 61, 223, 160, 119, 63, 140, 14, 20, 62, 223, 160, 119, 63, 140, 14, 20, 62, 223, 160, 119, 63, 160, 68, 18, 61, 223, 160, 119, 63, 192, 234, 204, 61, 223, 160, 119, 63, 244, 78, 189, 61, 138, 27, 120, 63, 69, 208, 23, 62, 138, 27, 120, 63, 117, 32, 7, 61, 138, 27, 120, 63, 127, 199, 8, 62, 138, 27, 120, 63, 127, 199, 8, 62, 138, 27, 120, 63, 117, 32, 7, 61, 138, 27, 120, 63, 244, 78, 189, 61, 138, 27, 120, 63, 168, 245, 169, 61, 210, 165, 120, 63, 9, 76, 8, 62, 210, 165, 120, 63, 171, 161, 242, 60, 210, 165, 120, 63, 71, 153, 245, 61, 210, 165, 120, 63, 71, 153, 245, 61, 210, 165, 120, 63, 171, 161, 242, 60, 210, 165, 120, 63, 168, 245, 169, 61, 210, 165, 120, 63, 0, 0, 0, 0, 72, 225, 122, 63), 52 | "format": 4119, 53 | "index_count": 381, 54 | "index_data": PackedByteArray(0, 0, 1, 0, 2, 0, 1, 0, 3, 0, 2, 0, 3, 0, 4, 0, 2, 0, 4, 0, 5, 0, 2, 0, 5, 0, 6, 0, 2, 0, 7, 0, 0, 0, 2, 0, 2, 0, 6, 0, 7, 0, 8, 0, 1, 0, 0, 0, 0, 0, 9, 0, 8, 0, 10, 0, 3, 0, 1, 0, 1, 0, 8, 0, 10, 0, 11, 0, 4, 0, 3, 0, 3, 0, 10, 0, 11, 0, 12, 0, 5, 0, 4, 0, 4, 0, 11, 0, 12, 0, 13, 0, 6, 0, 5, 0, 5, 0, 12, 0, 13, 0, 14, 0, 7, 0, 6, 0, 6, 0, 13, 0, 14, 0, 0, 0, 14, 0, 9, 0, 14, 0, 0, 0, 7, 0, 15, 0, 8, 0, 9, 0, 9, 0, 16, 0, 15, 0, 17, 0, 10, 0, 8, 0, 8, 0, 15, 0, 17, 0, 18, 0, 11, 0, 10, 0, 10, 0, 17, 0, 18, 0, 19, 0, 12, 0, 11, 0, 11, 0, 18, 0, 19, 0, 20, 0, 13, 0, 12, 0, 12, 0, 19, 0, 20, 0, 21, 0, 14, 0, 13, 0, 13, 0, 20, 0, 21, 0, 9, 0, 21, 0, 16, 0, 21, 0, 9, 0, 14, 0, 22, 0, 15, 0, 16, 0, 16, 0, 23, 0, 22, 0, 24, 0, 17, 0, 15, 0, 15, 0, 22, 0, 24, 0, 25, 0, 18, 0, 17, 0, 17, 0, 24, 0, 25, 0, 26, 0, 19, 0, 18, 0, 18, 0, 25, 0, 26, 0, 27, 0, 20, 0, 19, 0, 19, 0, 26, 0, 27, 0, 28, 0, 21, 0, 20, 0, 20, 0, 27, 0, 28, 0, 16, 0, 28, 0, 23, 0, 28, 0, 16, 0, 21, 0, 29, 0, 22, 0, 23, 0, 23, 0, 30, 0, 29, 0, 31, 0, 24, 0, 22, 0, 22, 0, 29, 0, 31, 0, 32, 0, 25, 0, 24, 0, 24, 0, 31, 0, 32, 0, 33, 0, 26, 0, 25, 0, 25, 0, 32, 0, 33, 0, 34, 0, 27, 0, 26, 0, 26, 0, 33, 0, 34, 0, 35, 0, 28, 0, 27, 0, 27, 0, 34, 0, 35, 0, 23, 0, 35, 0, 30, 0, 35, 0, 23, 0, 28, 0, 36, 0, 29, 0, 30, 0, 30, 0, 37, 0, 36, 0, 38, 0, 31, 0, 29, 0, 29, 0, 36, 0, 38, 0, 39, 0, 32, 0, 31, 0, 31, 0, 38, 0, 39, 0, 40, 0, 33, 0, 32, 0, 32, 0, 39, 0, 40, 0, 41, 0, 34, 0, 33, 0, 33, 0, 40, 0, 41, 0, 42, 0, 35, 0, 34, 0, 34, 0, 41, 0, 42, 0, 30, 0, 42, 0, 37, 0, 42, 0, 30, 0, 35, 0, 43, 0, 36, 0, 37, 0, 37, 0, 44, 0, 43, 0, 45, 0, 38, 0, 36, 0, 36, 0, 43, 0, 45, 0, 46, 0, 39, 0, 38, 0, 38, 0, 45, 0, 46, 0, 47, 0, 40, 0, 39, 0, 39, 0, 46, 0, 47, 0, 48, 0, 41, 0, 40, 0, 40, 0, 47, 0, 48, 0, 49, 0, 42, 0, 41, 0, 41, 0, 48, 0, 49, 0, 37, 0, 49, 0, 44, 0, 49, 0, 37, 0, 42, 0, 50, 0, 43, 0, 44, 0, 44, 0, 51, 0, 50, 0, 52, 0, 45, 0, 43, 0, 43, 0, 50, 0, 52, 0, 53, 0, 46, 0, 45, 0, 45, 0, 52, 0, 53, 0, 54, 0, 47, 0, 46, 0, 46, 0, 53, 0, 54, 0, 55, 0, 48, 0, 47, 0, 47, 0, 54, 0, 55, 0, 56, 0, 49, 0, 48, 0, 48, 0, 55, 0, 56, 0, 44, 0, 56, 0, 51, 0, 56, 0, 44, 0, 49, 0, 57, 0, 50, 0, 51, 0, 51, 0, 58, 0, 57, 0, 59, 0, 52, 0, 50, 0, 50, 0, 57, 0, 59, 0, 60, 0, 53, 0, 52, 0, 52, 0, 59, 0, 60, 0, 61, 0, 54, 0, 53, 0, 53, 0, 60, 0, 61, 0, 62, 0, 55, 0, 54, 0, 54, 0, 61, 0, 62, 0, 63, 0, 56, 0, 55, 0, 55, 0, 62, 0, 63, 0, 51, 0, 63, 0, 58, 0, 63, 0, 51, 0, 56, 0, 64, 0, 64, 0, 63, 0, 64, 0, 63, 0, 62, 0, 64, 0, 62, 0, 61, 0, 64, 0, 61, 0, 60, 0, 64, 0, 60, 0, 59, 0, 64, 0, 59, 0, 57, 0, 64, 0, 57, 0, 58, 0, 58, 0, 63, 0, 64, 0), 55 | "material": SubResource("StandardMaterial3D_s8ubs"), 56 | "primitive": 3, 57 | "vertex_count": 65, 58 | "vertex_data": PackedByteArray(116, 176, 96, 62, 0, 0, 0, 0, 0, 0, 0, 0, 255, 127, 255, 255, 255, 255, 255, 191, 106, 23, 12, 62, 0, 0, 0, 0, 77, 171, 47, 62, 255, 127, 255, 255, 255, 255, 255, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 127, 255, 255, 255, 255, 255, 191, 5, 254, 71, 189, 0, 0, 0, 0, 76, 14, 91, 62, 255, 127, 255, 255, 255, 255, 255, 191, 35, 112, 74, 190, 0, 0, 0, 0, 97, 250, 194, 61, 255, 127, 255, 255, 255, 255, 255, 191, 35, 112, 74, 190, 0, 0, 0, 0, 97, 250, 194, 189, 255, 127, 255, 255, 255, 255, 255, 191, 5, 254, 71, 189, 0, 0, 0, 0, 76, 14, 91, 190, 255, 127, 255, 255, 255, 255, 255, 191, 106, 23, 12, 62, 0, 0, 0, 0, 77, 171, 47, 190, 255, 127, 255, 255, 255, 255, 255, 191, 106, 23, 12, 62, 0, 0, 0, 128, 77, 171, 47, 62, 126, 155, 207, 179, 43, 248, 65, 220, 116, 176, 96, 62, 0, 0, 0, 128, 0, 0, 0, 0, 7, 194, 246, 189, 176, 147, 125, 74, 5, 254, 71, 189, 0, 0, 0, 128, 76, 14, 91, 62, 127, 106, 57, 181, 117, 12, 185, 36, 35, 112, 74, 190, 0, 0, 0, 128, 97, 250, 194, 61, 123, 71, 163, 182, 90, 8, 39, 111, 35, 112, 74, 190, 0, 0, 0, 128, 97, 250, 194, 189, 38, 51, 174, 210, 100, 72, 245, 185, 5, 254, 71, 189, 0, 0, 0, 128, 76, 14, 91, 190, 155, 59, 205, 251, 250, 232, 64, 56, 106, 23, 12, 62, 0, 0, 0, 128, 77, 171, 47, 190, 191, 204, 242, 221, 53, 199, 255, 63, 32, 95, 173, 62, 113, 153, 176, 190, 174, 102, 217, 62, 184, 159, 242, 185, 32, 255, 34, 163, 129, 8, 11, 63, 113, 153, 176, 190, 0, 0, 0, 0, 210, 184, 43, 199, 158, 152, 212, 73, 158, 128, 247, 189, 113, 153, 176, 190, 32, 140, 7, 63, 215, 116, 124, 191, 62, 19, 128, 35, 122, 135, 250, 190, 113, 153, 176, 190, 9, 76, 113, 62, 109, 82, 114, 187, 233, 0, 231, 20, 122, 135, 250, 190, 113, 153, 176, 190, 9, 76, 113, 190, 218, 59, 77, 209, 62, 77, 182, 182, 158, 128, 247, 189, 113, 153, 176, 190, 32, 140, 7, 191, 193, 62, 13, 243, 10, 228, 4, 52, 32, 95, 173, 62, 113, 153, 176, 190, 174, 102, 217, 190, 66, 200, 239, 223, 53, 199, 255, 63, 153, 228, 239, 62, 175, 49, 250, 190, 123, 104, 22, 63, 212, 154, 79, 196, 126, 255, 158, 92, 20, 97, 64, 63, 175, 49, 250, 190, 0, 0, 0, 0, 242, 175, 12, 208, 244, 156, 83, 183, 206, 59, 43, 190, 175, 49, 250, 190, 77, 142, 59, 63, 87, 118, 164, 201, 226, 16, 190, 221, 227, 83, 45, 191, 175, 49, 250, 190, 192, 240, 166, 62, 34, 89, 219, 197, 135, 0, 46, 235, 227, 83, 45, 191, 175, 49, 250, 190, 192, 240, 166, 190, 30, 70, 140, 216, 127, 72, 63, 72, 206, 59, 43, 190, 175, 49, 250, 190, 77, 142, 59, 191, 47, 73, 94, 245, 16, 225, 54, 202, 153, 228, 239, 62, 175, 49, 250, 190, 123, 104, 22, 191, 197, 188, 8, 229, 53, 199, 255, 191, 127, 9, 31, 63, 162, 254, 31, 191, 27, 109, 71, 63, 134, 166, 236, 163, 118, 253, 2, 220, 96, 19, 127, 63, 162, 254, 31, 191, 0, 0, 0, 0, 180, 227, 73, 156, 242, 131, 246, 70, 233, 9, 99, 190, 162, 254, 31, 191, 47, 174, 120, 63, 134, 108, 53, 167, 91, 15, 147, 40, 180, 208, 101, 191, 162, 254, 31, 191, 173, 88, 221, 62, 106, 64, 148, 165, 175, 2, 216, 108, 180, 208, 101, 191, 162, 254, 31, 191, 173, 88, 221, 190, 171, 36, 217, 196, 47, 82, 200, 184, 233, 9, 99, 190, 162, 254, 31, 191, 47, 174, 120, 191, 236, 40, 235, 242, 245, 237, 246, 50, 127, 9, 31, 63, 162, 254, 31, 191, 27, 109, 71, 191, 42, 207, 223, 220, 53, 199, 255, 63, 243, 69, 24, 63, 140, 129, 125, 191, 210, 241, 62, 63, 247, 168, 71, 88, 231, 253, 201, 221, 50, 58, 116, 63, 140, 129, 125, 191, 0, 0, 0, 0, 97, 196, 97, 68, 102, 146, 113, 53, 253, 97, 89, 190, 140, 129, 125, 191, 162, 26, 110, 63, 0, 115, 226, 82, 42, 20, 6, 88, 141, 10, 92, 191, 140, 129, 125, 191, 186, 238, 211, 62, 38, 71, 31, 87, 5, 156, 18, 202, 141, 10, 92, 191, 140, 129, 125, 191, 186, 238, 211, 190, 171, 41, 66, 60, 146, 87, 233, 196, 253, 97, 89, 190, 140, 129, 125, 191, 162, 26, 110, 191, 162, 43, 0, 18, 83, 233, 181, 80, 243, 69, 24, 63, 140, 129, 125, 191, 210, 241, 62, 191, 186, 225, 92, 43, 53, 199, 255, 63, 229, 38, 24, 62, 35, 158, 187, 191, 225, 202, 62, 62, 59, 168, 24, 95, 140, 254, 64, 164, 99, 8, 116, 62, 35, 158, 187, 191, 0, 0, 0, 0, 119, 230, 120, 102, 39, 131, 169, 57, 168, 53, 89, 189, 35, 158, 187, 191, 19, 234, 109, 62, 104, 108, 207, 91, 237, 14, 119, 86, 173, 221, 91, 190, 35, 158, 187, 191, 129, 195, 211, 61, 173, 62, 148, 93, 146, 156, 134, 199, 173, 221, 91, 190, 35, 158, 187, 191, 129, 195, 211, 189, 181, 33, 135, 61, 149, 84, 63, 191, 168, 53, 89, 189, 35, 158, 187, 191, 19, 234, 109, 190, 133, 37, 49, 14, 231, 238, 179, 77, 229, 38, 24, 62, 35, 158, 187, 191, 225, 202, 62, 190, 255, 210, 210, 36, 53, 199, 255, 63, 187, 145, 86, 62, 12, 122, 15, 192, 218, 135, 134, 62, 170, 180, 64, 137, 254, 255, 98, 220, 57, 18, 172, 62, 12, 122, 15, 192, 0, 0, 0, 0, 238, 243, 16, 140, 159, 128, 1, 67, 99, 40, 153, 189, 12, 122, 15, 192, 203, 193, 167, 62, 47, 106, 185, 138, 81, 5, 176, 49, 225, 7, 155, 190, 12, 122, 15, 192, 90, 81, 21, 62, 36, 48, 180, 137, 147, 1, 101, 107, 225, 7, 155, 190, 12, 122, 15, 192, 90, 81, 21, 190, 180, 9, 43, 176, 203, 86, 35, 191, 99, 40, 153, 189, 12, 122, 15, 192, 203, 193, 167, 190, 186, 10, 57, 234, 164, 250, 46, 50, 187, 145, 86, 62, 12, 122, 15, 192, 218, 135, 134, 190, 80, 246, 128, 203, 53, 199, 255, 63, 247, 146, 132, 62, 98, 233, 69, 192, 30, 62, 166, 62, 22, 174, 9, 88, 11, 247, 154, 225, 224, 161, 212, 62, 98, 233, 69, 192, 0, 0, 0, 0, 87, 191, 88, 63, 40, 149, 162, 53, 181, 66, 189, 189, 98, 233, 69, 192, 27, 77, 207, 62, 26, 123, 215, 79, 15, 241, 88, 183, 58, 147, 191, 190, 98, 233, 69, 192, 242, 131, 56, 62, 83, 76, 161, 87, 214, 3, 104, 103, 58, 147, 191, 190, 98, 233, 69, 192, 242, 131, 56, 190, 137, 43, 17, 65, 208, 93, 99, 200, 181, 66, 189, 189, 98, 233, 69, 192, 27, 77, 207, 190, 62, 42, 167, 24, 222, 50, 41, 186, 247, 146, 132, 62, 98, 233, 69, 192, 30, 62, 166, 190, 60, 224, 178, 42, 53, 199, 255, 63, 0, 0, 0, 0, 98, 233, 69, 192, 0, 0, 0, 0, 255, 127, 0, 0, 53, 199, 255, 63) 59 | }] 60 | 61 | [sub_resource type="Animation" id="Animation_32g5x"] 62 | resource_name = "Main" 63 | length = 3.0 64 | loop_mode = 1 65 | tracks/0/type = "value" 66 | tracks/0/imported = false 67 | tracks/0/enabled = true 68 | tracks/0/path = NodePath("MeshInstance3D:position") 69 | tracks/0/interp = 1 70 | tracks/0/loop_wrap = true 71 | tracks/0/keys = { 72 | "times": PackedFloat32Array(0, 1.5, 3), 73 | "transitions": PackedFloat32Array(1, 1, 1), 74 | "update": 0, 75 | "values": [Vector3(0, 0, 0), Vector3(2.08165e-12, 0.5, 2.08165e-12), Vector3(0, 0, 0)] 76 | } 77 | tracks/1/type = "value" 78 | tracks/1/imported = false 79 | tracks/1/enabled = true 80 | tracks/1/path = NodePath("MeshInstance3D:rotation") 81 | tracks/1/interp = 1 82 | tracks/1/loop_wrap = true 83 | tracks/1/keys = { 84 | "times": PackedFloat32Array(0, 3), 85 | "transitions": PackedFloat32Array(1, 1), 86 | "update": 0, 87 | "values": [Vector3(0, 0, 0), Vector3(3.48787e-16, 6.28319, 3.48787e-16)] 88 | } 89 | 90 | [sub_resource type="AnimationLibrary" id="AnimationLibrary_0od8f"] 91 | _data = { 92 | "Main": SubResource("Animation_32g5x") 93 | } 94 | 95 | [node name="PolyGen" type="Node3D"] 96 | script = ExtResource("1_h48lc") 97 | sides = 7 98 | layers = 8 99 | width_curve = SubResource("Curve_dd20f") 100 | height_curve = SubResource("Curve_adlm1") 101 | x_offset_curve = SubResource("Curve_4gl5d") 102 | material = SubResource("StandardMaterial3D_s8ubs") 103 | uv_scale = Vector2(1, 0.98) 104 | 105 | [node name="WorldEnvironment" type="WorldEnvironment" parent="."] 106 | environment = SubResource("Environment_4dbtl") 107 | 108 | [node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] 109 | transform = Transform3D(-0.866025, -0.423561, -0.265699, -1.85345e-16, -0.531399, 0.847122, -0.5, 0.733629, 0.460205, 0, 2.79173, 3.34586) 110 | shadow_enabled = true 111 | 112 | [node name="MeshInstance3D" type="MeshInstance3D" parent="."] 113 | transform = Transform3D(0.997402, -3.68724e-16, -0.0720299, 3.44785e-16, 1, -3.44785e-16, 0.0720299, 3.19054e-16, 0.997402, 4.77721e-14, 0.0114746, 4.77721e-14) 114 | mesh = SubResource("ArrayMesh_fdhwq") 115 | 116 | [node name="Camera3D" type="Camera3D" parent="."] 117 | transform = Transform3D(1, -5.17882e-16, 3.05056e-16, 4.3683e-16, 0.974827, 0.222961, -4.12844e-16, -0.222961, 0.974827, 0, 0.868074, 4.747) 118 | fov = 64.0 119 | 120 | [node name="AnimationPlayer" type="AnimationPlayer" parent="."] 121 | autoplay = "Main" 122 | libraries = { 123 | "": SubResource("AnimationLibrary_0od8f") 124 | } 125 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 🍄 Godot Polygon Generator 2 | 3 | > Disclaimer: Godot provides [TubeTrailMesh](https://docs.godotengine.org/en/stable/classes/class_tubetrailmesh.html) which is very similar and should probably be used instead of this. 4 | 5 | A polygon generator tool for Godot to create simple shapes using **S-Curves**. 6 | 7 | Once a shape has been created: save the shape as a `.tres` file to use statically in game. 8 | 9 | *Floating island example* 10 | 11 | ![island example](./gifs/island.gif) 12 | 13 | *Mushroom example* 14 | 15 | ![mushroom example](./gifs/mushroom.gif) 16 | 17 | *Wireframe example* 18 | 19 | ![wireframe example](./gifs/wireframe.gif) 20 | -------------------------------------------------------------------------------- /gifs/island.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rametta/godot-polygon-generator/3802cf16f7d3131f2c2b0a77dd1d5aed394e758a/gifs/island.gif -------------------------------------------------------------------------------- /gifs/mushroom.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rametta/godot-polygon-generator/3802cf16f7d3131f2c2b0a77dd1d5aed394e758a/gifs/mushroom.gif -------------------------------------------------------------------------------- /gifs/wireframe.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rametta/godot-polygon-generator/3802cf16f7d3131f2c2b0a77dd1d5aed394e758a/gifs/wireframe.gif -------------------------------------------------------------------------------- /icon.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /icon.svg.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://by6xutmo5yw8n" 6 | path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" 7 | metadata={ 8 | "vram_texture": false 9 | } 10 | 11 | [deps] 12 | 13 | source_file="res://icon.svg" 14 | dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"] 15 | 16 | [params] 17 | 18 | compress/mode=0 19 | compress/high_quality=false 20 | compress/lossy_quality=0.7 21 | compress/hdr_compression=1 22 | compress/normal_map=0 23 | compress/channel_pack=0 24 | mipmaps/generate=false 25 | mipmaps/limit=-1 26 | roughness/mode=0 27 | roughness/src_normal="" 28 | process/fix_alpha_border=true 29 | process/premult_alpha=false 30 | process/normal_map_invert_y=false 31 | process/hdr_as_srgb=false 32 | process/hdr_clamp_exposure=false 33 | process/size_limit=0 34 | detect_3d/compress_to=1 35 | svg/scale=1.0 36 | editor/scale_with_editor_scale=false 37 | editor/convert_colors_with_editor_theme=false 38 | -------------------------------------------------------------------------------- /project.godot: -------------------------------------------------------------------------------- 1 | ; Engine configuration file. 2 | ; It's best edited using the editor UI and not directly, 3 | ; since the parameters that go here are not all obvious. 4 | ; 5 | ; Format: 6 | ; [section] ; section goes between [] 7 | ; param=value ; assign values to parameters 8 | 9 | config_version=5 10 | 11 | [application] 12 | 13 | config/name="Poly Gen Tool" 14 | config/description="A tool to generate simple polygon shapes using S-Curves" 15 | run/main_scene="res://PolyGen.tscn" 16 | config/features=PackedStringArray("4.1", "Forward Plus") 17 | config/icon="res://icon.svg" 18 | --------------------------------------------------------------------------------