added terrain3d

This commit is contained in:
derek
2025-03-31 14:14:50 -05:00
parent 27175618c0
commit bd767d2927
148 changed files with 2602 additions and 1381 deletions

View File

@@ -1,13 +1,11 @@
[gd_scene load_steps=8 format=3 uid="uid://cofnhdcclon1w"]
[ext_resource type="Script" uid="uid://dd26e3lk8oe1l" path="res://demo/src/CodeGenerated.gd" id="1_h7vyv"]
[ext_resource type="Script" uid="uid://dakis6gu8b7nm" path="res://demo/src/CodeGenerated.gd" id="1_h7vyv"]
[ext_resource type="PackedScene" uid="uid://domhm87hbhbg1" path="res://demo/components/Player.tscn" id="2_3v2uf"]
[ext_resource type="PackedScene" uid="uid://bb2lp50sjndus" path="res://demo/components/Environment.tscn" id="3_71ikj"]
[ext_resource type="PackedScene" uid="uid://di5fovhcyd7re" path="res://demo/components/Enemy.tscn" id="4_p8qry"]
[ext_resource type="PackedScene" uid="uid://d2jihfohphuue" path="res://demo/components/UI.tscn" id="4_x5ge4"]
[ext_resource type="Script" uid="uid://br3a8kjyuwoeg" path="res://demo/src/RuntimeNavigationBaker.gd" id="5_445ur"]
[sub_resource type="Resource" id="Resource_mekfw"]
metadata/__load_path__ = "res://demo/components/Player.tscn"
[ext_resource type="Script" uid="uid://brh8x1wnycrl5" path="res://demo/src/RuntimeNavigationBaker.gd" id="5_445ur"]
[sub_resource type="NavigationMesh" id="NavigationMesh_vs6am"]
geometry_parsed_geometry_type = 1
@@ -19,7 +17,7 @@ script = ExtResource("1_h7vyv")
[node name="Environment" parent="." instance=ExtResource("3_71ikj")]
[node name="Player" parent="."]
[node name="Player" parent="." instance=ExtResource("2_3v2uf")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 50, 0)
[node name="Enemy" parent="." node_paths=PackedStringArray("target") instance=ExtResource("4_p8qry")]

View File

@@ -1,15 +1,13 @@
[gd_scene load_steps=12 format=3 uid="uid://chol2xlfbq7cu"]
[ext_resource type="Script" uid="uid://8atelq27qxnq" path="res://demo/src/DemoScene.gd" id="1_k7qca"]
[ext_resource type="Script" uid="uid://chstoagn42gbr" path="res://demo/src/DemoScene.gd" id="1_k7qca"]
[ext_resource type="PackedScene" uid="uid://d2jihfohphuue" path="res://demo/components/UI.tscn" id="2_nqak5"]
[ext_resource type="PackedScene" uid="uid://dwnhqfjq7v1pq" path="res://demo/components/Borders.tscn" id="3_cw38j"]
[ext_resource type="PackedScene" uid="uid://domhm87hbhbg1" path="res://demo/components/Player.tscn" id="3_ht63y"]
[ext_resource type="PackedScene" uid="uid://djhl3foqkj4e2" path="res://demo/components/Tunnel.tscn" id="3_kdh0b"]
[ext_resource type="PackedScene" uid="uid://bb2lp50sjndus" path="res://demo/components/Environment.tscn" id="3_yqldq"]
[ext_resource type="Terrain3DAssets" uid="uid://dal3jhw6241qg" path="res://demo/data/assets.tres" id="8_g2of2"]
[sub_resource type="Resource" id="Resource_wlawv"]
metadata/__load_path__ = "res://demo/components/Player.tscn"
[sub_resource type="Gradient" id="Gradient_vr1m7"]
offsets = PackedFloat32Array(0.2, 1)
colors = PackedColorArray(1, 1, 1, 1, 0, 0, 0, 1)
@@ -35,32 +33,41 @@ noise = SubResource("FastNoiseLite_d8lcj")
_shader_parameters = {
"_mouse_layer": 2147483648,
"auto_base_texture": 0,
"auto_height_reduction": 0.1,
"auto_height_reduction": 0.0,
"auto_overlay_texture": 1,
"auto_slope": 1.0,
"bias_distance": 512.0,
"blend_sharpness": 0.87,
"depth_blur": 0.0,
"dual_scale_far": 170.0,
"dual_scale_near": 100.0,
"dual_scale_reduction": 0.3,
"dual_scale_texture": 0,
"enable_macro_variation": true,
"enable_projection": true,
"height_blending": true,
"macro_variation1": Color(0.878431, 0.862745, 0.901961, 1),
"macro_variation2": Color(0.898039, 0.898039, 0.803922, 1),
"macro_variation1": Color(0.855, 0.8625, 0.9, 1),
"macro_variation2": Color(0.9, 0.885, 0.81, 1),
"macro_variation_slope": 0.333,
"mipmap_bias": 1.0,
"noise1_angle": 0.1,
"noise1_offset": Vector2(0.5, 0.5),
"noise1_scale": 0.04,
"noise2_scale": 0.076,
"noise3_scale": 0.225,
"noise_texture": SubResource("NoiseTexture2D_bov7h"),
"projection_angular_division": 1.0,
"projection_threshold": 0.8,
"tri_scale_reduction": 0.3,
"vertex_normals_distance": 128.0,
"world_noise_fragment_normals": false,
"world_noise_height": 34.0,
"world_noise_lod_distance": 7500.0,
"world_noise_max_octaves": 4,
"world_noise_min_octaves": 2,
"world_noise_offset": Vector3(2.17, -1.225, 1.9),
"world_noise_region_blend": 0.33,
"world_noise_scale": 9.85
"world_noise_scale": 9.85,
"world_space_normal_blend": true
}
world_background = 2
auto_shader = true
@@ -79,7 +86,7 @@ collision_mask = 3
[node name="Tunnel" parent="." instance=ExtResource("3_kdh0b")]
[node name="Player" parent="."]
[node name="Player" parent="." instance=ExtResource("3_ht63y")]
transform = Transform3D(0.176947, 0, -0.98422, 0, 1, 0, 0.98422, 0, 0.176947, 223.143, 105.348, -1833.08)
[node name="Terrain3D" type="Terrain3D" parent="."]

View File

