Fix washed-out look (inverted terrain normals via winding), tune lighting/fog, add tree+rock collision
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,6 +1,7 @@
|
||||
# Godot 4
|
||||
.godot/
|
||||
.import/
|
||||
*.import
|
||||
export.cfg
|
||||
export_presets.cfg
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
[gd_resource type="Environment" load_steps=4 format=3]
|
||||
|
||||
[sub_resource type="ProceduralSkyMaterial" id="SkyMat_1"]
|
||||
sky_top_color = Color(0.38, 0.52, 0.68, 1)
|
||||
sky_horizon_color = Color(0.7, 0.75, 0.78, 1)
|
||||
ground_bottom_color = Color(0.2, 0.22, 0.2, 1)
|
||||
ground_horizon_color = Color(0.64, 0.68, 0.67, 1)
|
||||
sky_top_color = Color(0.25, 0.45, 0.72, 1)
|
||||
sky_horizon_color = Color(0.68, 0.76, 0.82, 1)
|
||||
ground_bottom_color = Color(0.18, 0.2, 0.18, 1)
|
||||
ground_horizon_color = Color(0.58, 0.62, 0.6, 1)
|
||||
sun_angle_max = 40.0
|
||||
|
||||
[sub_resource type="Sky" id="Sky_1"]
|
||||
sky_material = SubResource("SkyMat_1")
|
||||
@@ -13,16 +14,21 @@ sky_material = SubResource("SkyMat_1")
|
||||
background_mode = 2
|
||||
sky = SubResource("Sky_1")
|
||||
ambient_light_source = 3
|
||||
ambient_light_color = Color(0.6, 0.66, 0.72, 1)
|
||||
ambient_light_energy = 0.4
|
||||
ambient_light_color = Color(0.62, 0.68, 0.76, 1)
|
||||
ambient_light_energy = 0.6
|
||||
tonemap_mode = 3
|
||||
tonemap_white = 6.0
|
||||
tonemap_white = 5.0
|
||||
ssao_enabled = true
|
||||
ssao_radius = 2.0
|
||||
ssao_intensity = 1.0
|
||||
fog_enabled = true
|
||||
fog_light_color = Color(0.72, 0.78, 0.82, 1)
|
||||
fog_density = 0.012
|
||||
fog_sky_affect = 0.4
|
||||
volumetric_fog_enabled = true
|
||||
volumetric_fog_density = 0.02
|
||||
fog_mode = 0
|
||||
fog_light_color = Color(0.74, 0.8, 0.86, 1)
|
||||
fog_light_energy = 1.0
|
||||
fog_density = 0.004
|
||||
fog_sky_affect = 0.0
|
||||
fog_aerial_perspective = 0.2
|
||||
adjustment_enabled = true
|
||||
adjustment_saturation = 1.05
|
||||
adjustment_brightness = 1.05
|
||||
adjustment_contrast = 1.12
|
||||
adjustment_saturation = 1.25
|
||||
|
||||
@@ -18,10 +18,12 @@ script = ExtResource("0_world")
|
||||
environment = ExtResource("4_env")
|
||||
|
||||
[node name="Sun" type="DirectionalLight3D" parent="."]
|
||||
transform = Transform3D(0.86, -0.35, 0.37, 0, 0.72, 0.69, -0.51, -0.6, 0.62, 0, 40, 0)
|
||||
light_color = Color(1, 0.96, 0.86, 1)
|
||||
light_energy = 1.2
|
||||
transform = Transform3D(0.819, -0.401, 0.41, 0, 0.715, 0.699, -0.574, -0.573, 0.585, 0, 40, 0)
|
||||
light_color = Color(1, 0.95, 0.83, 1)
|
||||
light_energy = 1.7
|
||||
shadow_enabled = true
|
||||
directional_shadow_mode = 2
|
||||
directional_shadow_max_distance = 200.0
|
||||
|
||||
[node name="Terrain" type="Node3D" parent="."]
|
||||
script = ExtResource("1_terrain")
|
||||
|
||||
@@ -36,6 +36,17 @@ func _make_tree(pos: Vector3, rng: RandomNumberGenerator) -> void:
|
||||
trunk.material_override = _mat(Color(0.33, 0.24, 0.16))
|
||||
root.add_child(trunk)
|
||||
|
||||
# Collision: a capsule around the trunk so you can't walk through the tree.
|
||||
var body := StaticBody3D.new()
|
||||
root.add_child(body)
|
||||
var col := CollisionShape3D.new()
|
||||
var cap := CapsuleShape3D.new()
|
||||
cap.radius = 0.35
|
||||
cap.height = 4.0
|
||||
col.shape = cap
|
||||
col.position = Vector3(0, 2.0, 0)
|
||||
body.add_child(col)
|
||||
|
||||
# Low-poly conifer canopy: stacked cones.
|
||||
var h := 3.0
|
||||
for j in range(3):
|
||||
@@ -57,13 +68,25 @@ func _make_tree(pos: Vector3, rng: RandomNumberGenerator) -> void:
|
||||
func _make_rock(pos: Vector3, rng: RandomNumberGenerator) -> void:
|
||||
var rock := MeshInstance3D.new()
|
||||
var bm := BoxMesh.new()
|
||||
bm.size = Vector3(rng.randf_range(0.8, 1.8), rng.randf_range(0.6, 1.2), rng.randf_range(0.8, 1.8))
|
||||
var box_size := Vector3(rng.randf_range(0.8, 1.8), rng.randf_range(0.6, 1.2), rng.randf_range(0.8, 1.8))
|
||||
bm.size = box_size
|
||||
rock.mesh = bm
|
||||
rock.position = pos + Vector3(0, 0.3, 0)
|
||||
rock.rotation = Vector3(rng.randf_range(-0.2, 0.2), rng.randf_range(0, TAU), rng.randf_range(-0.2, 0.2))
|
||||
rock.material_override = _mat(Color(0.42, 0.42, 0.45))
|
||||
add_child(rock)
|
||||
|
||||
# Collision: a box matching the rock mesh.
|
||||
var body := StaticBody3D.new()
|
||||
body.position = rock.position
|
||||
body.rotation = rock.rotation
|
||||
add_child(body)
|
||||
var col := CollisionShape3D.new()
|
||||
var box := BoxShape3D.new()
|
||||
box.size = box_size
|
||||
col.shape = box
|
||||
body.add_child(col)
|
||||
|
||||
func _mat(c: Color) -> StandardMaterial3D:
|
||||
var m := StandardMaterial3D.new()
|
||||
m.albedo_color = c
|
||||
|
||||
@@ -57,8 +57,12 @@ func _build() -> void:
|
||||
var p01 := Vector3(x0, sample_height(x0, z1), z1)
|
||||
var p11 := Vector3(x1, sample_height(x1, z1), z1)
|
||||
|
||||
_add_tri(st, p00, p01, p11, half, uv_scale)
|
||||
_add_tri(st, p00, p11, p10, half, uv_scale)
|
||||
# Winding order chosen so generate_normals() produces UPWARD normals.
|
||||
# (The reverse winding gave downward normals, so the sun lit the
|
||||
# underside and the top surface rendered black — confirmed by an
|
||||
# unshaded render showing the true bright-green albedo.)
|
||||
_add_tri(st, p00, p11, p01, half, uv_scale)
|
||||
_add_tri(st, p00, p10, p11, half, uv_scale)
|
||||
|
||||
st.generate_normals()
|
||||
|
||||
@@ -67,7 +71,7 @@ func _build() -> void:
|
||||
mi.name = "TerrainMesh"
|
||||
mi.mesh = mesh
|
||||
var mat := StandardMaterial3D.new()
|
||||
mat.albedo_color = Color(0.33, 0.45, 0.22) # mossy green
|
||||
mat.albedo_color = Color(0.36, 0.47, 0.26) # mossy green (lit, not fluorescent)
|
||||
mat.roughness = 0.95
|
||||
mi.material_override = mat
|
||||
add_child(mi)
|
||||
|
||||
Reference in New Issue
Block a user