Implements tree visibility occlusion system.

Adds tree fading based on camera line of sight.
Trees now fade out when they obstruct the player's view,
improving visibility.

Also includes several fixes:
- Fixes tree distribution.
- Adds a see-through shader.
- Adds camera and occlusion scripts.
This commit is contained in:
Dan Baker 2025-07-01 10:32:21 +01:00
parent a1efaf6294
commit f98773237e
10 changed files with 314 additions and 137 deletions

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=4 format=3 uid="uid://c27fogucecn0r"]
[gd_scene load_steps=5 format=3 uid="uid://c27fogucecn0r"]
[ext_resource type="Script" uid="uid://lcedx3lau6v5" path="res://Entities/Tree/scripts/tree.gd" id="1_702jv"]
@ -8,6 +8,9 @@ height = 0.5
[sub_resource type="SphereShape3D" id="SphereShape3D_702jv"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_702jv"]
radius = 0.6
[node name="Tree" type="Node3D"]
script = ExtResource("1_702jv")
@ -20,3 +23,15 @@ shape = SubResource("CapsuleShape3D_s6kdm")
[node name="CollisionShape3D" type="CollisionShape3D" parent="InteractRange"]
shape = SubResource("SphereShape3D_702jv")
[node name="VisibilityArea" type="StaticBody3D" parent="." groups=["tree_visibility"]]
collision_layer = 2
collision_mask = 2
[node name="VisibilityShape" type="CollisionShape3D" parent="VisibilityArea"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.616604, 0)
shape = SubResource("CapsuleShape3D_702jv")
debug_color = Color(0.837648, 0.364145, 0.346694, 0.42)
[node name="LastBlocked" type="Timer" parent="."]
wait_time = 0.5