@@ -1,17 +1,15 @@
[gd_scene load_steps=14 format=3 uid="uid://x34e4v60vdmy"]
[ext_resource type="Script" uid="uid://8atelq27qxnq" path="res://demo/src/DemoScene.gd" id="1_po4vw"]
[ext_resource type="Script" path="res://demo/src/DemoScene.gd" id="1_po4vw"]
[ext_resource type="PackedScene" uid="uid://bb2lp50sjndus" path="res://demo/components/Environment.tscn" id="2_i74wg"]
[ext_resource type="PackedScene" uid="uid://dwnhqfjq7v1pq" path="res://demo/components/Borders.tscn" id="3_3upu0"]
[ext_resource type="PackedScene" uid="uid://domhm87hbhbg1" path="res://demo/components/Player.tscn" id="4_fk3ul"]
[ext_resource type="PackedScene" uid="uid://djhl3foqkj4e2" path="res://demo/components/Tunnel.tscn" id="5_2lvlr"]
[ext_resource type="PackedScene" uid="uid://d2jihfohphuue" path="res://demo/components/UI.tscn" id="5_rc7e2"]
[ext_resource type="NavigationMesh" uid="uid://yf3fu23666k8" path="res://demo/data/nav_mesh.res" id="8_6jfdr"]
[ext_resource type="Terrain3DAssets" uid="uid://dal3jhw6241qg" path="res://demo/data/assets.tres" id="10_qmhh8"]
[ext_resource type="PackedScene" uid="uid://di5fovhcyd7re" path="res://demo/components/Enemy.tscn" id="12_b2xl8"]
[sub_resource type="Resource" id="Resource_it78x"]
metadata/__load_path__ = "res://demo/components/Player.tscn"
[sub_resource type="Gradient" id="Gradient_vr1m7"]
offsets = PackedFloat32Array(0.2, 1)
colors = PackedColorArray(1, 1, 1, 1, 0, 0, 0, 1)
@@ -40,22 +38,29 @@ _shader_parameters = {
"auto_height_reduction": 0.1,
"auto_overlay_texture": 1,
"auto_slope": 1.0,
"bias_distance": 512.0,
"blend_sharpness": 0.87,
"depth_blur": 0.0,
"dual_scale_far": 170.0,
"dual_scale_near": 100.0,
"dual_scale_reduction": 0.3,
"dual_scale_texture": 0,
"enable_macro_variation": true,
"enable_projection": true,
"height_blending": true,
"macro_variation1": Color(0.878431, 0.862745, 0.901961, 1),
"macro_variation2": Color(0.898039, 0.898039, 0.803922, 1),
"macro_variation_slope": 0.333,
"mipmap_bias": 1.0,
"noise1_angle": 0.1,
"noise1_offset": Vector2(0.5, 0.5),
"noise1_scale": 0.04,
"noise2_scale": 0.076,
"noise3_scale": 0.225,
"noise_texture": SubResource("NoiseTexture2D_bov7h"),
"tri_scale_reduction": 0.3,
"vertex_normals_distance": 128.0
"projection_angular_division": 1.436,
"projection_threshold": 0.8,
"tri_scale_reduction": 0.3
}
world_background = 0
auto_shader = true
@@ -73,7 +78,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 512, -2.5, 512)
[node name="Tunnel" parent="." instance=ExtResource("5_2lvlr")]
[node name="Player" parent="."]
[node name="Player" parent="." instance=ExtResource("4_fk3ul")]
transform = Transform3D(0.0774673, 0, -0.996995, 0, 1, 0, 0.996995, 0, 0.0774673, 229.418, 104.956, -1838.16)
[node name="Enemy" parent="." node_paths=PackedStringArray("target") instance=ExtResource("12_b2xl8")]

View File

@@ -1,7 +1,6 @@
[gd_resource type="StandardMaterial3D" load_steps=3 format=3 uid="uid://fkhkir6t1hml"]
[gd_resource type="StandardMaterial3D" load_steps=2 format=3 uid="uid://fkhkir6t1hml"]
[ext_resource type="Texture2D" uid="uid://br7bfxcxh60df" path="res://demo/assets/textures/rock030_alb_ht.png" id="1_ahc02"]
[ext_resource type="Texture2D" uid="uid://cr72kjil43vgj" path="res://demo/assets/textures/rock030_nrm_rgh.png" id="2_glxvb"]
[ext_resource type="Texture2D" uid="uid://c307hdmos4gtm" path="res://demo/assets/textures/rock023_nrm_rgh.png" id="2_3is54"]
[resource]
transparency = 1
@@ -9,19 +8,18 @@ vertex_color_use_as_albedo = true
albedo_color = Color(0.4, 1, 1, 0.647059)
metallic_specular = 1.0
roughness = 0.2
roughness_texture = ExtResource("2_glxvb")
roughness_texture = ExtResource("2_3is54")
roughness_texture_channel = 3
emission_enabled = true
emission = Color(0, 0.145098, 0.776471, 1)
emission_energy_multiplier = 1.4
normal_enabled = true
normal_scale = 0.4
normal_texture = ExtResource("2_glxvb")
normal_texture = ExtResource("2_3is54")
rim_enabled = true
rim = 0.25
clearcoat_roughness = 0.0
ao_light_affect = 1.0
ao_texture = ExtResource("1_ahc02")
ao_texture_channel = 3
refraction_enabled = true
refraction_scale = -0.1

View File

@@ -1,7 +1,6 @@
[gd_resource type="StandardMaterial3D" load_steps=3 format=3 uid="uid://cso4f2iyuxpmc"]
[gd_resource type="StandardMaterial3D" load_steps=2 format=3 uid="uid://cso4f2iyuxpmc"]
[ext_resource type="Texture2D" uid="uid://br7bfxcxh60df" path="res://demo/assets/textures/rock030_alb_ht.png" id="1_uwd12"]
[ext_resource type="Texture2D" uid="uid://cr72kjil43vgj" path="res://demo/assets/textures/rock030_nrm_rgh.png" id="2_0wyvn"]
[ext_resource type="Texture2D" uid="uid://c307hdmos4gtm" path="res://demo/assets/textures/rock023_nrm_rgh.png" id="2_1t610"]
[resource]
transparency = 1
@@ -9,18 +8,17 @@ vertex_color_use_as_albedo = true
albedo_color = Color(0.4, 0.4, 1, 0.556863)
metallic_specular = 1.0
roughness = 0.2
roughness_texture = ExtResource("2_0wyvn")
roughness_texture = ExtResource("2_1t610")
roughness_texture_channel = 3
emission_enabled = true
emission = Color(0.235294, 0.145098, 0.776471, 1)
normal_enabled = true
normal_scale = 0.4
normal_texture = ExtResource("2_0wyvn")
normal_texture = ExtResource("2_1t610")
rim_enabled = true
rim = 0.25
clearcoat_roughness = 0.0
ao_light_affect = 1.0
ao_texture = ExtResource("1_uwd12")
ao_texture_channel = 3
refraction_enabled = true
refraction_scale = -0.1

