Files
godot-demo-projects/2d/lights_and_shadows/light_shadows.tscn

405 lines
12 KiB
Plaintext

[gd_scene load_steps=25 format=3 uid="uid://dha5rly2wayoo"]
[ext_resource type="Texture2D" uid="uid://cuhgt2axv0f3f" path="res://background.png" id="1"]
[ext_resource type="Script" uid="uid://wphiu4cg3awx" path="res://light_shadows.gd" id="1_7xjm7"]
[ext_resource type="Texture2D" uid="uid://cwagv0l63lpcy" path="res://caster.png" id="2"]
[ext_resource type="Texture2D" uid="uid://blumicor5e84b" path="res://light.png" id="3"]
[ext_resource type="Texture2D" uid="uid://fwpfm3ehnr82" path="res://spot.png" id="4"]
[ext_resource type="Texture2D" uid="uid://cmxry7hjb0spl" path="res://godot.png" id="5"]
[ext_resource type="Texture2D" uid="uid://dvynjoy8jxmon" path="res://godot_normal.png" id="6"]
[sub_resource type="CanvasTexture" id="CanvasTexture_hlulo"]
diffuse_texture = ExtResource("5")
normal_texture = ExtResource("6")
specular_shininess = 0.5
[sub_resource type="CanvasTexture" id="CanvasTexture_hea5a"]
diffuse_texture = ExtResource("5")
normal_texture = ExtResource("6")
specular_shininess = 0.5
[sub_resource type="CanvasTexture" id="CanvasTexture_hc1ic"]
diffuse_texture = ExtResource("5")
normal_texture = ExtResource("6")
specular_shininess = 0.5
[sub_resource type="CanvasTexture" id="CanvasTexture_l1r6i"]
diffuse_texture = ExtResource("5")
normal_texture = ExtResource("6")
specular_shininess = 0.5
[sub_resource type="OccluderPolygon2D" id="1"]
polygon = PackedVector2Array(-15.913, -15.9738, 15.9079, -16.0785, 15.6986, 15.847, -16.1223, 15.9517)
[sub_resource type="CanvasItemMaterial" id="2"]
blend_mode = 1
[sub_resource type="Animation" id="3"]
length = 16.0
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 4, 8, 12),
"transitions": PackedFloat32Array(-2, -2, -2, -2),
"update": 0,
"values": [Vector2(159.289, 452.441), Vector2(132.279, 80.4366), Vector2(700.722, 241.27), Vector2(429.392, 571.532)]
}
[sub_resource type="Animation" id="4"]
length = 16.0
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 4.1, 8.1, 11.8),
"transitions": PackedFloat32Array(-2, -2, -2, -2),
"update": 0,
"values": [Vector2(753.756, 314.336), Vector2(69.7562, 234.336), Vector2(256.756, 575.336), Vector2(516.756, 530.336)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_wawvy"]
_data = {
&"motion": SubResource("3"),
&"motion2": SubResource("4")
}
[sub_resource type="CanvasItemMaterial" id="5"]
blend_mode = 1
[sub_resource type="AnimationLibrary" id="AnimationLibrary_fig6v"]
_data = {
&"m2": SubResource("4"),
&"motion": SubResource("3")
}
[sub_resource type="CanvasItemMaterial" id="6"]
blend_mode = 1
[sub_resource type="Animation" id="7"]
length = 16.0
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 4.1, 7.9, 12.1),
"transitions": PackedFloat32Array(-2, -2, -2, -2),
"update": 0,
"values": [Vector2(692.078, 29.8849), Vector2(309.606, 31.5551), Vector2(40.7064, 238.658), Vector2(685.397, 282.082)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_kfxj1"]
_data = {
&"motion": SubResource("3"),
&"motion2": SubResource("4"),
&"motion3": SubResource("7")
}
[sub_resource type="Animation" id="Animation_emv7u"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("DirectionalLight2D:rotation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.0]
}
[sub_resource type="Animation" id="Animation_rgbru"]
resource_name = "rotate_directional_light"
length = 20.0
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("DirectionalLight2D:rotation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 20),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [0.0, 6.28319]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_6bket"]
_data = {
&"RESET": SubResource("Animation_emv7u"),
&"rotate_directional_light": SubResource("Animation_rgbru")
}
[node name="LightShadows" type="Node2D"]
script = ExtResource("1_7xjm7")
[node name="Ambient" type="CanvasModulate" parent="."]
color = Color(0.27451, 0.27451, 0.27451, 1)
[node name="Background" type="Sprite2D" parent="."]
position = Vector2(401.251, 302.906)
scale = Vector2(128, 128)
texture = ExtResource("1")
[node name="Sprite2D" type="Sprite2D" parent="."]
position = Vector2(295.886, 216.938)
texture = SubResource("CanvasTexture_hlulo")
[node name="Label" type="Label" parent="Sprite2D"]
offset_left = -22.5563
offset_top = 64.6982
offset_right = 24.4437
offset_bottom = 78.6982
text = "Normal"
[node name="SpriteFlipX" type="Sprite2D" parent="."]
position = Vector2(543.341, 220.255)
scale = Vector2(-1, 1)
texture = SubResource("CanvasTexture_hea5a")
[node name="Label" type="Label" parent="SpriteFlipX"]
offset_left = 22.5564
offset_top = 66.0347
offset_right = 69.5564
offset_bottom = 80.0347
scale = Vector2(-1, 1)
text = "Flip X"
[node name="SpriteFlipY" type="Sprite2D" parent="."]
position = Vector2(291.308, 423.369)
scale = Vector2(1, -1)
texture = SubResource("CanvasTexture_hc1ic")
[node name="Label" type="Label" parent="SpriteFlipY"]
offset_left = -23.3056
offset_top = -67.2446
offset_right = 23.6944
offset_bottom = -53.2446
scale = Vector2(1, -1)
text = "Flip Y"
[node name="SpriteFlipXY" type="Sprite2D" parent="."]
position = Vector2(542.081, 424.696)
scale = Vector2(-1, -1)
texture = SubResource("CanvasTexture_l1r6i")
[node name="Label" type="Label" parent="SpriteFlipXY"]
offset_left = 23.9495
offset_top = -67.5714
offset_right = 81.9495
offset_bottom = -53.5714
scale = Vector2(-1, -1)
text = "Flip X + Y"
[node name="Casters" type="Node2D" parent="."]
[node name="ShadowCaster" type="Sprite2D" parent="Casters"]
position = Vector2(95.2909, 85.3186)
texture = ExtResource("2")
[node name="Occluder" type="LightOccluder2D" parent="Casters/ShadowCaster"]
occluder = SubResource("1")
[node name="ShadowCaster1" type="Sprite2D" parent="Casters"]
position = Vector2(200.291, 313.319)
texture = ExtResource("2")
[node name="Occluder" type="LightOccluder2D" parent="Casters/ShadowCaster1"]
occluder = SubResource("1")
[node name="ShadowCaster2" type="Sprite2D" parent="Casters"]
position = Vector2(76.2909, 405.319)
texture = ExtResource("2")
[node name="Occluder" type="LightOccluder2D" parent="Casters/ShadowCaster2"]
occluder = SubResource("1")
[node name="ShadowCaster3" type="Sprite2D" parent="Casters"]
position = Vector2(408.291, 226.319)
texture = ExtResource("2")
[node name="Occluder" type="LightOccluder2D" parent="Casters/ShadowCaster3"]
occluder = SubResource("1")
[node name="ShadowCaster4" type="Sprite2D" parent="Casters"]
position = Vector2(239.291, 48.3186)
texture = ExtResource("2")
[node name="Occluder" type="LightOccluder2D" parent="Casters/ShadowCaster4"]
occluder = SubResource("1")
[node name="ShadowCaster5" type="Sprite2D" parent="Casters"]
position = Vector2(140.291, 561.319)
texture = ExtResource("2")
[node name="Occluder" type="LightOccluder2D" parent="Casters/ShadowCaster5"]
occluder = SubResource("1")
[node name="ShadowCaster6" type="Sprite2D" parent="Casters"]
position = Vector2(392.291, 499.319)
texture = ExtResource("2")
[node name="Occluder" type="LightOccluder2D" parent="Casters/ShadowCaster6"]
occluder = SubResource("1")
[node name="ShadowCaster7" type="Sprite2D" parent="Casters"]
position = Vector2(735.291, 552.319)
texture = ExtResource("2")
[node name="Occluder" type="LightOccluder2D" parent="Casters/ShadowCaster7"]
occluder = SubResource("1")
[node name="ShadowCaster8" type="Sprite2D" parent="Casters"]
position = Vector2(661.291, 371.319)
texture = ExtResource("2")
[node name="Occluder" type="LightOccluder2D" parent="Casters/ShadowCaster8"]
occluder = SubResource("1")
[node name="ShadowCaster9" type="Sprite2D" parent="Casters"]
position = Vector2(567.291, 574.319)
texture = ExtResource("2")
[node name="occluder" type="LightOccluder2D" parent="Casters/ShadowCaster9"]
occluder = SubResource("1")
[node name="ShadowCaster10" type="Sprite2D" parent="Casters"]
position = Vector2(420.291, 350.319)
texture = ExtResource("2")
[node name="Occluder" type="LightOccluder2D" parent="Casters/ShadowCaster10"]
occluder = SubResource("1")
[node name="ShadowCaster11" type="Sprite2D" parent="Casters"]
position = Vector2(463.291, 106.319)
texture = ExtResource("2")
[node name="Occluder" type="LightOccluder2D" parent="Casters/ShadowCaster11"]
occluder = SubResource("1")
[node name="ShadowCaster12" type="Sprite2D" parent="Casters"]
position = Vector2(621.291, 78.3186)
texture = ExtResource("2")
[node name="Occluder" type="LightOccluder2D" parent="Casters/ShadowCaster12"]
occluder = SubResource("1")
[node name="ShadowCaster13" type="Sprite2D" parent="Casters"]
position = Vector2(761.291, 240.319)
texture = ExtResource("2")
[node name="Occluder" type="LightOccluder2D" parent="Casters/ShadowCaster13"]
occluder = SubResource("1")
[node name="ShadowCaster14" type="Sprite2D" parent="Casters"]
position = Vector2(771.291, 29.3186)
texture = ExtResource("2")
[node name="Occluder" type="LightOccluder2D" parent="Casters/ShadowCaster14"]
occluder = SubResource("1")
[node name="RedLight" type="PointLight2D" parent="." groups=["point_light"]]
position = Vector2(159.289, 452.441)
color = Color(1, 0.446392, 0.0576646, 1)
shadow_enabled = true
shadow_filter = 1
shadow_filter_smooth = 1.2
texture = ExtResource("3")
metadata/_edit_group_ = true
[node name="Blob" type="Sprite2D" parent="RedLight"]
material = SubResource("2")
texture = ExtResource("4")
[node name="AnimationPlayer" type="AnimationPlayer" parent="RedLight"]
libraries = {
&"": SubResource("AnimationLibrary_wawvy")
}
autoplay = "motion"
[node name="GreenLight" type="PointLight2D" parent="." groups=["point_light"]]
position = Vector2(753.756, 314.336)
color = Color(0.49247, 0.878537, 0.409146, 1)
shadow_enabled = true
shadow_filter = 1
shadow_filter_smooth = 1.2
texture = ExtResource("3")
metadata/_edit_group_ = true
[node name="Blob" type="Sprite2D" parent="GreenLight"]
material = SubResource("5")
texture = ExtResource("4")
[node name="AnimationPlayer" type="AnimationPlayer" parent="GreenLight"]
libraries = {
&"": SubResource("AnimationLibrary_fig6v")
}
autoplay = "m2"
[node name="BlueLight" type="PointLight2D" parent="." groups=["point_light"]]
position = Vector2(692.078, 29.8849)
color = Color(0.396752, 0.446392, 0.929792, 1)
shadow_enabled = true
shadow_filter = 1
shadow_filter_smooth = 1.2
texture = ExtResource("3")
metadata/_edit_group_ = true
[node name="Blob" type="Sprite2D" parent="BlueLight"]
material = SubResource("6")
texture = ExtResource("4")
[node name="AnimationPlayer" type="AnimationPlayer" parent="BlueLight"]
libraries = {
&"": SubResource("AnimationLibrary_kfxj1")
}
autoplay = "motion3"
[node name="Camera2D" type="Camera2D" parent="."]
offset = Vector2(400, 300)
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="Label" type="Label" parent="CanvasLayer"]
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_left = 16.0
offset_top = -120.0
offset_right = 321.0
offset_bottom = -1.0
grow_vertical = 0
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
theme_override_constants/outline_size = 4
text = "D: Toggle directional light
P: Toggle point lights
S: Cycle directional light shadow quality
H: Cycle point light shadow quality"
[node name="DirectionalLight2D" type="DirectionalLight2D" parent="."]
visible = false
shadow_enabled = true
shadow_filter = 1
shadow_filter_smooth = 1.2
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
&"": SubResource("AnimationLibrary_6bket")
}
autoplay = "rotate_directional_light"