Compare commits

...

4 commits
0.0.3 ... main

Author SHA1 Message Date
Aada
fe79f4fe89 asset changes 2026-03-04 13:23:58 +02:00
Aada
9a3be12f0f hypsographic curve 2026-03-03 22:05:17 +02:00
Aada
edffc76e05 Axial tilt and sun rotation 2026-03-03 20:02:57 +02:00
63f4423baf credits 2026-03-03 20:01:57 +02:00
17 changed files with 298 additions and 45 deletions

BIN
.forgejo/hypsographic-curve.jpg (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -50,6 +50,8 @@ This project is licensed under the MIT License - see the LICENSE.md file for det
* [Fractal Philosophy's video](https://www.youtube.com/watch?v=7xL0udlhnqI) * [Fractal Philosophy's video](https://www.youtube.com/watch?v=7xL0udlhnqI)
* [Devote's video](https://www.youtube.com/watch?v=CeJz8tsgCPw) * [Devote's video](https://www.youtube.com/watch?v=CeJz8tsgCPw)
* [DomPizzie's readme template](https://gist.github.com/DomPizzie/7a5ff55ffa9081f2de27c315f5018afc) * [DomPizzie's readme template](https://gist.github.com/DomPizzie/7a5ff55ffa9081f2de27c315f5018afc)
* [Jyri Puputti](https://github.com/puputskov) - Math Genius
* [Mikael Mustonen](https://github.com/wastedalmond) - Color Genious
## End ## End
![Exported Planet](.forgejo/export.png?raw=true) ![Exported Planet](.forgejo/export.png?raw=true)

BIN
assets/Planet9.glb (Stored with Git LFS) Normal file

Binary file not shown.

54
assets/Planet9.glb.import Normal file
View file

@ -0,0 +1,54 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://bqa8sh5xxe0s8"
path="res://.godot/imported/Planet9.glb-a48cb5485c47c247d4f1147b55356fd4.scn"
[deps]
source_file="res://assets/Planet9.glb"
dest_files=["res://.godot/imported/Planet9.glb-a48cb5485c47c247d4f1147b55356fd4.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/root_script=null
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_name_suffixes=true
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
materials/extract=0
materials/extract_format=0
materials/extract_path=""
_subresources={
"meshes": {
"Planet9_Icosphere": {
"generate/lightmap_uv": 0,
"generate/lods": 0,
"generate/shadow_meshes": 0,
"lods/normal_merge_angle": 20.0,
"save_to_file/enabled": true,
"save_to_file/fallback_path": "res://assets/Planet9.res",
"save_to_file/path": "uid://cb4avoh4i4smw"
}
}
}
gltf/naming_version=2
gltf/embedded_image_handling=1

BIN
assets/Planet9.res (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/icosphere9.obj (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,25 @@
[remap]
importer="wavefront_obj"
importer_version=1
type="Mesh"
uid="uid://dta10ebabswiy"
path="res://.godot/imported/icosphere9.obj-3c71916d073a9b5721f9a6889681dd1a.mesh"
[deps]
files=["res://.godot/imported/icosphere9.obj-3c71916d073a9b5721f9a6889681dd1a.mesh"]
source_file="res://assets/icosphere9.obj"
dest_files=["res://.godot/imported/icosphere9.obj-3c71916d073a9b5721f9a6889681dd1a.mesh", "res://.godot/imported/icosphere9.obj-3c71916d073a9b5721f9a6889681dd1a.mesh"]
[params]
generate_tangents=true
generate_lods=true
generate_shadow_mesh=true
generate_lightmap_uv2=false
generate_lightmap_uv2_texel_size=0.2
scale_mesh=Vector3(1, 1, 1)
offset_mesh=Vector3(0, 0, 0)
force_disable_mesh_compression=false

View file

@ -11,7 +11,7 @@ config_version=5
[application] [application]
config/name="adatonic" config/name="adatonic"
config/version="0.0.3" config/version="0.0.4"
run/main_scene="uid://csfh7ptgerpm2" run/main_scene="uid://csfh7ptgerpm2"
config/features=PackedStringArray("4.6", "C#", "GL Compatibility") config/features=PackedStringArray("4.6", "C#", "GL Compatibility")
config/icon="res://icon.svg" config/icon="res://icon.svg"

4
resources/fastnoise.tres Normal file
View file

@ -0,0 +1,4 @@
[gd_resource type="FastNoiseLite" format=3 uid="uid://bec450igysexf"]
[resource]
frequency = 0.027

View file

@ -1,5 +1,5 @@
[gd_resource type="Gradient" format=3 uid="uid://b5l44rktieewe"] [gd_resource type="Gradient" format=3 uid="uid://b5l44rktieewe"]
[resource] [resource]
offsets = PackedFloat32Array(0.020102732, 0.21077614, 0.4361486, 0.4835682, 0.49508524, 0.49909908, 0.52932715, 0.5585736, 0.6065243, 0.65517426, 1) offsets = PackedFloat32Array(0.020102732, 0.21077614, 0.4361486, 0.4835682, 0.49508524, 0.49909908, 0.51515174, 0.5367887, 0.5766606, 0.7845561, 1)
colors = PackedColorArray(2.5268645e-07, 3.128499e-07, 0.274243, 1, 8.904189e-07, 2.4065375e-07, 0.42930406, 1, 0.20772403, 0.34871656, 0.66512626, 1, 0.3622311, 0.6195445, 0.94423914, 1, 0.10825918, 0.3611443, 0.64106447, 1, 0.61873, 0.8132518, 0.40761396, 1, 0.35594854, 0.5452644, 0.23284999, 1, 0.77351433, 0.7971149, 0.5667908, 1, 0.7397217, 0.59494364, 0.46294695, 1, 0.3225033, 0.42213485, 0.47578907, 1, 1, 1, 1, 1) colors = PackedColorArray(2.5268645e-07, 3.128499e-07, 0.274243, 1, 8.904189e-07, 2.4065375e-07, 0.42930406, 1, 0.20772403, 0.34871656, 0.66512626, 1, 0.3622311, 0.6195445, 0.94423914, 1, 0.10825918, 0.3611443, 0.64106447, 1, 0.61873, 0.8132518, 0.40761396, 1, 0.35594854, 0.5452644, 0.23284999, 1, 0.77351433, 0.7971149, 0.5667908, 1, 0.7397217, 0.59494364, 0.46294695, 1, 0.3225033, 0.42213485, 0.47578907, 1, 1, 1, 1, 1)

View file

@ -0,0 +1,5 @@
[gd_resource type="Curve" format=3 uid="uid://d3jm8hqn6hf6v"]
[resource]
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.03899879, 0.2597651), 0.0, 0.0, 0, 0, Vector2(0.4429419, 0.37015414), 0.47422996, 0.47422996, 0, 0, Vector2(0.5, 0.5), 0.39357203, 0.39357203, 0, 0, Vector2(0.94081944, 0.64621437), 0.80014014, 0.80014014, 0, 0, Vector2(1, 1), 5.804001, 0.0, 0, 0]
point_count = 6

View file

@ -0,0 +1,5 @@
[gd_resource type="Curve" format=3 uid="uid://duabj1hpvrf2m"]
[resource]
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.5004223, 0.4959703), 2.8, 2.8, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0]
point_count = 3

View file

@ -0,0 +1,5 @@
[gd_resource type="Gradient" format=3 uid="uid://dpafhsbw2t46k"]
[resource]
offsets = PackedFloat32Array(0.30143952, 0.36898097, 0.4958336, 0.50410336, 0.51667744, 0.5272807, 0.5356805)
colors = PackedColorArray(0, 0, 0.54, 1, 0.34199998, 0.39780006, 0.9, 1, 0.070399985, 0.62362665, 0.88, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0.4569366, 0, 1, 1, 0, 0, 1)

View file

@ -3,6 +3,7 @@
[ext_resource type="Script" uid="uid://bhpic251bgvgk" path="res://src/Main.cs" id="1_611at"] [ext_resource type="Script" uid="uid://bhpic251bgvgk" path="res://src/Main.cs" id="1_611at"]
[ext_resource type="ArrayMesh" uid="uid://65modei4jwaj" path="res://assets/PlanetBase.obj" id="2_k24pf"] [ext_resource type="ArrayMesh" uid="uid://65modei4jwaj" path="res://assets/PlanetBase.obj" id="2_k24pf"]
[ext_resource type="Gradient" uid="uid://b5l44rktieewe" path="res://resources/planet_gradient.tres" id="2_ygjfp"] [ext_resource type="Gradient" uid="uid://b5l44rktieewe" path="res://resources/planet_gradient.tres" id="2_ygjfp"]
[ext_resource type="Curve" uid="uid://d3jm8hqn6hf6v" path="res://resources/remapcurve.tres" id="3_1wiy7"]
[ext_resource type="Material" uid="uid://c55st036tapeo" path="res://shaders/planet.tres" id="3_ygjfp"] [ext_resource type="Material" uid="uid://c55st036tapeo" path="res://shaders/planet.tres" id="3_ygjfp"]
[ext_resource type="Material" uid="uid://k3teblrpopsb" path="res://shaders/map.tres" id="4_1wiy7"] [ext_resource type="Material" uid="uid://k3teblrpopsb" path="res://shaders/map.tres" id="4_1wiy7"]
[ext_resource type="Texture2D" uid="uid://n56csi5ekat" path="res://icon.svg" id="5_ygjfp"] [ext_resource type="Texture2D" uid="uid://n56csi5ekat" path="res://icon.svg" id="5_ygjfp"]
@ -13,13 +14,20 @@
sky_material = SubResource("ProceduralSkyMaterial_uxrcv") sky_material = SubResource("ProceduralSkyMaterial_uxrcv")
[sub_resource type="Environment" id="Environment_rf2cd"] [sub_resource type="Environment" id="Environment_rf2cd"]
background_mode = 2 background_mode = 1
background_color = Color(0.11748905, 0.11748903, 0.11748903, 1)
sky = SubResource("Sky_tlwt5") sky = SubResource("Sky_tlwt5")
ambient_light_source = 3 ambient_light_source = 3
reflected_light_source = 2 reflected_light_source = 2
[sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_a814b"] [sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_a814b"]
[sub_resource type="CylinderMesh" id="CylinderMesh_ygjfp"]
top_radius = 0.005
bottom_radius = 0.005
height = 3.0
radial_segments = 24
[sub_resource type="SphereShape3D" id="SphereShape3D_rpqi1"] [sub_resource type="SphereShape3D" id="SphereShape3D_rpqi1"]
radius = 1.0 radius = 1.0
@ -31,13 +39,14 @@ anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
script = ExtResource("1_611at") script = ExtResource("1_611at")
_yawNode = NodePath("TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo/Yaw") _yawNode = NodePath("TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport/ZaWarudo/Yaw")
_pitchNode = NodePath("TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo/Yaw/Pitch") _pitchNode = NodePath("TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport/ZaWarudo/Yaw/Pitch")
_cameraNode = NodePath("TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo/Yaw/Pitch/Camera3D") _cameraNode = NodePath("TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport/ZaWarudo/Yaw/Pitch/Camera3D")
_meshInstance = NodePath("TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo/Icosphere") _meshInstance = NodePath("TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport/ZaWarudo/Icosphere")
World = NodePath("TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo") World = NodePath("TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport/ZaWarudo")
_textureRect = NodePath("TabContainer/Projection") _textureRect = NodePath("TabContainer/Projection")
_gradient = ExtResource("2_ygjfp") _gradient = ExtResource("2_ygjfp")
_remapCurve = ExtResource("3_1wiy7")
[node name="TabContainer" type="TabContainer" parent="." unique_id=1586027287] [node name="TabContainer" type="TabContainer" parent="." unique_id=1586027287]
layout_mode = 1 layout_mode = 1
@ -52,51 +61,94 @@ current_tab = 0
layout_mode = 2 layout_mode = 2
metadata/_tab_index = 0 metadata/_tab_index = 0
[node name="SubViewportContainer" type="SubViewportContainer" parent="TabContainer/Planet" unique_id=58474785] [node name="VBoxContainer" type="VBoxContainer" parent="TabContainer/Planet" unique_id=1579792581]
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_stretch_ratio = 1.44 size_flags_stretch_ratio = 1.44
[node name="SubViewportContainer" type="SubViewportContainer" parent="TabContainer/Planet/VBoxContainer" unique_id=58474785]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
size_flags_stretch_ratio = 1.44
stretch = true stretch = true
[node name="SubViewport" type="SubViewport" parent="TabContainer/Planet/SubViewportContainer" unique_id=1257998631] [node name="SubViewport" type="SubViewport" parent="TabContainer/Planet/VBoxContainer/SubViewportContainer" unique_id=1257998631]
handle_input_locally = false handle_input_locally = false
size = Vector2i(677, 617) size = Vector2i(677, 499)
render_target_update_mode = 4 render_target_update_mode = 4
[node name="ZaWarudo" type="Node3D" parent="TabContainer/Planet/SubViewportContainer/SubViewport" unique_id=937719505] [node name="ZaWarudo" type="Node3D" parent="TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport" unique_id=937719505]
[node name="WorldEnvironment" type="WorldEnvironment" parent="TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo" unique_id=610642146] [node name="WorldEnvironment" type="WorldEnvironment" parent="TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport/ZaWarudo" unique_id=610642146]
environment = SubResource("Environment_rf2cd") environment = SubResource("Environment_rf2cd")
camera_attributes = SubResource("CameraAttributesPractical_a814b") camera_attributes = SubResource("CameraAttributesPractical_a814b")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo" unique_id=899426195] [node name="Sun" type="DirectionalLight3D" parent="TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport/ZaWarudo" unique_id=899426195]
unique_name_in_owner = true
transform = Transform3D(0.99999994, 0, 0, 0, 0.99999994, 0, 0, 0, 0.99999994, 0, 0, 0) transform = Transform3D(0.99999994, 0, 0, 0, 0.99999994, 0, 0, 0, 0.99999994, 0, 0, 0)
[node name="Icosphere" type="MeshInstance3D" parent="TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo" unique_id=793654005] [node name="Icosphere" type="MeshInstance3D" parent="TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport/ZaWarudo" unique_id=793654005]
transform = Transform3D(0.01, 0, 0, 0, 0.01, 0, 0, 0, 0.01, 0, 0, 0) transform = Transform3D(0.01, 0, 0, 0, 0.01, 0, 0, 0, 0.01, 0, 0, 0)
mesh = ExtResource("2_k24pf") mesh = ExtResource("2_k24pf")
surface_material_override/0 = ExtResource("3_ygjfp") surface_material_override/0 = ExtResource("3_ygjfp")
[node name="Yaw" type="Node3D" parent="TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo" unique_id=2073443785] [node name="MeshInstance3D" type="MeshInstance3D" parent="TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport/ZaWarudo/Icosphere" unique_id=1889403188]
transform = Transform3D(100, 0, 0, 0, 100, 0, 0, 0, 100, 0, 0, 0)
mesh = SubResource("CylinderMesh_ygjfp")
[node name="Pitch" type="Node3D" parent="TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo/Yaw" unique_id=98015529] [node name="Pointer" type="Sprite3D" parent="TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport/ZaWarudo/Icosphere" unique_id=1498529325]
[node name="Camera3D" type="Camera3D" parent="TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo/Yaw/Pitch" unique_id=1654616370]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 30)
fov = 5.0
[node name="StaticBody3D" type="StaticBody3D" parent="TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo" unique_id=330930041]
[node name="CollisionShape3D" type="CollisionShape3D" parent="TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo/StaticBody3D" unique_id=299495076]
shape = SubResource("SphereShape3D_rpqi1")
[node name="Pointer" type="Sprite3D" parent="TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo" unique_id=1498529325]
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform3D(0.01, 0, 0, 0, 0.01, 0, 0, 0, 0.01, 0, 0, 0)
modulate = Color(1, 0, 0, 1) modulate = Color(1, 0, 0, 1)
billboard = 1 billboard = 1
texture = ExtResource("5_ygjfp") texture = ExtResource("5_ygjfp")
[node name="Yaw" type="Node3D" parent="TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport/ZaWarudo" unique_id=2073443785]
[node name="Pitch" type="Node3D" parent="TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport/ZaWarudo/Yaw" unique_id=98015529]
[node name="Camera3D" type="Camera3D" parent="TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport/ZaWarudo/Yaw/Pitch" unique_id=1654616370]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 30)
fov = 5.0
[node name="StaticBody3D" type="StaticBody3D" parent="TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport/ZaWarudo" unique_id=330930041]
[node name="CollisionShape3D" type="CollisionShape3D" parent="TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport/ZaWarudo/StaticBody3D" unique_id=299495076]
shape = SubResource("SphereShape3D_rpqi1")
[node name="MarginContainer" type="MarginContainer" parent="TabContainer/Planet/VBoxContainer" unique_id=1706135009]
layout_mode = 2
theme_override_constants/margin_left = 8
theme_override_constants/margin_top = 8
theme_override_constants/margin_right = 8
theme_override_constants/margin_bottom = 8
[node name="VBoxContainer" type="VBoxContainer" parent="TabContainer/Planet/VBoxContainer/MarginContainer" unique_id=781791664]
layout_mode = 2
[node name="Label" type="Label" parent="TabContainer/Planet/VBoxContainer/MarginContainer/VBoxContainer" unique_id=882691555]
layout_mode = 2
text = "Sun Angle"
horizontal_alignment = 1
[node name="SunAngle" type="HSlider" parent="TabContainer/Planet/VBoxContainer/MarginContainer/VBoxContainer" unique_id=1452623828]
unique_name_in_owner = true
layout_mode = 2
max_value = 360.0
[node name="HSeparator" type="HSeparator" parent="TabContainer/Planet/VBoxContainer/MarginContainer/VBoxContainer" unique_id=1053749080]
layout_mode = 2
[node name="Label2" type="Label" parent="TabContainer/Planet/VBoxContainer/MarginContainer/VBoxContainer" unique_id=473804807]
layout_mode = 2
text = "Planet Rotation"
horizontal_alignment = 1
[node name="PlanetAngle" type="HSlider" parent="TabContainer/Planet/VBoxContainer/MarginContainer/VBoxContainer" unique_id=1574475714]
unique_name_in_owner = true
layout_mode = 2
max_value = 360.0
[node name="PanelContainer" type="PanelContainer" parent="TabContainer/Planet" unique_id=716838825] [node name="PanelContainer" type="PanelContainer" parent="TabContainer/Planet" unique_id=716838825]
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
@ -111,6 +163,24 @@ theme_override_constants/margin_bottom = 12
[node name="VBoxContainer2" type="VBoxContainer" parent="TabContainer/Planet/PanelContainer/MarginContainer" unique_id=1788559732] [node name="VBoxContainer2" type="VBoxContainer" parent="TabContainer/Planet/PanelContainer/MarginContainer" unique_id=1788559732]
layout_mode = 2 layout_mode = 2
[node name="VBoxContainer2" type="VBoxContainer" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer2" unique_id=525897562]
layout_mode = 2
[node name="HBoxContainer" type="HBoxContainer" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer2/VBoxContainer2" unique_id=902181636]
layout_mode = 2
[node name="Label" type="Label" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer2/VBoxContainer2/HBoxContainer" unique_id=1460559875]
layout_mode = 2
text = "Axial Tilt"
[node name="AxialTilt" type="LineEdit" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer2/VBoxContainer2/HBoxContainer" unique_id=1085416630]
unique_name_in_owner = true
layout_mode = 2
text = "23.5"
[node name="HSeparator" type="HSeparator" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer2" unique_id=907047328]
layout_mode = 2
[node name="VBoxContainer" type="VBoxContainer" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer2" unique_id=654818970] [node name="VBoxContainer" type="VBoxContainer" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer2" unique_id=654818970]
layout_mode = 2 layout_mode = 2
size_flags_vertical = 3 size_flags_vertical = 3
@ -257,6 +327,13 @@ stretch_mode = 5
metadata/_tab_index = 1 metadata/_tab_index = 1
[connection signal="tab_changed" from="TabContainer" to="." method="Tab"] [connection signal="tab_changed" from="TabContainer" to="." method="Tab"]
[connection signal="mouse_entered" from="TabContainer/Planet/VBoxContainer/SubViewportContainer" to="." method="MouseInViewport"]
[connection signal="mouse_exited" from="TabContainer/Planet/VBoxContainer/SubViewportContainer" to="." method="MouseLeftViewport"]
[connection signal="drag_ended" from="TabContainer/Planet/VBoxContainer/MarginContainer/VBoxContainer/SunAngle" to="." method="SunAngleStop"]
[connection signal="drag_started" from="TabContainer/Planet/VBoxContainer/MarginContainer/VBoxContainer/SunAngle" to="." method="SunAngleStart"]
[connection signal="drag_ended" from="TabContainer/Planet/VBoxContainer/MarginContainer/VBoxContainer/PlanetAngle" to="." method="PlanetAngleStop"]
[connection signal="drag_started" from="TabContainer/Planet/VBoxContainer/MarginContainer/VBoxContainer/PlanetAngle" to="." method="PlanetAngleStart"]
[connection signal="text_changed" from="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer2/VBoxContainer2/HBoxContainer/AxialTilt" to="." method="AxialTiltChanged"]
[connection signal="pressed" from="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer2/VBoxContainer/HBoxContainer3/Reset" to="." method="MakeGo"] [connection signal="pressed" from="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer2/VBoxContainer/HBoxContainer3/Reset" to="." method="MakeGo"]
[connection signal="pressed" from="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer2/VBoxContainer/HBoxContainer3/Advance" to="." method="Advance"] [connection signal="pressed" from="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer2/VBoxContainer/HBoxContainer3/Advance" to="." method="Advance"]
[connection signal="pressed" from="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer2/VBoxContainer/HBoxContainer3/AutoRun" to="." method="AutoRun"] [connection signal="pressed" from="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer2/VBoxContainer/HBoxContainer3/AutoRun" to="." method="AutoRun"]

View file

@ -1,5 +1,4 @@
shader_type spatial; shader_type spatial;
render_mode unshaded;
uniform int mode = 1; uniform int mode = 1;
uniform sampler2D gradient; uniform sampler2D gradient;
@ -9,7 +8,7 @@ void vertex() {
// Called for every vertex the material is visible on. // Called for every vertex the material is visible on.
world_position = VERTEX; world_position = VERTEX;
color = COLOR.r; color = COLOR.r;
VERTEX += VERTEX * COLOR.q * 0.1f; VERTEX += VERTEX * COLOR.q * 0.03f;
} }
void fragment() { void fragment() {

View file

@ -8,6 +8,7 @@ using Godot.Collections;
public partial class Main : Control public partial class Main : Control
{ {
public static Random Random = Random.Shared;
private bool _moving = false; private bool _moving = false;
[Export] [Export]
private Node3D _yawNode; private Node3D _yawNode;
@ -30,22 +31,35 @@ public partial class Main : Control
private int _resolution = 512; private int _resolution = 512;
private PlanetHelper _planetHelper; private PlanetHelper _planetHelper;
[Export] private Curve _remapCurve;
public override void _Ready() public override void _Ready()
{ {
_planetHelper = new PlanetHelper(_meshInstance, _textureRect); _planetHelper = new PlanetHelper(_meshInstance, _textureRect, _remapCurve);
UpdateStats(); UpdateStats();
Projector.GatherPoints(_planetHelper, int.Parse(GetNode<LineEdit>("%Resolution").Text)); Projector.GatherPoints(_planetHelper, int.Parse(GetNode<LineEdit>("%Resolution").Text));
AxialTiltChanged(GetNode<LineEdit>("%AxialTilt").Text);
} }
Vector3 _pointerPosition = Vector3.Zero; Vector3 _pointerPosition = Vector3.Zero;
private const float RayLength = 1000.0f; private const float RayLength = 1000.0f;
private bool _rotateable = false;
public void MouseInViewport()
{
_rotateable = true;
}
public void MouseLeftViewport()
{
_rotateable = false;
}
public override void _Input(InputEvent @event) public override void _Input(InputEvent @event)
{ {
if (@event is InputEventMouseButton mouseEvent) if (@event is InputEventMouseButton mouseEvent)
{ {
if (mouseEvent.ButtonIndex == MouseButton.Left) if (mouseEvent.ButtonIndex == MouseButton.Left)
{ {
_moving = mouseEvent.Pressed; _moving = mouseEvent.Pressed && _rotateable;
} }
if (mouseEvent.ButtonIndex == MouseButton.WheelUp) if (mouseEvent.ButtonIndex == MouseButton.WheelUp)
{ {
@ -83,8 +97,8 @@ public partial class Main : Control
if (result.Count > 0) if (result.Count > 0)
{ {
Vector3 pos = result["position"].AsVector3(); Vector3 pos = result["position"].AsVector3();
GD.Print($"Hit: '{pos}'"); GD.Print($"Hit: '{pos}'");
pos *= _meshInstance.Transform.Basis.Orthonormalized();
var closest = _planetHelper.Octree.SearchNearest(pos)?.Id; var closest = _planetHelper.Octree.SearchNearest(pos)?.Id;
if (closest != null) if (closest != null)
{ {
@ -95,7 +109,9 @@ public partial class Main : Control
_plate = null; _plate = null;
UpdateStats(); UpdateStats();
Vector3 vertexPos = _planetHelper.Mdt.GetVertex(_vertex.Id) * 0.01f; Vector3 vertexPos = _planetHelper.Mdt.GetVertex(_vertex.Id) * 0.01f;
_pointerPosition = (Vector3)vertexPos + (vertexPos * (_vertex.Height + 0.01f) * 0.1f); // vertexPos * 1.01f; vertexPos *= _meshInstance.Transform.Basis.Inverse().Orthonormalized();
_pointerPosition = (Vector3)vertexPos + (vertexPos * (_vertex.Height + 0.01f) * 0.03f); // vertexPos * 1.01f;
GetNode<Node3D>("%Pointer").GlobalPosition = _pointerPosition;
} }
} }
@ -110,7 +126,17 @@ public partial class Main : Control
_planetHelper.AutoRun = true; _planetHelper.AutoRun = true;
} }
_planetHelper.Process(); _planetHelper.Process();
GetNode<Node3D>("%Pointer").Position = _pointerPosition; if (_sunRotating)
{
GetNode<Node3D>("%Sun").Rotation -= GetNode<Node3D>("%Sun").Rotation;
GetNode<Node3D>("%Sun").Rotation += new Vector3(0, (float)Mathf.DegToRad(GetNode<HSlider>("%SunAngle").Value), 0);
}
if (_planetRotating)
{
_meshInstance.Rotation = Vector3.Zero;
_meshInstance.RotateY((float)Mathf.DegToRad(GetNode<HSlider>("%PlanetAngle").Value));
_meshInstance.RotateZ(Mathf.DegToRad(_axialTilt));
}
} }
public void UpdateStats() public void UpdateStats()
{ {
@ -141,7 +167,7 @@ public partial class Main : Control
public void MakeGo() public void MakeGo()
{ {
_planetHelper = new PlanetHelper(_meshInstance, _textureRect); _planetHelper = new PlanetHelper(_meshInstance, _textureRect, _remapCurve);
} }
public void Advance() public void Advance()
@ -199,6 +225,39 @@ public partial class Main : Control
{ {
change = new string(change.Where(c => char.IsDigit(c)).ToArray()); change = new string(change.Where(c => char.IsDigit(c)).ToArray());
_resolution = Int32.Parse(change); _resolution = Int32.Parse(change);
_resolution = Math.Clamp(_resolution, 64, 2048); _resolution = Math.Clamp(_resolution, 4, 2048);
}
public void AxialTiltChanged(string value)
{
if (float.TryParse(value, out float tilt))
{
_meshInstance.RotateZ(-_meshInstance.Rotation.Z);
_meshInstance.RotateZ(Mathf.DegToRad(tilt));
_axialTilt = tilt;
}
}
private bool _sunRotating = false;
private float _axialTilt = 0f;
public void SunAngleStart()
{
_sunRotating = true;
}
public void SunAngleStop(bool changed)
{
_sunRotating = false;
}
private bool _planetRotating = false;
private float _planetRotation = 0f;
public void PlanetAngleStart()
{
_planetRotating = true;
}
public void PlanetAngleStop(bool changed)
{
_planetRotating = false;
} }
} }

View file

@ -13,7 +13,7 @@ public class PlanetHelper
{ {
public static float RandF(float min, float max) public static float RandF(float min, float max)
{ {
return min + (max - min) * Random.Shared.NextSingle(); return min + (max - min) * Main.Random.NextSingle();
} }
public class PlateData(int Id = 0, Color Color = new(), bool IsLandform = false, List<int> Vertices = null) public class PlateData(int Id = 0, Color Color = new(), bool IsLandform = false, List<int> Vertices = null)
{ {
@ -100,11 +100,13 @@ public class PlanetHelper
public Oct Octree = new Oct(); public Oct Octree = new Oct();
public PlanetHelper(MeshInstance3D meshInstance, TextureRect textureRect) private Curve _remapCurve;
public PlanetHelper(MeshInstance3D meshInstance, TextureRect textureRect, Curve remapCurve)
{ {
_meshInstance = meshInstance; _meshInstance = meshInstance;
_arrayMesh = meshInstance.Mesh as ArrayMesh; _arrayMesh = meshInstance.Mesh as ArrayMesh;
_textureRect = textureRect; _textureRect = textureRect;
_remapCurve = remapCurve;
_continentalNoise = new FastNoiseLite(); _continentalNoise = new FastNoiseLite();
_mountainNoise = new FastNoiseLite(); _mountainNoise = new FastNoiseLite();
@ -115,7 +117,7 @@ public class PlanetHelper
for (int i = 0; i < Mdt.GetVertexCount(); i++) for (int i = 0; i < Mdt.GetVertexCount(); i++)
{ {
Octree.Insert(new Node(i, Mdt.GetVertex(i) * 0.001f)); Octree.Insert(new Node(i, Mdt.GetVertex(i) * 0.01f));
Mdt.SetVertexColor(i, Colors.Black); Mdt.SetVertexColor(i, Colors.Black);
} }
if (_meshInstance.GetSurfaceOverrideMaterial(0) is ShaderMaterial shaderMaterial) if (_meshInstance.GetSurfaceOverrideMaterial(0) is ShaderMaterial shaderMaterial)
@ -434,7 +436,7 @@ public class PlanetHelper
} }
public void SpreadStress() public void SpreadStress()
{ {
var availableVerts = Vertices.Where(d => d.StageComplete == false && d.IsEdge && d.StrainSamples.Any()).OrderByDescending(d => Mathf.Abs(d.StrainSamples.Max(s => s.Magnitude))).Take(500).ToList(); var availableVerts = Vertices.Where(d => d.StageComplete == false && d.IsEdge && d.StrainSamples.Any()).OrderByDescending(d => Mathf.Abs(d.StrainSamples.Max(s => s.Magnitude))).Take(2500).ToList();
foreach (VertexData vertexData in availableVerts) foreach (VertexData vertexData in availableVerts)
{ {
var neighbours = GetNeighboringVertices(vertexData.Id, false).ToList(); var neighbours = GetNeighboringVertices(vertexData.Id, false).ToList();
@ -491,7 +493,7 @@ public class PlanetHelper
float mountainNoise = (1.0f + _mountainNoise.GetNoise3Dv(GetVertexPosition(vertexData.Id))) * 0.5f; float mountainNoise = (1.0f + _mountainNoise.GetNoise3Dv(GetVertexPosition(vertexData.Id))) * 0.5f;
float hfNoise = _hfNoise.GetNoise3Dv(GetVertexPosition(vertexData.Id)); float hfNoise = _hfNoise.GetNoise3Dv(GetVertexPosition(vertexData.Id));
var majorStrain = AverageStrainList(vertexData.StrainSamples); var majorStrain = AverageStrainList(vertexData.StrainSamples);
var normalRate = -majorStrain.NormalRate * majorStrain.Magnitude * (plate.IsLandform ? 1f : 0.5f); var normalRate = -majorStrain.NormalRate * majorStrain.Magnitude; // * (plate.IsLandform ? 1f : 0.5f);
var edgeDistance = vertexData.EdgeDistance * (plate.IsLandform ? 1f : -1f); var edgeDistance = vertexData.EdgeDistance * (plate.IsLandform ? 1f : -1f);
float height = 0.5f; float height = 0.5f;
//height *= plate.PlateExpansion; //height *= plate.PlateExpansion;
@ -502,7 +504,7 @@ public class PlanetHelper
height = (height + 0.5f * mult) / (1f + mult); height = (height + 0.5f * mult) / (1f + mult);
height += edgeDistance * 0.25f; height += edgeDistance * 0.25f;
height = (height + 0.5f * mult) / (1f + mult); height = (height + 0.5f * mult) / (1f + mult);
height += normalRate * 0.35f; height += normalRate * 0.5f;
height = Mathf.Clamp(height, 0.01f, 0.99f); height = Mathf.Clamp(height, 0.01f, 0.99f);
ColorVertex(vertexData.Id, Colors.White * height); ColorVertex(vertexData.Id, Colors.White * height);
vertexData.StageComplete = true; vertexData.StageComplete = true;
@ -513,8 +515,12 @@ public class PlanetHelper
{ {
GD.Print($"Heights - min:'{Vertices.Min(v => v.Height)}' - max:'{Vertices.Max(v => v.Height)}' - average:'{Vertices.Average(v => v.Height)}'"); GD.Print($"Heights - min:'{Vertices.Min(v => v.Height)}' - max:'{Vertices.Max(v => v.Height)}' - average:'{Vertices.Average(v => v.Height)}'");
ScaleValues(Vertices); ScaleValues(Vertices);
foreach (VertexData vertexData in Vertices) foreach (VertexData vertexData in Vertices)
{
vertexData.Height = _remapCurve.Sample(vertexData.Height);
ColorVertex(vertexData.Id, Colors.White * vertexData.Height); ColorVertex(vertexData.Id, Colors.White * vertexData.Height);
}
float oceanPercentage = Vertices.Count(v => v.Height < 0.5f) / (float)Vertices.Count; float oceanPercentage = Vertices.Count(v => v.Height < 0.5f) / (float)Vertices.Count;
GD.Print($"Ocean Percentage:'{oceanPercentage}'"); GD.Print($"Ocean Percentage:'{oceanPercentage}'");
CompleteStage(); CompleteStage();