View File

@@ -0,0 +1,24 @@
[gd_resource type="StandardMaterial3D" load_steps=2 format=3 uid="uid://ickkffutwcvo"]
[ext_resource type="Texture2D" uid="uid://c307hdmos4gtm" path="res://demo/assets/textures/rock023_nrm_rgh.png" id="2_k2yhv"]
[resource]
transparency = 1
albedo_color = Color(0.670588, 0.0588235, 0.384314, 0.509804)
metallic_specular = 1.0
roughness = 0.2
roughness_texture = ExtResource("2_k2yhv")
roughness_texture_channel = 3
emission_enabled = true
emission = Color(0.258824, 0.0823529, 0.25098, 1)
normal_enabled = true
normal_scale = 0.4
normal_texture = ExtResource("2_k2yhv")
rim_enabled = true
rim = 0.25
clearcoat_roughness = 0.0
ao_enabled = true
ao_light_affect = 1.0
ao_texture_channel = 3
refraction_enabled = true
refraction_scale = -0.1

View File

@@ -0,0 +1,17 @@
[gd_resource type="StandardMaterial3D" load_steps=3 format=3 uid="uid://d0hyi5n6ng25w"]
[ext_resource type="Texture2D" uid="uid://c88j3oj0lf6om" path="res://demo/assets/textures/rock023_alb_ht.png" id="1_1js8i"]
[ext_resource type="Texture2D" uid="uid://c307hdmos4gtm" path="res://demo/assets/textures/rock023_nrm_rgh.png" id="2_snl3x"]
[resource]
albedo_color = Color(0.501406, 0.501407, 0.501406, 1)
albedo_texture = ExtResource("1_1js8i")
roughness = 0.95
roughness_texture = ExtResource("2_snl3x")
roughness_texture_channel = 3
normal_enabled = true
normal_texture = ExtResource("2_snl3x")
uv1_scale = Vector3(0.4, 0.4, 0.4)
uv1_triplanar = true
uv1_world_triplanar = true
texture_filter = 5

View File

@@ -0,0 +1,16 @@
[gd_resource type="StandardMaterial3D" load_steps=3 format=3 uid="uid://nbbdrx8vma80"]
[ext_resource type="Texture2D" uid="uid://c88j3oj0lf6om" path="res://demo/assets/textures/rock023_alb_ht.png" id="1_mek0c"]
[ext_resource type="Texture2D" uid="uid://c307hdmos4gtm" path="res://demo/assets/textures/rock023_nrm_rgh.png" id="2_pp13c"]
[resource]
vertex_color_use_as_albedo = true
albedo_color = Color(0.83, 0.83, 0.83, 1)
albedo_texture = ExtResource("1_mek0c")
normal_enabled = true
normal_texture = ExtResource("2_pp13c")
uv1_scale = Vector3(0.02, 0.02, 0.02)
uv1_triplanar = true
uv1_triplanar_sharpness = 6.06286
uv1_world_triplanar = true
texture_filter = 5

View File

@@ -1,14 +0,0 @@
[gd_resource type="StandardMaterial3D" load_steps=3 format=3 uid="uid://dlmtxs0c66hj3"]
[ext_resource type="Texture2D" uid="uid://br7bfxcxh60df" path="res://demo/assets/textures/rock030_alb_ht.png" id="1_j5sdo"]
[ext_resource type="Texture2D" uid="uid://cr72kjil43vgj" path="res://demo/assets/textures/rock030_nrm_rgh.png" id="2_yyurh"]
[resource]
vertex_color_use_as_albedo = true
albedo_color = Color(1.351, 1.321, 1.27, 1)
albedo_texture = ExtResource("1_j5sdo")
normal_enabled = true
normal_texture = ExtResource("2_yyurh")
uv1_scale = Vector3(4, 4, 4)
uv1_triplanar_sharpness = 6.06286
texture_filter = 5

View File

@@ -1,15 +0,0 @@
[gd_resource type="StandardMaterial3D" load_steps=3 format=3 uid="uid://dkvsksxpkl1vj"]
[ext_resource type="Texture2D" uid="uid://br7bfxcxh60df" path="res://demo/assets/textures/rock030_alb_ht.png" id="1_j5sdo"]
[ext_resource type="Texture2D" uid="uid://cr72kjil43vgj" path="res://demo/assets/textures/rock030_nrm_rgh.png" id="2_yyurh"]
[resource]
vertex_color_use_as_albedo = true
albedo_color = Color(1.351, 1.321, 1.27, 1)
albedo_texture = ExtResource("1_j5sdo")
normal_enabled = true
normal_texture = ExtResource("2_yyurh")
uv1_scale = Vector3(0.04, 0.04, 0.04)
uv1_triplanar = true
uv1_triplanar_sharpness = 6.06286
texture_filter = 5

View File

