From 6a2c279e2e1abc8e3e6cd0c165322ae300349f4f Mon Sep 17 00:00:00 2001 From: dpDeadlyPuzzles <1976985776@qq.com> Date: Fri, 23 Aug 2024 21:00:35 +0800 Subject: [PATCH] feat: glow terraBladeBeam --- project.godot | 1 + scenes/bullets/terra_blade/TerraBladeBeam.gdshader | 12 ++++++++++++ scenes/bullets/terra_blade/TerraBladeBeam.tscn | 14 +++++++++++++- 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 scenes/bullets/terra_blade/TerraBladeBeam.gdshader diff --git a/project.godot b/project.godot index f4383aa..4db68c7 100644 --- a/project.godot +++ b/project.godot @@ -69,3 +69,4 @@ locale/translations_pot_files=PackedStringArray("res://scenes/multi_game.tscn") [rendering] textures/canvas_textures/default_texture_filter=0 +viewport/hdr_2d=true diff --git a/scenes/bullets/terra_blade/TerraBladeBeam.gdshader b/scenes/bullets/terra_blade/TerraBladeBeam.gdshader new file mode 100644 index 0000000..ec15921 --- /dev/null +++ b/scenes/bullets/terra_blade/TerraBladeBeam.gdshader @@ -0,0 +1,12 @@ +shader_type canvas_item; + +void fragment() { + vec4 original_color = texture(TEXTURE, UV); + vec4 color = original_color + original_color + original_color; + COLOR = mix(color, original_color, 1.0 - original_color.a); +} + +//void light() { + // Called for every pixel for every light affecting the CanvasItem. + // Uncomment to replace the default light processing function with this one. +//} diff --git a/scenes/bullets/terra_blade/TerraBladeBeam.tscn b/scenes/bullets/terra_blade/TerraBladeBeam.tscn index 81b9d4c..fb6180d 100644 --- a/scenes/bullets/terra_blade/TerraBladeBeam.tscn +++ b/scenes/bullets/terra_blade/TerraBladeBeam.tscn @@ -1,18 +1,27 @@ -[gd_scene load_steps=4 format=3 uid="uid://1megnlcsse45"] +[gd_scene load_steps=7 format=3 uid="uid://1megnlcsse45"] [ext_resource type="Script" path="res://scenes/bullets/terra_blade/terra_blade_beam.gd" id="1_va6li"] +[ext_resource type="Shader" path="res://scenes/bullets/terra_blade/TerraBladeBeam.gdshader" id="2_aqn2b"] [ext_resource type="Texture2D" uid="uid://co2n6okllm0tl" path="res://scenes/bullets/terra_blade/terra_blade_beam.png" id="2_n1wh2"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_awmjb"] +shader = ExtResource("2_aqn2b") + [sub_resource type="CapsuleShape2D" id="CapsuleShape2D_1ieue"] radius = 8.48517 height = 86.9787 +[sub_resource type="Environment" id="Environment_jcpgb"] +background_mode = 3 +glow_enabled = true + [node name="TerraBladeBeam" type="Area2D"] position = Vector2(600, 384) script = ExtResource("1_va6li") metadata/_edit_group_ = true [node name="Sprite2D" type="Sprite2D" parent="."] +material = SubResource("ShaderMaterial_awmjb") rotation = 0.785398 scale = Vector2(1.5, 1.5) texture = ExtResource("2_n1wh2") @@ -23,4 +32,7 @@ shape = SubResource("CapsuleShape2D_1ieue") [node name="OutScreen" type="VisibleOnScreenNotifier2D" parent="."] +[node name="WorldEnvironment" type="WorldEnvironment" parent="."] +environment = SubResource("Environment_jcpgb") + [connection signal="screen_exited" from="OutScreen" to="." method="_on_out_screen_screen_exited"]