@@ -0,0 +1,56 @@
[gd_scene load_steps=9 format=3 uid="uid://bn5nf4esciwex"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_788j8"]
albedo_color = Color(1, 0, 0, 1)
[sub_resource type="SphereMesh" id="SphereMesh_u4ac2"]
material = SubResource("StandardMaterial3D_788j8")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_3i52q"]
albedo_color = Color(1, 0.540167, 0.11, 1)
[sub_resource type="BoxMesh" id="BoxMesh_xyuxq"]
material = SubResource("StandardMaterial3D_3i52q")
size = Vector3(0.85, 0.85, 0.85)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_p0ha4"]
albedo_color = Color(0.48, 1, 0.497333, 1)
[sub_resource type="PrismMesh" id="PrismMesh_xnm4h"]
material = SubResource("StandardMaterial3D_p0ha4")
size = Vector3(1, 1, 0.855)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_4koei"]
albedo_color = Color(0.45, 0.596667, 1, 1)
[sub_resource type="CylinderMesh" id="CylinderMesh_dp7xj"]
material = SubResource("StandardMaterial3D_4koei")
top_radius = 0.0
bottom_radius = 0.34
height = 1.54
radial_segments = 4
[node name="TestMultimesh" type="Node3D"]
[node name="Node3D" type="Node3D" parent="."]
[node name="MeshInstance3D1" type="MeshInstance3D" parent="Node3D"]
mesh = SubResource("SphereMesh_u4ac2")
skeleton = NodePath("../..")
[node name="MeshInstance3D2" type="MeshInstance3D" parent="Node3D"]
visible = false
mesh = SubResource("BoxMesh_xyuxq")
skeleton = NodePath("../..")
[node name="MeshInstance3D3" type="MeshInstance3D" parent="Node3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.118133, 0)
visible = false
mesh = SubResource("PrismMesh_xnm4h")
skeleton = NodePath("../..")
[node name="MeshInstance3D4" type="MeshInstance3D" parent="Node3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.246009, 0)
visible = false
mesh = SubResource("CylinderMesh_dp7xj")
skeleton = NodePath("../..")

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -35,8 +35,8 @@ import_script/path=""
_subresources={
"materials": {
"material_0": {
"use_external/enabled": true,
"use_external/path": "res://demo/assets/materials/M_rock30_tp.tres"
"use_external/enabled": false,
"use_external/path": "uid://nbbdrx8vma80"
}
}
}

File diff suppressed because one or more lines are too long

View File

@@ -6,4 +6,7 @@ Grass:
https://ambientcg.com/view?id=Ground037
Rock:
https://ambientcg.com/view?id=Rock030
https://ambientcg.com/view?id=Rock030
Cliff:
https://ambientcg.com/view?id=Rock023

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 MiB

After

Width:  |  Height:  |  Size: 3.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

View File

@@ -2,8 +2,8 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://br7bfxcxh60df"
path.bptc="res://.godot/imported/rock030_alb_ht.png-b99cd41791a717b81a9364ed61908c19.bptc.ctex"
uid="uid://c88j3oj0lf6om"
path.bptc="res://.godot/imported/rock023_alb_ht.png-9c06b8a5f11d940d1c46d8928f6d6a5c.bptc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
@@ -11,8 +11,8 @@ metadata={
[deps]
source_file="res://demo/assets/textures/rock030_alb_ht.png"
dest_files=["res://.godot/imported/rock030_alb_ht.png-b99cd41791a717b81a9364ed61908c19.bptc.ctex"]
source_file="res://demo/assets/textures/rock023_alb_ht.png"
dest_files=["res://.godot/imported/rock023_alb_ht.png-9c06b8a5f11d940d1c46d8928f6d6a5c.bptc.ctex"]
[params]

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

View File

@@ -2,8 +2,8 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://cr72kjil43vgj"
path.bptc="res://.godot/imported/rock030_nrm_rgh.png-2cdb7838da06bcbe8c41800e68b36b1b.bptc.ctex"
uid="uid://c307hdmos4gtm"
path.bptc="res://.godot/imported/rock023_nrm_rgh.png-dd524905a15817dac8149681cddc8975.bptc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
@@ -11,8 +11,8 @@ metadata={
[deps]
source_file="res://demo/assets/textures/rock030_nrm_rgh.png"
dest_files=["res://.godot/imported/rock030_nrm_rgh.png-2cdb7838da06bcbe8c41800e68b36b1b.bptc.ctex"]
source_file="res://demo/assets/textures/rock023_nrm_rgh.png"
dest_files=["res://.godot/imported/rock023_nrm_rgh.png-dd524905a15817dac8149681cddc8975.bptc.ctex"]
[params]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 MiB

View File

@@ -1,22 +1,10 @@
[gd_scene load_steps=8 format=3 uid="uid://dwnhqfjq7v1pq"]
[gd_scene load_steps=6 format=3 uid="uid://dwnhqfjq7v1pq"]
[ext_resource type="Texture2D" uid="uid://cr72kjil43vgj" path="res://demo/assets/textures/rock030_nrm_rgh.png" id="1_nf248"]
[ext_resource type="Texture2D" uid="uid://br7bfxcxh60df" path="res://demo/assets/textures/rock030_alb_ht.png" id="1_t4onm"]
[ext_resource type="Material" uid="uid://d0hyi5n6ng25w" path="res://demo/assets/materials/M_rock23_black_tp.tres" id="1_goand"]
[sub_resource type="BoxMesh" id="BoxMesh_1kfaq"]
size = Vector3(1025.01, 4, 1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_6nmqq"]
albedo_color = Color(0.670588, 0.670588, 0.670588, 1)
albedo_texture = ExtResource("1_t4onm")
roughness_texture = ExtResource("1_nf248")
roughness_texture_channel = 3
normal_enabled = true
normal_texture = ExtResource("1_nf248")
uv1_scale = Vector3(0.4, 0.4, 0.4)
uv1_triplanar = true
texture_filter = 5
[sub_resource type="BoxShape3D" id="BoxShape3D_s0c8u"]
size = Vector3(1025, 100, 1)
@@ -32,7 +20,7 @@ size = Vector3(1, 100, 3072)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 512)
mesh = SubResource("BoxMesh_1kfaq")
skeleton = NodePath("../..")
surface_material_override/0 = SubResource("StandardMaterial3D_6nmqq")
surface_material_override/0 = ExtResource("1_goand")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 50, 512)
@@ -42,7 +30,7 @@ shape = SubResource("BoxShape3D_s0c8u")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, -2560)
mesh = SubResource("BoxMesh_1kfaq")
skeleton = NodePath("../..")
surface_material_override/0 = SubResource("StandardMaterial3D_6nmqq")
surface_material_override/0 = ExtResource("1_goand")
[node name="CollisionShape3D2" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 50, -2560)
@@ -52,7 +40,7 @@ shape = SubResource("BoxShape3D_s0c8u")
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 512, 2, -1024)
mesh = SubResource("BoxMesh_kfxc8")
skeleton = NodePath("../..")
surface_material_override/0 = SubResource("StandardMaterial3D_6nmqq")
surface_material_override/0 = ExtResource("1_goand")
[node name="CollisionShape3D3" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 512, 50, -1024)
@@ -62,7 +50,7 @@ shape = SubResource("BoxShape3D_pyqb2")
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -512, 2, -1024)
mesh = SubResource("BoxMesh_kfxc8")
skeleton = NodePath("../..")
surface_material_override/0 = SubResource("StandardMaterial3D_6nmqq")
surface_material_override/0 = ExtResource("1_goand")
[node name="CollisionShape3D4" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -512, 50, -1024)

View File

@@ -1,19 +1,17 @@
[gd_scene load_steps=11 format=3 uid="uid://dyt8c2xqmddo2"]
[ext_resource type="Script" uid="uid://8atelq27qxnq" path="res://demo/src/DemoScene.gd" id="1_k7qca"]
[ext_resource type="Script" path="res://demo/src/DemoScene.gd" id="1_k7qca"]
[ext_resource type="PackedScene" uid="uid://bb2lp50sjndus" path="res://demo/components/Environment.tscn" id="2_2yeq8"]
[ext_resource type="PackedScene" uid="uid://dwnhqfjq7v1pq" path="res://demo/components/Borders.tscn" id="3_cw38j"]
[ext_resource type="PackedScene" uid="uid://domhm87hbhbg1" path="res://demo/components/Player.tscn" id="3_ht63y"]
[ext_resource type="PackedScene" uid="uid://d2jihfohphuue" path="res://demo/components/UI.tscn" id="4_gk532"]
[ext_resource type="Terrain3DAssets" uid="uid://dal3jhw6241qg" path="res://demo/data/assets.tres" id="7_mnexy"]
[sub_resource type="Resource" id="Resource_4sph2"]
metadata/__load_path__ = "res://demo/components/Player.tscn"
[sub_resource type="Gradient" id="Gradient_vs32v"]
offsets = PackedFloat32Array(0.3, 1)
[sub_resource type="Gradient" id="Gradient_f1plm"]
offsets = PackedFloat32Array(0.2, 1)
colors = PackedColorArray(1, 1, 1, 1, 0, 0, 0, 1)
[sub_resource type="FastNoiseLite" id="FastNoiseLite_7glc1"]
[sub_resource type="FastNoiseLite" id="FastNoiseLite_bfcw0"]
noise_type = 2
frequency = 0.03
cellular_jitter = 3.0
@@ -25,26 +23,43 @@ domain_warp_fractal_type = 2
domain_warp_fractal_lacunarity = 1.5
domain_warp_fractal_gain = 1.0
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_pvx8q"]
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_quxx0"]
seamless = true
color_ramp = SubResource("Gradient_vs32v")
noise = SubResource("FastNoiseLite_7glc1")
color_ramp = SubResource("Gradient_f1plm")
noise = SubResource("FastNoiseLite_bfcw0")
[sub_resource type="Terrain3DMaterial" id="Terrain3DMaterial_q2wt2"]
[sub_resource type="Terrain3DMaterial" id="Terrain3DMaterial_klrp5"]
_shader_parameters = {
"_mouse_layer": 2147483648,
"auto_base_texture": 0,
"auto_height_reduction": 0.1,
"auto_overlay_texture": 1,
"auto_slope": 1.0,
"bias_distance": 512.0,
"blend_sharpness": 0.87,
"depth_blur": 0.0,
"dual_scale_far": 170.0,
"dual_scale_near": 100.0,
"dual_scale_reduction": 0.3,
"dual_scale_texture": 0,
"enable_macro_variation": true,
"enable_projection": true,
"height_blending": true,
"macro_variation1": Color(1, 1, 1, 1),
"macro_variation2": Color(1, 1, 1, 1),
"macro_variation_slope": 0.333,
"mipmap_bias": 1.0,
"noise1_angle": 0.0,
"noise1_offset": Vector2(0.5, 0.5),
"noise1_scale": 0.05,
"noise2_scale": 0.03,
"noise3_scale": 0.01,
"noise_texture": SubResource("NoiseTexture2D_pvx8q"),
"vertex_normals_distance": 128.0
"noise1_scale": 0.04,
"noise2_scale": 0.076,
"noise3_scale": 0.225,
"noise_texture": SubResource("NoiseTexture2D_quxx0"),
"projection_angular_division": 1.436,
"projection_threshold": 0.8,
"tri_scale_reduction": 0.3
}
auto_shader = true
dual_scaling = true
[node name="Demo" type="Node"]
script = ExtResource("1_k7qca")
@@ -56,12 +71,12 @@ script = ExtResource("1_k7qca")
[node name="Borders" parent="." instance=ExtResource("3_cw38j")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 512, 0, 512)
[node name="Player" parent="."]
[node name="Player" parent="." instance=ExtResource("3_ht63y")]
transform = Transform3D(0.134125, 0, -0.990965, 0, 1, 0, 0.990965, 0, 0.134125, 568, 85, -1926)
[node name="Terrain3D" type="Terrain3D" parent="."]
data_directory = "res://demo/data"
material = SubResource("Terrain3DMaterial_q2wt2")
material = SubResource("Terrain3DMaterial_klrp5")
assets = ExtResource("7_mnexy")
collision_mask = 3
top_level = true

View File

@@ -1,6 +1,6 @@
[gd_scene load_steps=6 format=3 uid="uid://di5fovhcyd7re"]
[ext_resource type="Script" uid="uid://cimcukvh7jjo5" path="res://demo/src/Enemy.gd" id="1_yudyn"]
[ext_resource type="Script" path="res://demo/src/Enemy.gd" id="1_yudyn"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_lwhhq"]
height = 1.5

View File

@@ -0,0 +1,44 @@
[gd_scene load_steps=7 format=3 uid="uid://domhm87hbhbg1"]
[ext_resource type="Script" path="res://demo/src/Player.gd" id="1_nm1yx"]
[ext_resource type="Script" path="res://demo/src/CameraManager.gd" id="2_loos7"]
[sub_resource type="SphereShape3D" id="SphereShape3D_smq6u"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_lwhhq"]
height = 1.5
[sub_resource type="SeparationRayShape3D" id="SeparationRayShape3D_twc2s"]
[sub_resource type="CapsuleMesh" id="CapsuleMesh_lsqiy"]
[node name="Player" type="CharacterBody3D"]
collision_layer = 2
script = ExtResource("1_nm1yx")
[node name="CameraManager" type="Node3D" parent="."]
script = ExtResource("2_loos7")
[node name="Arm" type="SpringArm3D" parent="CameraManager"]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 0.906308, 0.422618, 0, -0.422618, 0.906308, 0, 2.32515, -0.0321627)
shape = SubResource("SphereShape3D_smq6u")
spring_length = 6.0
margin = 0.5
[node name="Camera3D" type="Camera3D" parent="CameraManager/Arm"]
unique_name_in_owner = true
near = 0.25
far = 16384.0
[node name="CollisionShapeBody" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.25, 0)
shape = SubResource("CapsuleShape3D_lwhhq")
[node name="CollisionShapeRay" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 1, 0)
shape = SubResource("SeparationRayShape3D_twc2s")
[node name="Body" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
mesh = SubResource("CapsuleMesh_lsqiy")

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=12 format=3 uid="uid://djhl3foqkj4e2"]
[gd_scene load_steps=10 format=3 uid="uid://djhl3foqkj4e2"]
[ext_resource type="PackedScene" uid="uid://be6nrf0b8j4l0" path="res://demo/assets/models/RockA.tscn" id="1_m1xck"]
[ext_resource type="PackedScene" uid="uid://bwvtgwartxt0g" path="res://demo/assets/models/RockB.tscn" id="2_hybky"]
@@ -6,30 +6,8 @@
[ext_resource type="PackedScene" uid="uid://vvayjv3rbx1d" path="res://demo/assets/models/Tunnel.tscn" id="4_klbpo"]
[ext_resource type="PackedScene" uid="uid://cribhhvg03u8g" path="res://demo/assets/models/CrystalC.tscn" id="5_bb2w0"]
[ext_resource type="Material" uid="uid://cso4f2iyuxpmc" path="res://demo/assets/materials/M_crystal_purple.tres" id="6_s6twx"]
[ext_resource type="Texture2D" uid="uid://br7bfxcxh60df" path="res://demo/assets/textures/rock030_alb_ht.png" id="7_pqaf8"]
[ext_resource type="Texture2D" uid="uid://cr72kjil43vgj" path="res://demo/assets/textures/rock030_nrm_rgh.png" id="8_hh7se"]
[ext_resource type="Script" uid="uid://bpye6axtbsyq2" path="res://demo/src/CaveEntrance.gd" id="9_fn2ke"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_0v0nf"]
transparency = 1
albedo_color = Color(0.670588, 0.0588235, 0.384314, 0.509804)
metallic_specular = 1.0
roughness = 0.2
roughness_texture = ExtResource("8_hh7se")
roughness_texture_channel = 3
emission_enabled = true
emission = Color(0.258824, 0.0823529, 0.25098, 1)
normal_enabled = true
normal_scale = 0.4
normal_texture = ExtResource("8_hh7se")
rim_enabled = true
rim = 0.25
clearcoat_roughness = 0.0
ao_light_affect = 1.0
ao_texture = ExtResource("7_pqaf8")
ao_texture_channel = 3
refraction_enabled = true
refraction_scale = -0.1
[ext_resource type="Material" uid="uid://ickkffutwcvo" path="res://demo/assets/materials/M_crystal_red.tres" id="7_7fkm2"]
[ext_resource type="Script" uid="uid://c444j1ucmv5ti" path="res://demo/src/CaveEntrance.gd" id="9_fn2ke"]
[sub_resource type="BoxShape3D" id="BoxShape3D_goiy4"]
size = Vector3(530.482, 38.6343, 235.603)
@@ -151,19 +129,19 @@ transform = Transform3D(-0.536793, -0.0213862, -0.199931, 0.0789312, -0.546626,
transform = Transform3D(0.898105, -0.188271, 0.0864646, 0.196692, 0.654036, -0.618921, 0.0650697, 0.621535, 0.677476, 0.589844, 2.22089, 3.04785)
[node name="Rock3" parent="CrystalGroup3/CrystalC" index="0"]
surface_material_override/0 = SubResource("StandardMaterial3D_0v0nf")
surface_material_override/0 = ExtResource("7_7fkm2")
[node name="CrystalC3" parent="CrystalGroup3" instance=ExtResource("5_bb2w0")]
transform = Transform3D(0.15544, 0.0752453, -1.06348, -0.370935, 1.01139, 0.0173435, 0.999527, 0.363637, 0.171821, 4.00867, 3.69458, -0.617432)
[node name="Rock3" parent="CrystalGroup3/CrystalC3" index="0"]
surface_material_override/0 = SubResource("StandardMaterial3D_0v0nf")
surface_material_override/0 = ExtResource("7_7fkm2")
[node name="CrystalC2" parent="CrystalGroup3" instance=ExtResource("5_bb2w0")]
transform = Transform3D(-0.573134, -0.100696, 0.847536, 0.285048, 0.939695, 0.304405, -0.804489, 0.404691, -0.495942, 7.2887, 1.71283, 4.52771)
[node name="Rock3" parent="CrystalGroup3/CrystalC2" index="0"]
surface_material_override/0 = SubResource("StandardMaterial3D_0v0nf")
surface_material_override/0 = ExtResource("7_7fkm2")
[node name="OmniLight3D" type="OmniLight3D" parent="CrystalGroup3"]
transform = Transform3D(1.74454, 2.98023e-08, -2.98023e-08, -5.60482e-08, 1.74454, 1.49012e-07, 3.43338e-08, -1.78814e-07, 1.74454, 1.11737, 4.79865, 1.8949)

View File

@@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://d2jihfohphuue"]
[ext_resource type="Script" uid="uid://d0otq0fkpg0nh" path="res://demo/src/UI.gd" id="1_why5e"]
[ext_resource type="Script" path="res://demo/src/UI.gd" id="1_why5e"]
[node name="UI" type="Control"]
layout_mode = 3

View File

@@ -1,31 +1,36 @@
[gd_resource type="Terrain3DAssets" load_steps=9 format=3 uid="uid://dal3jhw6241qg"]
[ext_resource type="Texture2D" uid="uid://br7bfxcxh60df" path="res://demo/assets/textures/rock030_alb_ht.png" id="1_v81ad"]
[ext_resource type="Texture2D" uid="uid://cr72kjil43vgj" path="res://demo/assets/textures/rock030_nrm_rgh.png" id="2_72dup"]
[ext_resource type="Texture2D" uid="uid://c88j3oj0lf6om" path="res://demo/assets/textures/rock023_alb_ht.png" id="2_pog6b"]
[ext_resource type="Texture2D" uid="uid://ddprscrpsofah" path="res://demo/assets/textures/ground037_alb_ht.png" id="3_g8f2m"]
[ext_resource type="Texture2D" uid="uid://c307hdmos4gtm" path="res://demo/assets/textures/rock023_nrm_rgh.png" id="3_wncaf"]
[ext_resource type="Texture2D" uid="uid://c1ots7w6i0i1q" path="res://demo/assets/textures/ground037_nrm_rgh.png" id="4_aw5y1"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_aubfq"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_rh15k"]
transparency = 4
cull_mode = 2
vertex_color_use_as_albedo = true
backlight_enabled = true
backlight = Color(0.5, 0.5, 0.5, 1)
distance_fade_mode = 1
distance_fade_min_distance = 960.0
distance_fade_max_distance = 480.0
distance_fade_min_distance = 128.0
distance_fade_max_distance = 96.0
[sub_resource type="Terrain3DMeshAsset" id="Terrain3DMeshAsset_dw1mh"]
height_offset = 0.5
density = 10.0
material_override = SubResource("StandardMaterial3D_aubfq")
[sub_resource type="Terrain3DMeshAsset" id="Terrain3DMeshAsset_y3ibi"]
enabled = false
generated_type = 1
height_offset = 0.5
material_override = SubResource("StandardMaterial3D_rh15k")
last_lod = 0
last_shadow_lod = 0
lod0_range = 128.0
[sub_resource type="Terrain3DTextureAsset" id="Terrain3DTextureAsset_mup2f"]
name = "Rock"
albedo_color = Color(1.596, 1.56, 1.5, 1)
albedo_texture = ExtResource("1_v81ad")
normal_texture = ExtResource("2_72dup")
[sub_resource type="Terrain3DTextureAsset" id="Terrain3DTextureAsset_lha57"]
name = "Cliff"
albedo_texture = ExtResource("2_pog6b")
normal_texture = ExtResource("3_wncaf")
normal_depth = 1.0
ao_strength = 2.0
roughness = -0.05
[sub_resource type="Terrain3DTextureAsset" id="Terrain3DTextureAsset_od0q7"]
name = "Grass"
@@ -33,7 +38,11 @@ id = 1
albedo_color = Color(0.67451, 0.74902, 0.686275, 1)
albedo_texture = ExtResource("3_g8f2m")
normal_texture = ExtResource("4_aw5y1")
normal_depth = 1.0
ao_strength = 2.0
uv_scale = 0.2
detiling_rotation = 0.161
[resource]
mesh_list = Array[Terrain3DMeshAsset]([SubResource("Terrain3DMeshAsset_dw1mh")])
texture_list = Array[Terrain3DTextureAsset]([SubResource("Terrain3DTextureAsset_mup2f"), SubResource("Terrain3DTextureAsset_od0q7")])
mesh_list = Array[Terrain3DMeshAsset]([SubResource("Terrain3DMeshAsset_y3ibi")])
texture_list = Array[Terrain3DTextureAsset]([SubResource("Terrain3DTextureAsset_lha57"), SubResource("Terrain3DTextureAsset_od0q7")])

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1 +1 @@
uid://6isldwgof4yb
uid://b62ppvc03a6b1

View File

@@ -1 +1 @@
uid://bpye6axtbsyq2
uid://c444j1ucmv5ti

View File

@@ -1,34 +1,133 @@
extends Node
var terrain: Terrain3D
func _ready():
func _ready() -> void:
$UI.player = $Player
if has_node("RunThisSceneLabel3D"):
$RunThisSceneLabel3D.queue_free()
# Create a terrain
var terrain := Terrain3D.new()
terrain.assets = Terrain3DAssets.new()
terrain.name = "Terrain3D"
terrain.set_collision_enabled(false)
add_child(terrain, true)
terrain.material.world_background = Terrain3DMaterial.NONE
# Generate 32-bit noise and import it with scale
var noise := FastNoiseLite.new()
noise.frequency = 0.0005
var img: Image = Image.create(2048, 2048, false, Image.FORMAT_RF)
for x in 2048:
for y in 2048:
img.set_pixel(x, y, Color(noise.get_noise_2d(x, y)*0.5, 0., 0., 1.))
terrain.data.import_images([img, null, null], Vector3(-1024, 0, -1024), 0.0, 300.0)
# Enable collision. Enable the first if you wish to see it with Debug/Visible Collision Shapes
#terrain.set_show_debug_collision(true)
terrain.set_collision_enabled(true)
terrain = await create_terrain()
# Enable runtime navigation baking using the terrain
# Enable `Debug/Visible Navigation` if you wish to see it
$RuntimeNavigationBaker.terrain = terrain
$RuntimeNavigationBaker.enabled = true
func create_terrain() -> Terrain3D:
# Create textures
var green_gr := Gradient.new()
green_gr.set_color(0, Color.from_hsv(100./360., .35, .3))
green_gr.set_color(1, Color.from_hsv(120./360., .4, .37))
var green_ta: Terrain3DTextureAsset = await create_texture_asset("Grass", green_gr, 1024)
green_ta.uv_scale = 0.1
green_ta.detiling_rotation = 0.1
var brown_gr := Gradient.new()
brown_gr.set_color(0, Color.from_hsv(30./360., .4, .3))
brown_gr.set_color(1, Color.from_hsv(30./360., .4, .4))
var brown_ta: Terrain3DTextureAsset = await create_texture_asset("Dirt", brown_gr, 1024)
brown_ta.uv_scale = 0.03
green_ta.detiling_rotation = 0.1
var grass_ma: Terrain3DMeshAsset = create_mesh_asset("Grass", Color.from_hsv(120./360., .4, .37))
# Create a terrain
var terrain := Terrain3D.new()
terrain.name = "Terrain3D"
add_child(terrain, true)
# Set material and assets
terrain.material.world_background = Terrain3DMaterial.NONE
terrain.material.auto_shader = true
terrain.material.set_shader_param("auto_slope", 10)
terrain.material.set_shader_param("blend_sharpness", .975)
terrain.assets = Terrain3DAssets.new()
terrain.assets.set_texture(0, green_ta)
terrain.assets.set_texture(1, brown_ta)
terrain.assets.set_mesh_asset(0, grass_ma)
# Generate height map w/ 32-bit noise and import it with scale
var noise := FastNoiseLite.new()
noise.frequency = 0.0005
var img: Image = Image.create_empty(2048, 2048, false, Image.FORMAT_RF)
for x in img.get_width():
for y in img.get_height():
img.set_pixel(x, y, Color(noise.get_noise_2d(x, y), 0., 0., 1.))
terrain.region_size = 1024
terrain.data.import_images([img, null, null], Vector3(-1024, 0, -1024), 0.0, 150.0)
# Instance foliage
var xforms: Array[Transform3D]
var width: int = 100
var step: int = 2
for x in range(0, width, step):
for z in range(0, width, step):
var pos := Vector3(x, 0, z) - Vector3(width, 0, width) * .5
pos.y = terrain.data.get_height(pos)
xforms.push_back(Transform3D(Basis(), pos))
terrain.instancer.add_transforms(0, xforms)
# Enable the next line and `Debug/Visible Collision Shapes` to see collision
#terrain.collision.mode = Terrain3DCollision.DYNAMIC_EDITOR
return terrain
func create_texture_asset(asset_name: String, gradient: Gradient, texture_size: int = 512) -> Terrain3DTextureAsset:
# Create noise map
var fnl := FastNoiseLite.new()
fnl.frequency = 0.004
# Create albedo noise texture
var alb_noise_tex := NoiseTexture2D.new()
alb_noise_tex.width = texture_size
alb_noise_tex.height = texture_size
alb_noise_tex.seamless = true
alb_noise_tex.noise = fnl
alb_noise_tex.color_ramp = gradient
await alb_noise_tex.changed
var alb_noise_img: Image = alb_noise_tex.get_image()
# Create albedo + height texture
for x in alb_noise_img.get_width():
for y in alb_noise_img.get_height():
var clr: Color = alb_noise_img.get_pixel(x, y)
clr.a = clr.v # Noise as height
alb_noise_img.set_pixel(x, y, clr)
alb_noise_img.generate_mipmaps()
var albedo := ImageTexture.create_from_image(alb_noise_img)
# Create normal + rough texture
var nrm_noise_tex := NoiseTexture2D.new()
nrm_noise_tex.width = texture_size
nrm_noise_tex.height = texture_size
nrm_noise_tex.as_normal_map = true
nrm_noise_tex.seamless = true
nrm_noise_tex.noise = fnl
await nrm_noise_tex.changed
var nrm_noise_img = nrm_noise_tex.get_image()
for x in nrm_noise_img.get_width():
for y in nrm_noise_img.get_height():
var normal_rgh: Color = nrm_noise_img.get_pixel(x, y)
normal_rgh.a = 0.8 # Roughness
nrm_noise_img.set_pixel(x, y, normal_rgh)
nrm_noise_img.generate_mipmaps()
var normal := ImageTexture.create_from_image(nrm_noise_img)
var ta := Terrain3DTextureAsset.new()
ta.name = asset_name
ta.albedo_texture = albedo
ta.normal_texture = normal
return ta
func create_mesh_asset(asset_name: String, color: Color) -> Terrain3DMeshAsset:
var ma := Terrain3DMeshAsset.new()
ma.name = asset_name
ma.generated_type = Terrain3DMeshAsset.TYPE_TEXTURE_CARD
ma.material_override.albedo_color = color
return ma

View File

@@ -1 +1 @@
uid://dd26e3lk8oe1l
uid://dakis6gu8b7nm

View File

@@ -1,8 +1,23 @@
@tool
extends Node
@onready var terrain: Terrain3D = find_child("Terrain3D")
func _ready():
if not Engine.is_editor_hint() and has_node("UI"):
$UI.player = $Player
# Load Sky3D into the demo environment if enabled
if Engine.is_editor_hint() and has_node("Environment") and \
Engine.get_singleton(&"EditorInterface").is_plugin_enabled("sky_3d"):
$Environment.queue_free()
var sky3d = load("res://addons/sky_3d/src/Sky3D.gd").new()
sky3d.name = "Sky3D"
add_child(sky3d, true)
move_child(sky3d, 1)
sky3d.owner = self
sky3d.current_time = 10
sky3d.enable_editor_time = false

View File

@@ -1 +1 @@
uid://8atelq27qxnq
uid://chstoagn42gbr

View File

@@ -45,6 +45,12 @@ func _physics_process(p_delta: float) -> void:
else:
_on_velocity_computed(velocity)
# Ensure enemy doesn't fall through terrain when collision absent
if get_parent().terrain:
var height: float = get_parent().terrain.data.get_height(global_position)
if not is_nan(height):
global_position.y = maxf(global_position.y, height)
func _on_velocity_computed(p_safe_velocity: Vector3) -> void:
velocity.x = p_safe_velocity.x

View File

@@ -1 +1 @@
uid://cimcukvh7jjo5
uid://6j2rrp5f1gjs

View File

@@ -28,7 +28,7 @@ extends CharacterBody3D
func _physics_process(p_delta) -> void:
var direction: Vector3 = get_camera_relative_input()
var h_veloc: Vector2 = Vector2(direction.x, direction.z) * MOVE_SPEED
var h_veloc: Vector2 = Vector2(direction.x, direction.z).normalized() * MOVE_SPEED
if Input.is_key_pressed(KEY_SHIFT):
h_veloc *= 2
velocity.x = h_veloc.x
@@ -57,7 +57,7 @@ func get_camera_relative_input() -> Vector3:
MOVE_SPEED = clamp(MOVE_SPEED + .5, 5, 9999)
if Input.is_key_pressed(KEY_KP_SUBTRACT) or Input.is_key_pressed(KEY_MINUS):
MOVE_SPEED = clamp(MOVE_SPEED - .5, 5, 9999)
return input_dir
return input_dir
func _input(p_event: InputEvent) -> void:

1
demo/src/Player.gd.uid Normal file
View File

@@ -0,0 +1 @@
uid://dajlr3n5wjwmb

View File

@@ -1 +0,0 @@
uid://dthbn7g43c6m4

View File

@@ -79,7 +79,7 @@ func set_template(p_value: NavigationMesh) -> void:
func parse_scene() -> void:
_scene_geometry = NavigationMeshSourceGeometryData3D.new()
NavigationMeshGenerator.parse_source_geometry_data(template, _scene_geometry, self)
NavigationServer3D.parse_source_geometry_data(template, _scene_geometry, self)
func _update_map_cell_size() -> void:
@@ -131,7 +131,7 @@ func _task_bake(p_center: Vector3) -> void:
source_geometry.add_faces(faces, Transform3D.IDENTITY)
if source_geometry.has_data():
NavigationMeshGenerator.bake_from_source_geometry_data(nav_mesh, source_geometry)
NavigationServer3D.bake_from_source_geometry_data(nav_mesh, source_geometry)
_bake_finished.call_deferred(nav_mesh)
else:
_bake_finished.call_deferred(null)
@@ -149,4 +149,3 @@ func _bake_finished(p_nav_mesh: NavigationMesh) -> void:
bake_finished.emit()
assert(!NavigationServer3D.region_get_use_edge_connections(_nav_region.get_region_rid()))

View File

@@ -1 +1 @@
uid://br3a8kjyuwoeg
uid://brh8x1wnycrl5

View File

@@ -27,7 +27,7 @@ func _process(p_delta) -> void:
UI toggle: F9
Render mode: F10
Full screen: F11
Mouse toggle: Escape
Mouse toggle: Escape / F12
"""
@@ -47,7 +47,7 @@ func _unhandled_key_input(p_event: InputEvent) -> void:
KEY_F11:
toggle_fullscreen()
get_viewport().set_input_as_handled()
KEY_ESCAPE:
KEY_ESCAPE, KEY_F12:
if Input.get_mouse_mode() == Input.MOUSE_MODE_VISIBLE:
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
else:
@@ -62,4 +62,3 @@ func toggle_fullscreen() -> void:
DisplayServer.window_set_size(Vector2(1280, 720))
else:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_EXCLUSIVE_FULLSCREEN)

View File

@@ -1 +1 @@
uid://d0otq0fkpg0nh
uid://dne6na1m4xku8