└── addons └── nojoule-energy-shield ├── VERSION ├── shield.gd.uid ├── shield.gdshader.uid ├── camera_movement.gd.uid ├── shield_back.gdshader.uid ├── shield_front.gdshader.uid ├── shield_web.gdshader.uid ├── shield_base.gdshaderinc.uid ├── shield_web_back.gdshader.uid ├── shield_web_front.gdshader.uid ├── impact_animation_curve.tres ├── shield_noise.tres ├── LICENSE ├── camera_movement.gd ├── shield_sphere.tscn ├── shield_plane.tscn ├── shield.gdshader ├── shield_web.gdshader ├── shield_back.gdshader ├── shield_front.gdshader ├── shield_web_back.gdshader ├── shield_web_front.gdshader ├── shield.gd ├── shield_base.gdshaderinc └── examples.tscn /addons/nojoule-energy-shield/VERSION: -------------------------------------------------------------------------------- 1 | 1.1.1 2 | -------------------------------------------------------------------------------- /addons/nojoule-energy-shield/shield.gd.uid: -------------------------------------------------------------------------------- 1 | uid://sgldwin4tbiv 2 | -------------------------------------------------------------------------------- /addons/nojoule-energy-shield/shield.gdshader.uid: -------------------------------------------------------------------------------- 1 | uid://dcko35tc4k343 2 | -------------------------------------------------------------------------------- /addons/nojoule-energy-shield/camera_movement.gd.uid: -------------------------------------------------------------------------------- 1 | uid://f1263sbcv8qy 2 | -------------------------------------------------------------------------------- /addons/nojoule-energy-shield/shield_back.gdshader.uid: -------------------------------------------------------------------------------- 1 | uid://bgf6enxiv2ir0 2 | -------------------------------------------------------------------------------- /addons/nojoule-energy-shield/shield_front.gdshader.uid: -------------------------------------------------------------------------------- 1 | uid://brs82ix6l3q06 2 | -------------------------------------------------------------------------------- /addons/nojoule-energy-shield/shield_web.gdshader.uid: -------------------------------------------------------------------------------- 1 | uid://cd8n5yppd80pp 2 | -------------------------------------------------------------------------------- /addons/nojoule-energy-shield/shield_base.gdshaderinc.uid: -------------------------------------------------------------------------------- 1 | uid://c7xhv551mknyv 2 | -------------------------------------------------------------------------------- /addons/nojoule-energy-shield/shield_web_back.gdshader.uid: -------------------------------------------------------------------------------- 1 | uid://b4anw0m4t5heo 2 | -------------------------------------------------------------------------------- /addons/nojoule-energy-shield/shield_web_front.gdshader.uid: -------------------------------------------------------------------------------- 1 | uid://bhly7fr14n7u2 2 | -------------------------------------------------------------------------------- /addons/nojoule-energy-shield/impact_animation_curve.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Curve" format=3 uid="uid://cv0k0umipiy7n"] 2 | 3 | [resource] 4 | resource_local_to_scene = true 5 | resource_name = "animation_curve" 6 | _data = [Vector2(0, 0), 0.0, 2.60088, 0, 0, Vector2(0.996183, 1), 0.0, 0.0, 0, 0] 7 | point_count = 2 8 | -------------------------------------------------------------------------------- /addons/nojoule-energy-shield/shield_noise.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="NoiseTexture2D" load_steps=2 format=3 uid="uid://dnqegf8mxqli"] 2 | 3 | [sub_resource type="FastNoiseLite" id="FastNoiseLite_g4f1n"] 4 | noise_type = 3 5 | seed = 475 6 | frequency = 0.0175 7 | fractal_type = 3 8 | fractal_gain = 0.0 9 | fractal_ping_pong_strength = 1.0 10 | cellular_distance_function = 1 11 | cellular_jitter = 0.0 12 | cellular_return_type = 4 13 | 14 | [resource] 15 | noise = SubResource("FastNoiseLite_g4f1n") 16 | seamless = true 17 | -------------------------------------------------------------------------------- /addons/nojoule-energy-shield/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Julian Rogawski 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /addons/nojoule-energy-shield/camera_movement.gd: -------------------------------------------------------------------------------- 1 | extends Camera3D 2 | 3 | var mouse_sensitivity: float = 0.003 4 | var move_speed: float = 3.0 5 | var rotation_x: float = 0.0 6 | var rotation_y: float = 0.0 7 | var mouse_captured: bool = false 8 | var sticky_move_count: float = 0.0 9 | 10 | 11 | func _ready(): 12 | Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) 13 | 14 | 15 | func _process(delta: float): 16 | toggle_mouse_capture() 17 | if mouse_captured: 18 | handle_mouse_input(delta) 19 | handle_movement(delta) 20 | 21 | 22 | func toggle_mouse_capture(): 23 | if Input.is_action_just_pressed("toggle_mouse_capture"): 24 | mouse_captured = not mouse_captured 25 | if mouse_captured: 26 | Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) 27 | else: 28 | Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) 29 | 30 | 31 | func handle_mouse_input(_delta: float): 32 | var mouse_motion = Input.get_last_mouse_velocity() 33 | rotation_x -= mouse_motion.y * mouse_sensitivity 34 | rotation_y -= mouse_motion.x * mouse_sensitivity 35 | rotation_x = clamp(rotation_x, -89, 89) 36 | rotation_degrees = Vector3(rotation_x, rotation_y, 0) 37 | 38 | 39 | func handle_movement(delta: float): 40 | var direction = Vector3() 41 | 42 | if Input.is_action_pressed("ui_up"): 43 | direction -= transform.basis.z 44 | if Input.is_action_pressed("ui_down"): 45 | direction += transform.basis.z 46 | if Input.is_action_pressed("ui_left"): 47 | direction -= transform.basis.x 48 | if Input.is_action_pressed("ui_right"): 49 | direction += transform.basis.x 50 | 51 | if direction != Vector3.ZERO: 52 | direction = direction.normalized() 53 | 54 | position += direction * move_speed * delta 55 | 56 | # var position_mod = int(position.x) % 5 57 | # var moved_position_mod = int(position.x + direction.x * move_speed * delta) % 5 58 | 59 | # if moved_position_mod < position_mod: 60 | # sticky_move_count += delta 61 | # if sticky_move_count > 0.5: 62 | # position += direction * move_speed * delta 63 | # sticky_move_count = 0 64 | # else: 65 | # position += direction * move_speed * delta 66 | -------------------------------------------------------------------------------- /addons/nojoule-energy-shield/shield_sphere.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=8 format=3 uid="uid://bqo3es5yd4r70"] 2 | 3 | [ext_resource type="Shader" uid="uid://dcko35tc4k343" path="res://addons/nojoule-energy-shield/shield.gdshader" id="1_181ey"] 4 | [ext_resource type="Script" uid="uid://sgldwin4tbiv" path="res://addons/nojoule-energy-shield/shield.gd" id="1_k7nhx"] 5 | [ext_resource type="Texture2D" uid="uid://dnqegf8mxqli" path="res://addons/nojoule-energy-shield/shield_noise.tres" id="2_g0rh4"] 6 | [ext_resource type="Curve" uid="uid://cv0k0umipiy7n" path="res://addons/nojoule-energy-shield/impact_animation_curve.tres" id="2_utjra"] 7 | 8 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_3q470"] 9 | render_priority = 0 10 | shader = ExtResource("1_181ey") 11 | shader_parameter/_quantization = true 12 | shader_parameter/_steps_quantization = 5 13 | shader_parameter/_object_scale = 1.0 14 | shader_parameter/_object_size = 1.0 15 | shader_parameter/_only_on_wave_visibility = false 16 | shader_parameter/_start_falloff_visibility = 0.5 17 | shader_parameter/_end_falloff_visibility = 0.3 18 | shader_parameter/_time_multiplier_activation = 1.0 19 | shader_parameter/_distance_multiplier_activation = 1.0 20 | shader_parameter/_width_time_activation = 1.0 21 | shader_parameter/_enable_highlight_intersection = true 22 | shader_parameter/_width_highlight_intersection = 1.0 23 | shader_parameter/_noise_texture = ExtResource("2_g0rh4") 24 | shader_parameter/_speed_noise = Vector2(0.02, 0.02) 25 | shader_parameter/_origin_generate = Vector3(0, 0.5, 0) 26 | shader_parameter/_relative_origin_generate = true 27 | shader_parameter/_time_generate = 1.0 28 | shader_parameter/_thickness_generate = 0.25 29 | shader_parameter/_collapse = false 30 | shader_parameter/_color_shield = Color(0.26, 0.975, 1, 1) 31 | shader_parameter/_color_brightness_shield = 15.0 32 | shader_parameter/_intensity_shield = 3.0 33 | shader_parameter/glow_enabled = true 34 | shader_parameter/glow_strength = 0.1 35 | shader_parameter/_active_static = true 36 | shader_parameter/_origin_static = Vector3(0, 0.5, 0) 37 | shader_parameter/_speed_static = 0.1 38 | shader_parameter/_frequency_static = 80.0 39 | shader_parameter/_amplitude_static = 0.002 40 | shader_parameter/_normal_amplitude_static = 0.002 41 | shader_parameter/_effect_radius_static = 1.2 42 | shader_parameter/_active_static_offset_hl = true 43 | shader_parameter/_strength_static_offset_hl = 1.0 44 | shader_parameter/_intensity_static_offset_hl = 5.0 45 | shader_parameter/_origin_impact = PackedVector3Array(0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) 46 | shader_parameter/_time_impact = PackedFloat32Array(0, 0, 0, 0, 0) 47 | shader_parameter/_frequency_impact = 20.0 48 | shader_parameter/_waves_impact = 0.0 49 | shader_parameter/_fade_waves_impact = 2.0 50 | shader_parameter/_amplitude_impact = 0.02 51 | shader_parameter/_normal_amplitude_impact = 0.05 52 | shader_parameter/_radius_impact = 1.0 53 | shader_parameter/_active_impact_offset_hl = true 54 | shader_parameter/_strength_impact_offset_hl = 1.0 55 | shader_parameter/_intensity_impact_offset_hl = 5.0 56 | shader_parameter/_active_border = false 57 | shader_parameter/_intensity_border = 2.0 58 | shader_parameter/_percentage_border = 0.1 59 | shader_parameter/_show_normals = false 60 | 61 | [sub_resource type="SphereMesh" id="SphereMesh_wowso"] 62 | resource_local_to_scene = true 63 | material = SubResource("ShaderMaterial_3q470") 64 | radial_segments = 256 65 | rings = 256 66 | 67 | [sub_resource type="SphereShape3D" id="SphereShape3D_1ncxy"] 68 | 69 | [node name="ShieldSphere" type="MeshInstance3D"] 70 | mesh = SubResource("SphereMesh_wowso") 71 | script = ExtResource("1_k7nhx") 72 | animation_curve = ExtResource("2_utjra") 73 | split_front_back = true 74 | 75 | [node name="Area3D" type="Area3D" parent="."] 76 | 77 | [node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D"] 78 | shape = SubResource("SphereShape3D_1ncxy") 79 | -------------------------------------------------------------------------------- /addons/nojoule-energy-shield/shield_plane.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=8 format=3 uid="uid://bvqb5fugcfm5k"] 2 | 3 | [ext_resource type="Script" uid="uid://sgldwin4tbiv" path="res://addons/nojoule-energy-shield/shield.gd" id="1_sja5q"] 4 | [ext_resource type="Shader" uid="uid://dcko35tc4k343" path="res://addons/nojoule-energy-shield/shield.gdshader" id="1_uxet6"] 5 | [ext_resource type="Texture2D" uid="uid://dnqegf8mxqli" path="res://addons/nojoule-energy-shield/shield_noise.tres" id="2_0o82n"] 6 | [ext_resource type="Curve" uid="uid://cv0k0umipiy7n" path="res://addons/nojoule-energy-shield/impact_animation_curve.tres" id="2_6wogk"] 7 | 8 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_6mbxq"] 9 | render_priority = 0 10 | shader = ExtResource("1_uxet6") 11 | shader_parameter/_quantization = true 12 | shader_parameter/_steps_quantization = 5 13 | shader_parameter/_object_scale = 1.0 14 | shader_parameter/_object_size = 1.4 15 | shader_parameter/_only_on_wave_visibility = false 16 | shader_parameter/_start_falloff_visibility = 0.5 17 | shader_parameter/_end_falloff_visibility = 0.3 18 | shader_parameter/_time_multiplier_activation = 1.0 19 | shader_parameter/_distance_multiplier_activation = 1.0 20 | shader_parameter/_width_time_activation = 1.0 21 | shader_parameter/_enable_highlight_intersection = true 22 | shader_parameter/_width_highlight_intersection = 1.0 23 | shader_parameter/_noise_texture = ExtResource("2_0o82n") 24 | shader_parameter/_speed_noise = Vector2(0.02, 0.02) 25 | shader_parameter/_origin_generate = Vector3(0, 0.5, 0) 26 | shader_parameter/_relative_origin_generate = true 27 | shader_parameter/_time_generate = 1.0 28 | shader_parameter/_thickness_generate = 0.25 29 | shader_parameter/_collapse = false 30 | shader_parameter/_color_shield = Color(0.26, 0.975, 1, 1) 31 | shader_parameter/_color_brightness_shield = 15.0 32 | shader_parameter/_intensity_shield = 3.0 33 | shader_parameter/glow_enabled = true 34 | shader_parameter/glow_strength = 10.0 35 | shader_parameter/_active_static = false 36 | shader_parameter/_origin_static = Vector3(0, 0, 0) 37 | shader_parameter/_speed_static = 0.1 38 | shader_parameter/_frequency_static = 80.0 39 | shader_parameter/_amplitude_static = 0.002 40 | shader_parameter/_normal_amplitude_static = 0.002 41 | shader_parameter/_effect_radius_static = 1.2 42 | shader_parameter/_active_static_offset_hl = true 43 | shader_parameter/_strength_static_offset_hl = 1.0 44 | shader_parameter/_intensity_static_offset_hl = 5.0 45 | shader_parameter/_relative_origin_static = true 46 | shader_parameter/_origin_impact = PackedVector3Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) 47 | shader_parameter/_time_impact = PackedFloat32Array(0, 0, 0, 0, 0) 48 | shader_parameter/_frequency_impact = 20.0 49 | shader_parameter/_waves_impact = 0.0 50 | shader_parameter/_fade_waves_impact = 2.0 51 | shader_parameter/_amplitude_impact = 0.02 52 | shader_parameter/_normal_amplitude_impact = 0.05 53 | shader_parameter/_radius_impact = 1.0 54 | shader_parameter/_active_impact_offset_hl = true 55 | shader_parameter/_strength_impact_offset_hl = 1.0 56 | shader_parameter/_intensity_impact_offset_hl = 5.0 57 | shader_parameter/_relative_origin_impact = false 58 | shader_parameter/_active_border = true 59 | shader_parameter/_intensity_border = 2.0 60 | shader_parameter/_percentage_border = 0.1 61 | shader_parameter/_show_normals = false 62 | 63 | [sub_resource type="PlaneMesh" id="PlaneMesh_7myad"] 64 | resource_local_to_scene = true 65 | material = SubResource("ShaderMaterial_6mbxq") 66 | size = Vector2(1, 1) 67 | subdivide_width = 128 68 | subdivide_depth = 128 69 | 70 | [sub_resource type="BoxShape3D" id="BoxShape3D_4004b"] 71 | size = Vector3(1, 0.05, 1) 72 | 73 | [node name="ShieldPlane" type="MeshInstance3D"] 74 | mesh = SubResource("PlaneMesh_7myad") 75 | script = ExtResource("1_sja5q") 76 | animation_curve = ExtResource("2_6wogk") 77 | 78 | [node name="Area3D" type="Area3D" parent="."] 79 | 80 | [node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D"] 81 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.025, 0) 82 | shape = SubResource("BoxShape3D_4004b") 83 | -------------------------------------------------------------------------------- /addons/nojoule-energy-shield/shield.gdshader: -------------------------------------------------------------------------------- 1 | shader_type spatial; 2 | 3 | uniform sampler2D depth_texture : hint_depth_texture; 4 | 5 | group_uniforms General; 6 | /** Use quantization for alpha and color values to get a more pixelated look. */ 7 | uniform bool _quantization = true; 8 | /** Quantization steps for the alpha and color values. */ 9 | uniform int _steps_quantization : hint_range(1, 20, 1) = 5; 10 | 11 | 12 | /** The scale of the object, used to adjust the impact radius and frequency, to match the scaling of objects. Using the shield.gd script, the scale is set to the x-axis scale of the global transform automatically. */ 13 | uniform float _object_scale = 1.0; 14 | /** Expected to be the maximum diameter of an object. If this is shorter the generation or collapse of the shield might not complete and stop early. */ 15 | uniform float _object_size = 1.0; 16 | 17 | group_uniforms Visibility; 18 | /** Turning this on makes the shield invisible by default and only visible on impacts. */ 19 | uniform bool _only_on_wave_visibility = false; 20 | /** A lower value makes the shield be invisible faster after the impact. */ 21 | uniform float _start_falloff_visibility : hint_range(0, 1, 0.05) = 0.5; 22 | /** A higher value makes the shield fading out process end sooner. */ 23 | uniform float _end_falloff_visibility : hint_range(0, 1, 0.05) = 0.3; 24 | /** Modifies how fast the shield visibility progresses through the object, based on the distance to the impact origin. */ 25 | uniform float _time_multiplier_activation = 2.0; 26 | /** Modifies the activation effect fading out over distance. */ 27 | uniform float _distance_multiplier_activation = 1.0; 28 | /** The the width of the fading IN effect on impact makes the activation begin more smoothly. */ 29 | uniform float _width_time_activation = 0.2; 30 | 31 | group_uniforms Intersection; 32 | /** Enable/Disable the effect of highlighting the intersection of the shield with other objects. */ 33 | uniform bool _enable_highlight_intersection = true; 34 | /** The width of the intersection highlight effect. */ 35 | uniform float _width_highlight_intersection = 1.0; 36 | 37 | 38 | group_uniforms Noise; 39 | /** The noise texture used to add some dynamic to the shield color, which affects the color and alpha values of the shield. Should be seamless, to avoid visible seams. */ 40 | uniform sampler2D _noise_texture; 41 | /** Defines the rate at which the noise texture is displaced in the x and y direction. */ 42 | uniform vec2 _speed_noise = vec2(0.02, 0.02); 43 | 44 | group_uniforms Generate_Collapse_Animation; 45 | /** The origin of the shield generation, where the shield will start to generate from. By default, it is expected to be in local space. */ 46 | uniform vec3 _origin_generate = vec3(0.0, 0.5, 0.0); 47 | /** The time of the generation or collapse animation, normalized between 0 and 1. */ 48 | uniform float _time_generate = 1.0; 49 | /** The border thickness of the generated shield highlighting the just generated shield surface. */ 50 | uniform float _thickness_generate = 0.25; 51 | /** By default this animation generates the shield, but if set to true, it will collapse the shield instead. */ 52 | uniform bool _collapse = false; 53 | 54 | group_uniforms Shield_Color; 55 | /** The base color of the shield, which is modifeid by the brightness and intensity. and varies across the shield surface. */ 56 | uniform vec3 _color_shield : source_color = vec3(0.26, 0.975, 1); 57 | /** The brightness of the shield color, which is multiplied with the shield visibility. */ 58 | uniform float _color_brightness_shield : hint_range(0.1, 100.0, 0.05) = 15.0; 59 | /** The intensity of the shield, defining how narrow the highlighting is. 0 is spread out, 5 is very narrow. */ 60 | uniform float _intensity_shield : hint_range(0.0, 5.0, 0.05) = 3.0; 61 | /** Is glow effect enabled for the shield. */ 62 | uniform bool glow_enabled = true; 63 | /** The strength of the glow effect, defining how strong the glow is. */ 64 | uniform float glow_strength = 0.1; 65 | 66 | group_uniforms Static_Ripple; 67 | /** Activates/deactivates the static ripple effect. Creating a constant repeating ripple effect. */ 68 | uniform bool _active_static = true; 69 | /** The origin of the static ripple effect, where the ripple will start from. It is expected to be in local space of the object. */ 70 | uniform vec3 _origin_static = vec3(0.0, 0.5, 0.0); 71 | /** The speed of the static ripple effect, which defines how fast the ripple moves. */ 72 | uniform float _speed_static = 0.1; 73 | /** The frequency of the static ripple effect, which defines how close the waves are generated. */ 74 | uniform float _frequency_static = 80.0; 75 | /** The maximum vertex displacement amplitude of the static ripple effect, which defines the height of the waves. */ 76 | uniform float _amplitude_static = 0.002; 77 | /** The amplitude of the static ripple effect used for the normal calculation, which can be different from the displacement amplitude, to exaggerate visual effects based on the normal (fresnel). */ 78 | uniform float _normal_amplitude_static = 0.002; 79 | /** The effect radius of the static ripple, which fades out the effect based on the distance from the origin. Increase this value to make the effect visible further away from the origin. */ 80 | uniform float _effect_radius_static = 1.2; 81 | /** Activates/deactivates the static offset highlighting effect, which highlights the offset of the shield, based on the vertex displacement from static effects. */ 82 | uniform bool _active_static_offset_hl = true; 83 | /** The strength of the static offset highlighting effect, defines how strong the highlighting is. */ 84 | uniform float _strength_static_offset_hl = 1.0; 85 | /** The intensity of the static offset highlighting effect, defining how narrow the highlighting is. 0 is spread out, 5 is very narrow. */ 86 | uniform float _intensity_static_offset_hl = 5.0; 87 | /** Defines if the coordinates of the origin is relative to the object position or in world space. */ 88 | uniform bool _relative_origin_static = true; 89 | 90 | group_uniforms Impact_Ripple; 91 | /** List of impact origins, where the impact ripples will start from. It is expected to be in world space. */ 92 | uniform vec3[5] _origin_impact; 93 | /** List of impact times, which defines the time of the impact ripples, normalized between 0 and 1. */ 94 | uniform float[5] _time_impact; 95 | /** The frequency of the impact ripples, which defines how close the waves are generated. */ 96 | uniform float _frequency_impact = 20.0; 97 | /** The number of waves generated by the impact, which won't fade over time, but just by distance. */ 98 | uniform float _waves_impact = 0.0; 99 | /** The additional number of waves generated by the impact, were each gets smaller than the previous one. */ 100 | uniform float _fade_waves_impact = 2.0; 101 | /** The maximum vertex displacement amplitude of the static ripple effect, which defines the height of the waves. */ 102 | uniform float _amplitude_impact = 0.02; 103 | /** The amplitude of the impact ripples used for the normal calculation, which can be different from the displacement amplitude, to exaggerate visual effects based on the normal (fresnel). */ 104 | uniform float _normal_amplitude_impact = 0.05; 105 | /** The effect radius of the impact ripples, which fades out the effect based on the distance from the origin. Increase this value to make the effect visible further away from the origin. */ 106 | uniform float _radius_impact = 1.0; 107 | /** Activates/deactivates the vertex offset highlighting effect, which highlights the offset of the shield, based on the vertex displacement from impact effects. */ 108 | uniform bool _active_impact_offset_hl = true; 109 | /** The strength of the impact offset highlighting effect, defines how strong the highlighting is. */ 110 | uniform float _strength_impact_offset_hl = 1.0; 111 | /** The intensity of the impact offset highlighting effect, defining how narrow the highlighting is. 0 is spread out, 5 is very narrow. */ 112 | uniform float _intensity_impact_offset_hl = 5.0; 113 | /** Defines if the coordinates of the origin is relative to the object position or in world space. */ 114 | uniform bool _relative_origin_impact = false; 115 | 116 | group_uniforms Border; 117 | /** Activates/deactivates the border highlighting effect, which highlights the border of the shield, based on the UV coordinates. */ 118 | uniform bool _active_border = false; 119 | /** The intensity of the border highlighting effect, defining how narrow the highlighting is. 0 is spread out, 5 is very narrow. */ 120 | uniform float _intensity_border: hint_range(0.0, 5.0, 0.05) = 2.0; 121 | /** Thickness of the border in percentage. 1.0 makes the border stretch to the center of the object. 0.0 makes the border disappear. */ 122 | uniform float _percentage_border: hint_range(0.0, 1.0) = 0.1; 123 | 124 | group_uniforms Debug; 125 | /** @debug Show the normals of the shield, which are used for the normal calculation of the shield. */ 126 | uniform bool _show_normals = false; 127 | 128 | 129 | #include "shield_base.gdshaderinc" 130 | -------------------------------------------------------------------------------- /addons/nojoule-energy-shield/shield_web.gdshader: -------------------------------------------------------------------------------- 1 | shader_type spatial; 2 | 3 | // Define WEB for conditional compilation 4 | #define WEB 5 | 6 | group_uniforms General; 7 | /** Use quantization for alpha and color values to get a more pixelated look. */ 8 | uniform bool _quantization = true; 9 | /** Quantization steps for the alpha and color values. */ 10 | uniform int _steps_quantization : hint_range(1, 20, 1) = 5; 11 | 12 | 13 | /** The scale of the object, used to adjust the impact radius and frequency, to match the scaling of objects. Using the shield.gd script, the scale is set to the x-axis scale of the global transform automatically. */ 14 | uniform float _object_scale = 1.0; 15 | /** Expected to be the maximum diameter of an object. If this is shorter the generation or collapse of the shield might not complete and stop early. */ 16 | uniform float _object_size = 1.0; 17 | 18 | group_uniforms Visibility; 19 | /** Turning this on makes the shield invisible by default and only visible on impacts. */ 20 | uniform bool _only_on_wave_visibility = false; 21 | /** A lower value makes the shield be invisible faster after the impact. */ 22 | uniform float _start_falloff_visibility : hint_range(0, 1, 0.05) = 0.5; 23 | /** A higher value makes the shield fading out process end sooner. */ 24 | uniform float _end_falloff_visibility : hint_range(0, 1, 0.05) = 0.3; 25 | /** Modifies how fast the shield visibility progresses through the object, based on the distance to the impact origin. */ 26 | uniform float _time_multiplier_activation = 2.0; 27 | /** Modifies the activation effect fading out over distance. */ 28 | uniform float _distance_multiplier_activation = 1.0; 29 | /** The the width of the fading IN effect on impact makes the activation begin more smoothly. */ 30 | uniform float _width_time_activation = 0.2; 31 | 32 | group_uniforms Intersection; 33 | /** Enable/Disable the effect of highlighting the intersection of the shield with other objects. */ 34 | uniform bool _enable_highlight_intersection = true; 35 | 36 | /** The width of the intersection highlight effect. */ 37 | uniform float _width_highlight_intersection = 1.0; 38 | 39 | 40 | group_uniforms Noise; 41 | /** The noise texture used to add some dynamic to the shield color, which affects the color and alpha values of the shield. Should be seamless, to avoid visible seams. */ 42 | uniform sampler2D _noise_texture; 43 | /** Defines the rate at which the noise texture is displaced in the x and y direction. */ 44 | uniform vec2 _speed_noise = vec2(0.02, 0.02); 45 | 46 | group_uniforms Generate_Collapse_Animation; 47 | /** The origin of the shield generation, where the shield will start to generate from. By default, it is expected to be in local space. */ 48 | uniform vec3 _origin_generate = vec3(0.0, 0.5, 0.0); 49 | /** The time of the generation or collapse animation, normalized between 0 and 1. */ 50 | uniform float _time_generate = 1.0; 51 | /** The border thickness of the generated shield highlighting the just generated shield surface. */ 52 | uniform float _thickness_generate = 0.25; 53 | /** By default this animation generates the shield, but if set to true, it will collapse the shield instead. */ 54 | uniform bool _collapse = false; 55 | 56 | group_uniforms Shield_Color; 57 | /** The base color of the shield, which is modifeid by the brightness and intensity. and varies across the shield surface. */ 58 | uniform vec3 _color_shield : source_color = vec3(0.26, 0.975, 1); 59 | /** The brightness of the shield color, which is multiplied with the shield visibility. */ 60 | uniform float _color_brightness_shield : hint_range(0.1, 100.0, 0.05) = 15.0; 61 | /** The intensity of the shield, defining how narrow the highlighting is. 0 is spread out, 5 is very narrow. */ 62 | uniform float _intensity_shield : hint_range(0.0, 5.0, 0.05) = 3.0; 63 | /** Is glow effect enabled for the shield. */ 64 | uniform bool glow_enabled = true; 65 | /** The strength of the glow effect, defining how strong the glow is. */ 66 | uniform float glow_strength = 0.1; 67 | 68 | group_uniforms Static_Ripple; 69 | /** Activates/deactivates the static ripple effect. Creating a constant repeating ripple effect. */ 70 | uniform bool _active_static = true; 71 | /** The origin of the static ripple effect, where the ripple will start from. It is expected to be in local space of the object. */ 72 | uniform vec3 _origin_static = vec3(0.0, 0.5, 0.0); 73 | /** The speed of the static ripple effect, which defines how fast the ripple moves. */ 74 | uniform float _speed_static = 0.1; 75 | /** The frequency of the static ripple effect, which defines how close the waves are generated. */ 76 | uniform float _frequency_static = 80.0; 77 | /** The maximum vertex displacement amplitude of the static ripple effect, which defines the height of the waves. */ 78 | uniform float _amplitude_static = 0.002; 79 | /** The amplitude of the static ripple effect used for the normal calculation, which can be different from the displacement amplitude, to exaggerate visual effects based on the normal (fresnel). */ 80 | uniform float _normal_amplitude_static = 0.002; 81 | /** The effect radius of the static ripple, which fades out the effect based on the distance from the origin. Increase this value to make the effect visible further away from the origin. */ 82 | uniform float _effect_radius_static = 1.2; 83 | /** Activates/deactivates the static offset highlighting effect, which highlights the offset of the shield, based on the vertex displacement from static effects. */ 84 | uniform bool _active_static_offset_hl = true; 85 | /** The strength of the static offset highlighting effect, defines how strong the highlighting is. */ 86 | uniform float _strength_static_offset_hl = 1.0; 87 | /** The intensity of the static offset highlighting effect, defining how narrow the highlighting is. 0 is spread out, 5 is very narrow. */ 88 | uniform float _intensity_static_offset_hl = 5.0; 89 | /** Defines if the coordinates of the origin is relative to the object position or in world space. */ 90 | uniform bool _relative_origin_static = true; 91 | 92 | group_uniforms Impact_Ripple; 93 | /** List of impact origins, where the impact ripples will start from. It is expected to be in world space. */ 94 | uniform vec3[5] _origin_impact; 95 | /** List of impact times, which defines the time of the impact ripples, normalized between 0 and 1. */ 96 | uniform float[5] _time_impact; 97 | /** The frequency of the impact ripples, which defines how close the waves are generated. */ 98 | uniform float _frequency_impact = 20.0; 99 | /** The number of waves generated by the impact, which won't fade over time, but just by distance. */ 100 | uniform float _waves_impact = 0.0; 101 | /** The additional number of waves generated by the impact, were each gets smaller than the previous one. */ 102 | uniform float _fade_waves_impact = 2.0; 103 | /** The maximum vertex displacement amplitude of the static ripple effect, which defines the height of the waves. */ 104 | uniform float _amplitude_impact = 0.02; 105 | /** The amplitude of the impact ripples used for the normal calculation, which can be different from the displacement amplitude, to exaggerate visual effects based on the normal (fresnel). */ 106 | uniform float _normal_amplitude_impact = 0.05; 107 | /** The effect radius of the impact ripples, which fades out the effect based on the distance from the origin. Increase this value to make the effect visible further away from the origin. */ 108 | uniform float _radius_impact = 1.0; 109 | /** Activates/deactivates the vertex offset highlighting effect, which highlights the offset of the shield, based on the vertex displacement from impact effects. */ 110 | uniform bool _active_impact_offset_hl = true; 111 | /** The strength of the impact offset highlighting effect, defines how strong the highlighting is. */ 112 | uniform float _strength_impact_offset_hl = 1.0; 113 | /** The intensity of the impact offset highlighting effect, defining how narrow the highlighting is. 0 is spread out, 5 is very narrow. */ 114 | uniform float _intensity_impact_offset_hl = 5.0; 115 | /** Defines if the coordinates of the origin is relative to the object position or in world space. */ 116 | uniform bool _relative_origin_impact = false; 117 | 118 | group_uniforms Border; 119 | /** Activates/deactivates the border highlighting effect, which highlights the border of the shield, based on the UV coordinates. */ 120 | uniform bool _active_border = false; 121 | /** The intensity of the border highlighting effect, defining how narrow the highlighting is. 0 is spread out, 5 is very narrow. */ 122 | uniform float _intensity_border: hint_range(0.0, 5.0, 0.05) = 2.0; 123 | /** Thickness of the border in percentage. 1.0 makes the border stretch to the center of the object. 0.0 makes the border disappear. */ 124 | uniform float _percentage_border: hint_range(0.0, 1.0) = 0.1; 125 | 126 | group_uniforms Debug; 127 | /** @debug Show the normals of the shield, which are used for the normal calculation of the shield. */ 128 | uniform bool _show_normals = false; 129 | 130 | 131 | #include "shield_base.gdshaderinc" 132 | -------------------------------------------------------------------------------- /addons/nojoule-energy-shield/shield_back.gdshader: -------------------------------------------------------------------------------- 1 | shader_type spatial; 2 | 3 | uniform sampler2D depth_texture : hint_depth_texture; 4 | 5 | group_uniforms General; 6 | /** Use quantization for alpha and color values to get a more pixelated look. */ 7 | uniform bool _quantization = true; 8 | /** Quantization steps for the alpha and color values. */ 9 | uniform int _steps_quantization : hint_range(1, 20, 1) = 5; 10 | 11 | 12 | /** The scale of the object, used to adjust the impact radius and frequency, to match the scaling of objects. Using the shield.gd script, the scale is set to the x-axis scale of the global transform automatically. */ 13 | uniform float _object_scale = 1.0; 14 | /** Expected to be the maximum diameter of an object. If this is shorter the generation or collapse of the shield might not complete and stop early. */ 15 | uniform float _object_size = 1.0; 16 | 17 | group_uniforms Visibility; 18 | /** Turning this on makes the shield invisible by default and only visible on impacts. */ 19 | uniform bool _only_on_wave_visibility = false; 20 | /** A lower value makes the shield be invisible faster after the impact. */ 21 | uniform float _start_falloff_visibility : hint_range(0, 1, 0.05) = 0.5; 22 | /** A higher value makes the shield fading out process end sooner. */ 23 | uniform float _end_falloff_visibility : hint_range(0, 1, 0.05) = 0.3; 24 | /** Modifies how fast the shield visibility progresses through the object, based on the distance to the impact origin. */ 25 | uniform float _time_multiplier_activation = 2.0; 26 | /** Modifies the activation effect fading out over distance. */ 27 | uniform float _distance_multiplier_activation = 1.0; 28 | /** The the width of the fading IN effect on impact makes the activation begin more smoothly. */ 29 | uniform float _width_time_activation = 0.2; 30 | 31 | group_uniforms Intersection; 32 | /** Enable/Disable the effect of highlighting the intersection of the shield with other objects. */ 33 | uniform bool _enable_highlight_intersection = true; 34 | /** The width of the intersection highlight effect. */ 35 | uniform float _width_highlight_intersection = 1.0; 36 | 37 | 38 | group_uniforms Noise; 39 | /** The noise texture used to add some dynamic to the shield color, which affects the color and alpha values of the shield. Should be seamless, to avoid visible seams. */ 40 | uniform sampler2D _noise_texture; 41 | /** Defines the rate at which the noise texture is displaced in the x and y direction. */ 42 | uniform vec2 _speed_noise = vec2(0.02, 0.02); 43 | 44 | group_uniforms Generate_Collapse_Animation; 45 | /** The origin of the shield generation, where the shield will start to generate from. By default, it is expected to be in local space. */ 46 | uniform vec3 _origin_generate = vec3(0.0, 0.5, 0.0); 47 | /** The time of the generation or collapse animation, normalized between 0 and 1. */ 48 | uniform float _time_generate = 1.0; 49 | /** The border thickness of the generated shield highlighting the just generated shield surface. */ 50 | uniform float _thickness_generate = 0.25; 51 | /** By default this animation generates the shield, but if set to true, it will collapse the shield instead. */ 52 | uniform bool _collapse = false; 53 | 54 | group_uniforms Shield_Color; 55 | /** The base color of the shield, which is modifeid by the brightness and intensity. and varies across the shield surface. */ 56 | uniform vec3 _color_shield : source_color = vec3(0.26, 0.975, 1); 57 | /** The brightness of the shield color, which is multiplied with the shield visibility. */ 58 | uniform float _color_brightness_shield : hint_range(0.1, 100.0, 0.05) = 15.0; 59 | /** The intensity of the shield, defining how narrow the highlighting is. 0 is spread out, 5 is very narrow. */ 60 | uniform float _intensity_shield : hint_range(0.0, 5.0, 0.05) = 3.0; 61 | /** Is glow effect enabled for the shield. */ 62 | uniform bool glow_enabled = true; 63 | /** The strength of the glow effect, defining how strong the glow is. */ 64 | uniform float glow_strength = 0.1; 65 | 66 | group_uniforms Static_Ripple; 67 | /** Activates/deactivates the static ripple effect. Creating a constant repeating ripple effect. */ 68 | uniform bool _active_static = true; 69 | /** The origin of the static ripple effect, where the ripple will start from. It is expected to be in local space of the object. */ 70 | uniform vec3 _origin_static = vec3(0.0, 0.5, 0.0); 71 | /** The speed of the static ripple effect, which defines how fast the ripple moves. */ 72 | uniform float _speed_static = 0.1; 73 | /** The frequency of the static ripple effect, which defines how close the waves are generated. */ 74 | uniform float _frequency_static = 80.0; 75 | /** The maximum vertex displacement amplitude of the static ripple effect, which defines the height of the waves. */ 76 | uniform float _amplitude_static = 0.002; 77 | /** The amplitude of the static ripple effect used for the normal calculation, which can be different from the displacement amplitude, to exaggerate visual effects based on the normal (fresnel). */ 78 | uniform float _normal_amplitude_static = 0.002; 79 | /** The effect radius of the static ripple, which fades out the effect based on the distance from the origin. Increase this value to make the effect visible further away from the origin. */ 80 | uniform float _effect_radius_static = 1.2; 81 | /** Activates/deactivates the static offset highlighting effect, which highlights the offset of the shield, based on the vertex displacement from static effects. */ 82 | uniform bool _active_static_offset_hl = true; 83 | /** The strength of the static offset highlighting effect, defines how strong the highlighting is. */ 84 | uniform float _strength_static_offset_hl = 1.0; 85 | /** The intensity of the static offset highlighting effect, defining how narrow the highlighting is. 0 is spread out, 5 is very narrow. */ 86 | uniform float _intensity_static_offset_hl = 5.0; 87 | /** Defines if the coordinates of the origin is relative to the object position or in world space. */ 88 | uniform bool _relative_origin_static = true; 89 | 90 | group_uniforms Impact_Ripple; 91 | /** List of impact origins, where the impact ripples will start from. It is expected to be in world space. */ 92 | uniform vec3[5] _origin_impact; 93 | /** List of impact times, which defines the time of the impact ripples, normalized between 0 and 1. */ 94 | uniform float[5] _time_impact; 95 | /** The frequency of the impact ripples, which defines how close the waves are generated. */ 96 | uniform float _frequency_impact = 20.0; 97 | /** The number of waves generated by the impact, which won't fade over time, but just by distance. */ 98 | uniform float _waves_impact = 0.0; 99 | /** The additional number of waves generated by the impact, were each gets smaller than the previous one. */ 100 | uniform float _fade_waves_impact = 2.0; 101 | /** The maximum vertex displacement amplitude of the static ripple effect, which defines the height of the waves. */ 102 | uniform float _amplitude_impact = 0.02; 103 | /** The amplitude of the impact ripples used for the normal calculation, which can be different from the displacement amplitude, to exaggerate visual effects based on the normal (fresnel). */ 104 | uniform float _normal_amplitude_impact = 0.05; 105 | /** The effect radius of the impact ripples, which fades out the effect based on the distance from the origin. Increase this value to make the effect visible further away from the origin. */ 106 | uniform float _radius_impact = 1.0; 107 | /** Activates/deactivates the vertex offset highlighting effect, which highlights the offset of the shield, based on the vertex displacement from impact effects. */ 108 | uniform bool _active_impact_offset_hl = true; 109 | /** The strength of the impact offset highlighting effect, defines how strong the highlighting is. */ 110 | uniform float _strength_impact_offset_hl = 1.0; 111 | /** The intensity of the impact offset highlighting effect, defining how narrow the highlighting is. 0 is spread out, 5 is very narrow. */ 112 | uniform float _intensity_impact_offset_hl = 5.0; 113 | /** Defines if the coordinates of the origin is relative to the object position or in world space. */ 114 | uniform bool _relative_origin_impact = false; 115 | 116 | group_uniforms Border; 117 | /** Activates/deactivates the border highlighting effect, which highlights the border of the shield, based on the UV coordinates. */ 118 | uniform bool _active_border = false; 119 | /** The intensity of the border highlighting effect, defining how narrow the highlighting is. 0 is spread out, 5 is very narrow. */ 120 | uniform float _intensity_border: hint_range(0.0, 5.0, 0.05) = 2.0; 121 | /** Thickness of the border in percentage. 1.0 makes the border stretch to the center of the object. 0.0 makes the border disappear. */ 122 | uniform float _percentage_border: hint_range(0.0, 1.0) = 0.1; 123 | 124 | group_uniforms Debug; 125 | /** @debug Show the normals of the shield, which are used for the normal calculation of the shield. */ 126 | uniform bool _show_normals = false; 127 | 128 | #define SHIELD_BACK 129 | 130 | #include "shield_base.gdshaderinc" 131 | -------------------------------------------------------------------------------- /addons/nojoule-energy-shield/shield_front.gdshader: -------------------------------------------------------------------------------- 1 | shader_type spatial; 2 | 3 | uniform sampler2D depth_texture : hint_depth_texture; 4 | 5 | group_uniforms General; 6 | /** Use quantization for alpha and color values to get a more pixelated look. */ 7 | uniform bool _quantization = true; 8 | /** Quantization steps for the alpha and color values. */ 9 | uniform int _steps_quantization : hint_range(1, 20, 1) = 5; 10 | 11 | 12 | /** The scale of the object, used to adjust the impact radius and frequency, to match the scaling of objects. Using the shield.gd script, the scale is set to the x-axis scale of the global transform automatically. */ 13 | uniform float _object_scale = 1.0; 14 | /** Expected to be the maximum diameter of an object. If this is shorter the generation or collapse of the shield might not complete and stop early. */ 15 | uniform float _object_size = 1.0; 16 | 17 | group_uniforms Visibility; 18 | /** Turning this on makes the shield invisible by default and only visible on impacts. */ 19 | uniform bool _only_on_wave_visibility = false; 20 | /** A lower value makes the shield be invisible faster after the impact. */ 21 | uniform float _start_falloff_visibility : hint_range(0, 1, 0.05) = 0.5; 22 | /** A higher value makes the shield fading out process end sooner. */ 23 | uniform float _end_falloff_visibility : hint_range(0, 1, 0.05) = 0.3; 24 | /** Modifies how fast the shield visibility progresses through the object, based on the distance to the impact origin. */ 25 | uniform float _time_multiplier_activation = 2.0; 26 | /** Modifies the activation effect fading out over distance. */ 27 | uniform float _distance_multiplier_activation = 1.0; 28 | /** The the width of the fading IN effect on impact makes the activation begin more smoothly. */ 29 | uniform float _width_time_activation = 0.2; 30 | 31 | group_uniforms Intersection; 32 | /** Enable/Disable the effect of highlighting the intersection of the shield with other objects. */ 33 | uniform bool _enable_highlight_intersection = true; 34 | /** The width of the intersection highlight effect. */ 35 | uniform float _width_highlight_intersection = 1.0; 36 | 37 | 38 | group_uniforms Noise; 39 | /** The noise texture used to add some dynamic to the shield color, which affects the color and alpha values of the shield. Should be seamless, to avoid visible seams. */ 40 | uniform sampler2D _noise_texture; 41 | /** Defines the rate at which the noise texture is displaced in the x and y direction. */ 42 | uniform vec2 _speed_noise = vec2(0.02, 0.02); 43 | 44 | group_uniforms Generate_Collapse_Animation; 45 | /** The origin of the shield generation, where the shield will start to generate from. By default, it is expected to be in local space. */ 46 | uniform vec3 _origin_generate = vec3(0.0, 0.5, 0.0); 47 | /** The time of the generation or collapse animation, normalized between 0 and 1. */ 48 | uniform float _time_generate = 1.0; 49 | /** The border thickness of the generated shield highlighting the just generated shield surface. */ 50 | uniform float _thickness_generate = 0.25; 51 | /** By default this animation generates the shield, but if set to true, it will collapse the shield instead. */ 52 | uniform bool _collapse = false; 53 | 54 | group_uniforms Shield_Color; 55 | /** The base color of the shield, which is modifeid by the brightness and intensity. and varies across the shield surface. */ 56 | uniform vec3 _color_shield : source_color = vec3(0.26, 0.975, 1); 57 | /** The brightness of the shield color, which is multiplied with the shield visibility. */ 58 | uniform float _color_brightness_shield : hint_range(0.1, 100.0, 0.05) = 15.0; 59 | /** The intensity of the shield, defining how narrow the highlighting is. 0 is spread out, 5 is very narrow. */ 60 | uniform float _intensity_shield : hint_range(0.0, 5.0, 0.05) = 3.0; 61 | /** Is glow effect enabled for the shield. */ 62 | uniform bool glow_enabled = true; 63 | /** The strength of the glow effect, defining how strong the glow is. */ 64 | uniform float glow_strength = 0.1; 65 | 66 | group_uniforms Static_Ripple; 67 | /** Activates/deactivates the static ripple effect. Creating a constant repeating ripple effect. */ 68 | uniform bool _active_static = true; 69 | /** The origin of the static ripple effect, where the ripple will start from. It is expected to be in local space of the object. */ 70 | uniform vec3 _origin_static = vec3(0.0, 0.5, 0.0); 71 | /** The speed of the static ripple effect, which defines how fast the ripple moves. */ 72 | uniform float _speed_static = 0.1; 73 | /** The frequency of the static ripple effect, which defines how close the waves are generated. */ 74 | uniform float _frequency_static = 80.0; 75 | /** The maximum vertex displacement amplitude of the static ripple effect, which defines the height of the waves. */ 76 | uniform float _amplitude_static = 0.002; 77 | /** The amplitude of the static ripple effect used for the normal calculation, which can be different from the displacement amplitude, to exaggerate visual effects based on the normal (fresnel). */ 78 | uniform float _normal_amplitude_static = 0.002; 79 | /** The effect radius of the static ripple, which fades out the effect based on the distance from the origin. Increase this value to make the effect visible further away from the origin. */ 80 | uniform float _effect_radius_static = 1.2; 81 | /** Activates/deactivates the static offset highlighting effect, which highlights the offset of the shield, based on the vertex displacement from static effects. */ 82 | uniform bool _active_static_offset_hl = true; 83 | /** The strength of the static offset highlighting effect, defines how strong the highlighting is. */ 84 | uniform float _strength_static_offset_hl = 1.0; 85 | /** The intensity of the static offset highlighting effect, defining how narrow the highlighting is. 0 is spread out, 5 is very narrow. */ 86 | uniform float _intensity_static_offset_hl = 5.0; 87 | /** Defines if the coordinates of the origin is relative to the object position or in world space. */ 88 | uniform bool _relative_origin_static = true; 89 | 90 | group_uniforms Impact_Ripple; 91 | /** List of impact origins, where the impact ripples will start from. It is expected to be in world space. */ 92 | uniform vec3[5] _origin_impact; 93 | /** List of impact times, which defines the time of the impact ripples, normalized between 0 and 1. */ 94 | uniform float[5] _time_impact; 95 | /** The frequency of the impact ripples, which defines how close the waves are generated. */ 96 | uniform float _frequency_impact = 20.0; 97 | /** The number of waves generated by the impact, which won't fade over time, but just by distance. */ 98 | uniform float _waves_impact = 0.0; 99 | /** The additional number of waves generated by the impact, were each gets smaller than the previous one. */ 100 | uniform float _fade_waves_impact = 2.0; 101 | /** The maximum vertex displacement amplitude of the static ripple effect, which defines the height of the waves. */ 102 | uniform float _amplitude_impact = 0.02; 103 | /** The amplitude of the impact ripples used for the normal calculation, which can be different from the displacement amplitude, to exaggerate visual effects based on the normal (fresnel). */ 104 | uniform float _normal_amplitude_impact = 0.05; 105 | /** The effect radius of the impact ripples, which fades out the effect based on the distance from the origin. Increase this value to make the effect visible further away from the origin. */ 106 | uniform float _radius_impact = 1.0; 107 | /** Activates/deactivates the vertex offset highlighting effect, which highlights the offset of the shield, based on the vertex displacement from impact effects. */ 108 | uniform bool _active_impact_offset_hl = true; 109 | /** The strength of the impact offset highlighting effect, defines how strong the highlighting is. */ 110 | uniform float _strength_impact_offset_hl = 1.0; 111 | /** The intensity of the impact offset highlighting effect, defining how narrow the highlighting is. 0 is spread out, 5 is very narrow. */ 112 | uniform float _intensity_impact_offset_hl = 5.0; 113 | /** Defines if the coordinates of the origin is relative to the object position or in world space. */ 114 | uniform bool _relative_origin_impact = false; 115 | 116 | group_uniforms Border; 117 | /** Activates/deactivates the border highlighting effect, which highlights the border of the shield, based on the UV coordinates. */ 118 | uniform bool _active_border = false; 119 | /** The intensity of the border highlighting effect, defining how narrow the highlighting is. 0 is spread out, 5 is very narrow. */ 120 | uniform float _intensity_border: hint_range(0.0, 5.0, 0.05) = 2.0; 121 | /** Thickness of the border in percentage. 1.0 makes the border stretch to the center of the object. 0.0 makes the border disappear. */ 122 | uniform float _percentage_border: hint_range(0.0, 1.0) = 0.1; 123 | 124 | group_uniforms Debug; 125 | /** @debug Show the normals of the shield, which are used for the normal calculation of the shield. */ 126 | uniform bool _show_normals = false; 127 | 128 | #define SHIELD_FRONT 129 | 130 | #include "shield_base.gdshaderinc" 131 | -------------------------------------------------------------------------------- /addons/nojoule-energy-shield/shield_web_back.gdshader: -------------------------------------------------------------------------------- 1 | shader_type spatial; 2 | 3 | // Define WEB for conditional compilation 4 | #define WEB 5 | 6 | group_uniforms General; 7 | /** Use quantization for alpha and color values to get a more pixelated look. */ 8 | uniform bool _quantization = true; 9 | /** Quantization steps for the alpha and color values. */ 10 | uniform int _steps_quantization : hint_range(1, 20, 1) = 5; 11 | 12 | 13 | /** The scale of the object, used to adjust the impact radius and frequency, to match the scaling of objects. Using the shield.gd script, the scale is set to the x-axis scale of the global transform automatically. */ 14 | uniform float _object_scale = 1.0; 15 | /** Expected to be the maximum diameter of an object. If this is shorter the generation or collapse of the shield might not complete and stop early. */ 16 | uniform float _object_size = 1.0; 17 | 18 | group_uniforms Visibility; 19 | /** Turning this on makes the shield invisible by default and only visible on impacts. */ 20 | uniform bool _only_on_wave_visibility = false; 21 | /** A lower value makes the shield be invisible faster after the impact. */ 22 | uniform float _start_falloff_visibility : hint_range(0, 1, 0.05) = 0.5; 23 | /** A higher value makes the shield fading out process end sooner. */ 24 | uniform float _end_falloff_visibility : hint_range(0, 1, 0.05) = 0.3; 25 | /** Modifies how fast the shield visibility progresses through the object, based on the distance to the impact origin. */ 26 | uniform float _time_multiplier_activation = 2.0; 27 | /** Modifies the activation effect fading out over distance. */ 28 | uniform float _distance_multiplier_activation = 1.0; 29 | /** The the width of the fading IN effect on impact makes the activation begin more smoothly. */ 30 | uniform float _width_time_activation = 0.2; 31 | 32 | group_uniforms Intersection; 33 | /** Enable/Disable the effect of highlighting the intersection of the shield with other objects. */ 34 | uniform bool _enable_highlight_intersection = true; 35 | /** The width of the intersection highlight effect. */ 36 | uniform float _width_highlight_intersection = 1.0; 37 | 38 | 39 | group_uniforms Noise; 40 | /** The noise texture used to add some dynamic to the shield color, which affects the color and alpha values of the shield. Should be seamless, to avoid visible seams. */ 41 | uniform sampler2D _noise_texture; 42 | /** Defines the rate at which the noise texture is displaced in the x and y direction. */ 43 | uniform vec2 _speed_noise = vec2(0.02, 0.02); 44 | 45 | group_uniforms Generate_Collapse_Animation; 46 | /** The origin of the shield generation, where the shield will start to generate from. By default, it is expected to be in local space. */ 47 | uniform vec3 _origin_generate = vec3(0.0, 0.5, 0.0); 48 | /** The time of the generation or collapse animation, normalized between 0 and 1. */ 49 | uniform float _time_generate = 1.0; 50 | /** The border thickness of the generated shield highlighting the just generated shield surface. */ 51 | uniform float _thickness_generate = 0.25; 52 | /** By default this animation generates the shield, but if set to true, it will collapse the shield instead. */ 53 | uniform bool _collapse = false; 54 | 55 | group_uniforms Shield_Color; 56 | /** The base color of the shield, which is modifeid by the brightness and intensity. and varies across the shield surface. */ 57 | uniform vec3 _color_shield : source_color = vec3(0.26, 0.975, 1); 58 | /** The brightness of the shield color, which is multiplied with the shield visibility. */ 59 | uniform float _color_brightness_shield : hint_range(0.1, 100.0, 0.05) = 15.0; 60 | /** The intensity of the shield, defining how narrow the highlighting is. 0 is spread out, 5 is very narrow. */ 61 | uniform float _intensity_shield : hint_range(0.0, 5.0, 0.05) = 3.0; 62 | /** Is glow effect enabled for the shield. */ 63 | uniform bool glow_enabled = true; 64 | /** The strength of the glow effect, defining how strong the glow is. */ 65 | uniform float glow_strength = 0.1; 66 | 67 | group_uniforms Static_Ripple; 68 | /** Activates/deactivates the static ripple effect. Creating a constant repeating ripple effect. */ 69 | uniform bool _active_static = true; 70 | /** The origin of the static ripple effect, where the ripple will start from. It is expected to be in local space of the object. */ 71 | uniform vec3 _origin_static = vec3(0.0, 0.5, 0.0); 72 | /** The speed of the static ripple effect, which defines how fast the ripple moves. */ 73 | uniform float _speed_static = 0.1; 74 | /** The frequency of the static ripple effect, which defines how close the waves are generated. */ 75 | uniform float _frequency_static = 80.0; 76 | /** The maximum vertex displacement amplitude of the static ripple effect, which defines the height of the waves. */ 77 | uniform float _amplitude_static = 0.002; 78 | /** The amplitude of the static ripple effect used for the normal calculation, which can be different from the displacement amplitude, to exaggerate visual effects based on the normal (fresnel). */ 79 | uniform float _normal_amplitude_static = 0.002; 80 | /** The effect radius of the static ripple, which fades out the effect based on the distance from the origin. Increase this value to make the effect visible further away from the origin. */ 81 | uniform float _effect_radius_static = 1.2; 82 | /** Activates/deactivates the static offset highlighting effect, which highlights the offset of the shield, based on the vertex displacement from static effects. */ 83 | uniform bool _active_static_offset_hl = true; 84 | /** The strength of the static offset highlighting effect, defines how strong the highlighting is. */ 85 | uniform float _strength_static_offset_hl = 1.0; 86 | /** The intensity of the static offset highlighting effect, defining how narrow the highlighting is. 0 is spread out, 5 is very narrow. */ 87 | uniform float _intensity_static_offset_hl = 5.0; 88 | /** Defines if the coordinates of the origin is relative to the object position or in world space. */ 89 | uniform bool _relative_origin_static = true; 90 | 91 | group_uniforms Impact_Ripple; 92 | /** List of impact origins, where the impact ripples will start from. It is expected to be in world space. */ 93 | uniform vec3[5] _origin_impact; 94 | /** List of impact times, which defines the time of the impact ripples, normalized between 0 and 1. */ 95 | uniform float[5] _time_impact; 96 | /** The frequency of the impact ripples, which defines how close the waves are generated. */ 97 | uniform float _frequency_impact = 20.0; 98 | /** The number of waves generated by the impact, which won't fade over time, but just by distance. */ 99 | uniform float _waves_impact = 0.0; 100 | /** The additional number of waves generated by the impact, were each gets smaller than the previous one. */ 101 | uniform float _fade_waves_impact = 2.0; 102 | /** The maximum vertex displacement amplitude of the static ripple effect, which defines the height of the waves. */ 103 | uniform float _amplitude_impact = 0.02; 104 | /** The amplitude of the impact ripples used for the normal calculation, which can be different from the displacement amplitude, to exaggerate visual effects based on the normal (fresnel). */ 105 | uniform float _normal_amplitude_impact = 0.05; 106 | /** The effect radius of the impact ripples, which fades out the effect based on the distance from the origin. Increase this value to make the effect visible further away from the origin. */ 107 | uniform float _radius_impact = 1.0; 108 | /** Activates/deactivates the vertex offset highlighting effect, which highlights the offset of the shield, based on the vertex displacement from impact effects. */ 109 | uniform bool _active_impact_offset_hl = true; 110 | /** The strength of the impact offset highlighting effect, defines how strong the highlighting is. */ 111 | uniform float _strength_impact_offset_hl = 1.0; 112 | /** The intensity of the impact offset highlighting effect, defining how narrow the highlighting is. 0 is spread out, 5 is very narrow. */ 113 | uniform float _intensity_impact_offset_hl = 5.0; 114 | /** Defines if the coordinates of the origin is relative to the object position or in world space. */ 115 | uniform bool _relative_origin_impact = false; 116 | 117 | group_uniforms Border; 118 | /** Activates/deactivates the border highlighting effect, which highlights the border of the shield, based on the UV coordinates. */ 119 | uniform bool _active_border = false; 120 | /** The intensity of the border highlighting effect, defining how narrow the highlighting is. 0 is spread out, 5 is very narrow. */ 121 | uniform float _intensity_border: hint_range(0.0, 5.0, 0.05) = 2.0; 122 | /** Thickness of the border in percentage. 1.0 makes the border stretch to the center of the object. 0.0 makes the border disappear. */ 123 | uniform float _percentage_border: hint_range(0.0, 1.0) = 0.1; 124 | 125 | group_uniforms Debug; 126 | /** @debug Show the normals of the shield, which are used for the normal calculation of the shield. */ 127 | uniform bool _show_normals = false; 128 | 129 | #define SHIELD_BACK 130 | 131 | #include "shield_base.gdshaderinc" 132 | -------------------------------------------------------------------------------- /addons/nojoule-energy-shield/shield_web_front.gdshader: -------------------------------------------------------------------------------- 1 | shader_type spatial; 2 | 3 | // Define WEB for conditional compilation 4 | #define WEB 5 | 6 | group_uniforms General; 7 | /** Use quantization for alpha and color values to get a more pixelated look. */ 8 | uniform bool _quantization = true; 9 | /** Quantization steps for the alpha and color values. */ 10 | uniform int _steps_quantization : hint_range(1, 20, 1) = 5; 11 | 12 | 13 | /** The scale of the object, used to adjust the impact radius and frequency, to match the scaling of objects. Using the shield.gd script, the scale is set to the x-axis scale of the global transform automatically. */ 14 | uniform float _object_scale = 1.0; 15 | /** Expected to be the maximum diameter of an object. If this is shorter the generation or collapse of the shield might not complete and stop early. */ 16 | uniform float _object_size = 1.0; 17 | 18 | group_uniforms Visibility; 19 | /** Turning this on makes the shield invisible by default and only visible on impacts. */ 20 | uniform bool _only_on_wave_visibility = false; 21 | /** A lower value makes the shield be invisible faster after the impact. */ 22 | uniform float _start_falloff_visibility : hint_range(0, 1, 0.05) = 0.5; 23 | /** A higher value makes the shield fading out process end sooner. */ 24 | uniform float _end_falloff_visibility : hint_range(0, 1, 0.05) = 0.3; 25 | /** Modifies how fast the shield visibility progresses through the object, based on the distance to the impact origin. */ 26 | uniform float _time_multiplier_activation = 2.0; 27 | /** Modifies the activation effect fading out over distance. */ 28 | uniform float _distance_multiplier_activation = 1.0; 29 | /** The the width of the fading IN effect on impact makes the activation begin more smoothly. */ 30 | uniform float _width_time_activation = 0.2; 31 | 32 | group_uniforms Intersection; 33 | /** Enable/Disable the effect of highlighting the intersection of the shield with other objects. */ 34 | uniform bool _enable_highlight_intersection = true; 35 | /** The width of the intersection highlight effect. */ 36 | uniform float _width_highlight_intersection = 1.0; 37 | 38 | 39 | group_uniforms Noise; 40 | /** The noise texture used to add some dynamic to the shield color, which affects the color and alpha values of the shield. Should be seamless, to avoid visible seams. */ 41 | uniform sampler2D _noise_texture; 42 | /** Defines the rate at which the noise texture is displaced in the x and y direction. */ 43 | uniform vec2 _speed_noise = vec2(0.02, 0.02); 44 | 45 | group_uniforms Generate_Collapse_Animation; 46 | /** The origin of the shield generation, where the shield will start to generate from. By default, it is expected to be in local space. */ 47 | uniform vec3 _origin_generate = vec3(0.0, 0.5, 0.0); 48 | /** The time of the generation or collapse animation, normalized between 0 and 1. */ 49 | uniform float _time_generate = 1.0; 50 | /** The border thickness of the generated shield highlighting the just generated shield surface. */ 51 | uniform float _thickness_generate = 0.25; 52 | /** By default this animation generates the shield, but if set to true, it will collapse the shield instead. */ 53 | uniform bool _collapse = false; 54 | 55 | group_uniforms Shield_Color; 56 | /** The base color of the shield, which is modifeid by the brightness and intensity. and varies across the shield surface. */ 57 | uniform vec3 _color_shield : source_color = vec3(0.26, 0.975, 1); 58 | /** The brightness of the shield color, which is multiplied with the shield visibility. */ 59 | uniform float _color_brightness_shield : hint_range(0.1, 100.0, 0.05) = 15.0; 60 | /** The intensity of the shield, defining how narrow the highlighting is. 0 is spread out, 5 is very narrow. */ 61 | uniform float _intensity_shield : hint_range(0.0, 5.0, 0.05) = 3.0; 62 | /** Is glow effect enabled for the shield. */ 63 | uniform bool glow_enabled = true; 64 | /** The strength of the glow effect, defining how strong the glow is. */ 65 | uniform float glow_strength = 0.1; 66 | 67 | group_uniforms Static_Ripple; 68 | /** Activates/deactivates the static ripple effect. Creating a constant repeating ripple effect. */ 69 | uniform bool _active_static = true; 70 | /** The origin of the static ripple effect, where the ripple will start from. It is expected to be in local space of the object. */ 71 | uniform vec3 _origin_static = vec3(0.0, 0.5, 0.0); 72 | /** The speed of the static ripple effect, which defines how fast the ripple moves. */ 73 | uniform float _speed_static = 0.1; 74 | /** The frequency of the static ripple effect, which defines how close the waves are generated. */ 75 | uniform float _frequency_static = 80.0; 76 | /** The maximum vertex displacement amplitude of the static ripple effect, which defines the height of the waves. */ 77 | uniform float _amplitude_static = 0.002; 78 | /** The amplitude of the static ripple effect used for the normal calculation, which can be different from the displacement amplitude, to exaggerate visual effects based on the normal (fresnel). */ 79 | uniform float _normal_amplitude_static = 0.002; 80 | /** The effect radius of the static ripple, which fades out the effect based on the distance from the origin. Increase this value to make the effect visible further away from the origin. */ 81 | uniform float _effect_radius_static = 1.2; 82 | /** Activates/deactivates the static offset highlighting effect, which highlights the offset of the shield, based on the vertex displacement from static effects. */ 83 | uniform bool _active_static_offset_hl = true; 84 | /** The strength of the static offset highlighting effect, defines how strong the highlighting is. */ 85 | uniform float _strength_static_offset_hl = 1.0; 86 | /** The intensity of the static offset highlighting effect, defining how narrow the highlighting is. 0 is spread out, 5 is very narrow. */ 87 | uniform float _intensity_static_offset_hl = 5.0; 88 | /** Defines if the coordinates of the origin is relative to the object position or in world space. */ 89 | uniform bool _relative_origin_static = true; 90 | 91 | group_uniforms Impact_Ripple; 92 | /** List of impact origins, where the impact ripples will start from. It is expected to be in world space. */ 93 | uniform vec3[5] _origin_impact; 94 | /** List of impact times, which defines the time of the impact ripples, normalized between 0 and 1. */ 95 | uniform float[5] _time_impact; 96 | /** The frequency of the impact ripples, which defines how close the waves are generated. */ 97 | uniform float _frequency_impact = 20.0; 98 | /** The number of waves generated by the impact, which won't fade over time, but just by distance. */ 99 | uniform float _waves_impact = 0.0; 100 | /** The additional number of waves generated by the impact, were each gets smaller than the previous one. */ 101 | uniform float _fade_waves_impact = 2.0; 102 | /** The maximum vertex displacement amplitude of the static ripple effect, which defines the height of the waves. */ 103 | uniform float _amplitude_impact = 0.02; 104 | /** The amplitude of the impact ripples used for the normal calculation, which can be different from the displacement amplitude, to exaggerate visual effects based on the normal (fresnel). */ 105 | uniform float _normal_amplitude_impact = 0.05; 106 | /** The effect radius of the impact ripples, which fades out the effect based on the distance from the origin. Increase this value to make the effect visible further away from the origin. */ 107 | uniform float _radius_impact = 1.0; 108 | /** Activates/deactivates the vertex offset highlighting effect, which highlights the offset of the shield, based on the vertex displacement from impact effects. */ 109 | uniform bool _active_impact_offset_hl = true; 110 | /** The strength of the impact offset highlighting effect, defines how strong the highlighting is. */ 111 | uniform float _strength_impact_offset_hl = 1.0; 112 | /** The intensity of the impact offset highlighting effect, defining how narrow the highlighting is. 0 is spread out, 5 is very narrow. */ 113 | uniform float _intensity_impact_offset_hl = 5.0; 114 | /** Defines if the coordinates of the origin is relative to the object position or in world space. */ 115 | uniform bool _relative_origin_impact = false; 116 | 117 | group_uniforms Border; 118 | /** Activates/deactivates the border highlighting effect, which highlights the border of the shield, based on the UV coordinates. */ 119 | uniform bool _active_border = false; 120 | /** The intensity of the border highlighting effect, defining how narrow the highlighting is. 0 is spread out, 5 is very narrow. */ 121 | uniform float _intensity_border: hint_range(0.0, 5.0, 0.05) = 2.0; 122 | /** Thickness of the border in percentage. 1.0 makes the border stretch to the center of the object. 0.0 makes the border disappear. */ 123 | uniform float _percentage_border: hint_range(0.0, 1.0) = 0.1; 124 | 125 | group_uniforms Debug; 126 | /** @debug Show the normals of the shield, which are used for the normal calculation of the shield. */ 127 | uniform bool _show_normals = false; 128 | 129 | #define SHIELD_FRONT 130 | 131 | #include "shield_base.gdshaderinc" 132 | -------------------------------------------------------------------------------- /addons/nojoule-energy-shield/shield.gd: -------------------------------------------------------------------------------- 1 | class_name NJEnergyShield 2 | extends MeshInstance3D 3 | 4 | ## Relay the body_entered signal from the Area3D to the shield. 5 | signal body_entered(body: Node) 6 | 7 | ## Relay the body_shape_entered signal from the Area3D to the shield. 8 | signal body_shape_entered( 9 | body_rid: RID, body: Node3D, body_shape_index: int, local_shape_index: int 10 | ) 11 | 12 | ## The fixed number of Impacts, the shader can handle at a time. 13 | const _MAX_IMPACTS: int = 5 14 | 15 | ## The curve used to _animate the impacts. The curve should start at 0.0 and end 16 | ## at 1.0 and defines the current progressing of the impact throughout the 17 | ## object. 18 | @export var animation_curve: Curve 19 | 20 | ## The time it takes for the impact to _animate from start to finish. 21 | @export var anim_time: float = 4.0 22 | 23 | ## The origin of the shield, where the shield will be created or _collapsed from 24 | ## by default if not provided otherwise in the functions. 25 | @export var shield_origin: Vector3 = Vector3(0.0, 0.5, 0.0) 26 | 27 | ## To prevent artifacts due to transparency and disabled culling, the shield can 28 | ## be split into a front and back part. 29 | @export var split_front_back: bool = false 30 | 31 | ## Make shield interactable by mouse-clicks. 32 | @export var handle_input_events: bool = true 33 | 34 | ## Trigger an impact when a body enters the shield. 35 | @export var body_entered_impact: bool = false 36 | 37 | ## Trigger an impact when a body shape enters the shield. 38 | @export var body_shape_entered_impact: bool = false 39 | 40 | ## Defines if the coordinates of the origin is relative to the object position 41 | @export var relative_impact_position: bool = false: 42 | set(value): 43 | if material: 44 | update_material("_relative_origin_impact", value) 45 | relative_impact_position = value 46 | 47 | # The current impact index, used to keep track of the impacts and overwrite the 48 | # oldest impact if the maximum number of impacts is reached. 49 | var _current_impact: int = 0 50 | 51 | # The current state of the impacts, if they are currently animating or not. 52 | var _animate: Array[bool] 53 | 54 | # The elapsed time of the impacts, used to calculate the current progress of the 55 | # impact animation. 56 | var _elapsed_time: Array[float] 57 | 58 | ## The origins, or the points of the impacts 59 | var _impact_origin: Array[Vector3] 60 | 61 | # The current progression of the shield generation, used to animate the process 62 | # of building up the shield, 0.0 is collapsed, 1.0 is fully generated. 63 | var _generate_time: float = 1.0 64 | 65 | # The current state of the shield, if it is collapsed or not. 66 | var _collapsed: bool = false 67 | 68 | # Defines if the shield is currently generating or collapsing, to prevent 69 | # multiple actions at the same time. 70 | var _generating_or_collapsing: bool = false 71 | 72 | ## The material used for the shield, to set the shader parameters. It is 73 | ## expected to be the specific energy shield shader. 74 | @onready var material: ShaderMaterial 75 | 76 | 77 | func _ready() -> void: 78 | # Initialize the arrays with the default values 79 | var filled_elapse_time = [0.0] 80 | filled_elapse_time.resize(_MAX_IMPACTS) 81 | filled_elapse_time.fill(0.0) 82 | _elapsed_time.assign(filled_elapse_time) 83 | var filled_animate = [false] 84 | filled_animate.resize(_MAX_IMPACTS) 85 | filled_animate.fill(false) 86 | _animate.assign(filled_animate) 87 | var filled_impact_origins = [Vector3.ZERO] 88 | filled_impact_origins.resize(_MAX_IMPACTS) 89 | filled_impact_origins.fill(Vector3.ZERO) 90 | _impact_origin.assign(filled_impact_origins) 91 | 92 | # Get the material and set the initial scale 93 | material = get_active_material(0) 94 | 95 | # Load web-optimized shader if running on web platform or compatibility mode 96 | var renderer = ProjectSettings.get_setting("rendering/renderer/rendering_method") 97 | if OS.has_feature("web") or renderer == "gl_compatibility": 98 | _load_web_shader() 99 | 100 | # Set the split front and back shader if enabled, copying all uniform 101 | # settings 102 | if not Engine.is_editor_hint() and split_front_back: 103 | if material.next_pass: 104 | var del_mat = material.next_pass 105 | material.next_pass = null 106 | set_surface_override_material(0, material.duplicate()) 107 | material = get_active_material(0) 108 | material.next_pass = material.duplicate() 109 | if OS.has_feature("web") or renderer == "gl_compatibility": 110 | var back_shader = load("res://addons/nojoule-energy-shield/shield_web_back.gdshader") 111 | material.shader = back_shader 112 | var front_shader = load("res://addons/nojoule-energy-shield/shield_web_front.gdshader") 113 | material.next_pass.shader = front_shader 114 | else: 115 | var back_shader = load("res://addons/nojoule-energy-shield/shield_back.gdshader") 116 | material.shader = back_shader 117 | var front_shader = load("res://addons/nojoule-energy-shield/shield_front.gdshader") 118 | material.next_pass.shader = front_shader 119 | 120 | update_material( 121 | "object_scale", 122 | max( 123 | global_transform.basis.get_scale().x, 124 | global_transform.basis.get_scale().y, 125 | global_transform.basis.get_scale().z 126 | ) 127 | ) 128 | 129 | # Connect the input event to the shield 130 | if handle_input_events and $Area3D: 131 | $Area3D.input_event.connect(_on_area_3d_input_event) 132 | 133 | # Connect relay signals for area 3d child 134 | if $Area3D: 135 | $Area3D.area_entered.connect(_on_area_3d_body_entered) 136 | $Area3D.body_shape_entered.connect(_on_area_3d_body_shape_entered) 137 | 138 | 139 | # Update the shader parameter [param name] with the [param value] and make sure 140 | # to update the front and back shader if split is enabled. 141 | func update_material(name: String, value: Variant) -> void: 142 | material.set_shader_parameter(name, value) 143 | if not Engine.is_editor_hint() and split_front_back: 144 | material.next_pass.set_shader_parameter(name, value) 145 | 146 | 147 | ## Generate the shield from the default origin, starting the generation 148 | ## animation. 149 | func generate() -> void: 150 | if _generating_or_collapsing or !_collapsed: 151 | return 152 | generate_from(shield_origin) 153 | 154 | 155 | ## Generate the shield from a specific position, starting the generation 156 | ## animation with [param pos] as the origin in world space. 157 | func generate_from(pos: Vector3) -> void: 158 | if _generating_or_collapsing or !_collapsed: 159 | return 160 | _generating_or_collapsing = true 161 | _generate_time = 0.0 162 | update_material("_collapse", false) 163 | update_material("_origin_generate", to_local(pos)) 164 | update_material("_time_generate", _generate_time) 165 | 166 | 167 | ## Collapse the shield from the default origin, starting the collapse 168 | ## animation. 169 | func collapse() -> void: 170 | if _generating_or_collapsing or _collapsed: 171 | return 172 | collapse_from(shield_origin) 173 | 174 | 175 | ## Collapse the shield from a specific position, starting the collapse 176 | ## animation with [param pos] as the origin in world space. 177 | func collapse_from(pos: Vector3) -> void: 178 | if _generating_or_collapsing or _collapsed: 179 | return 180 | _generating_or_collapsing = true 181 | _generate_time = 0.0 182 | update_material("_collapse", true) 183 | update_material("_origin_generate", to_local(pos)) 184 | update_material("_time_generate", _generate_time) 185 | 186 | 187 | ## Create an impact at the [param pos] position, starting a new impact 188 | ## animation. 189 | func impact(pos: Vector3): 190 | var impact_pos: Vector3 = pos 191 | if relative_impact_position: 192 | impact_pos = to_local(pos) 193 | 194 | # setup the next free impact, or overwrite the oldest impact 195 | _animate[_current_impact] = true 196 | _elapsed_time[_current_impact] = 0.0 197 | _impact_origin[_current_impact] = impact_pos 198 | 199 | # update the shader with the new impact origins 200 | update_material("_origin_impact", _impact_origin) 201 | update_material("_relative_origin_impact", relative_impact_position) 202 | 203 | # update the shader with the new impact times 204 | var time_impacts = [] 205 | for impact_id in _animate.size(): 206 | if _animate[impact_id]: 207 | if _elapsed_time[impact_id] < anim_time: 208 | var normalized_time = _elapsed_time[impact_id] / anim_time 209 | time_impacts.append(animation_curve.sample(normalized_time)) 210 | else: 211 | time_impacts.append(0.0) 212 | _elapsed_time[impact_id] = 0.0 213 | _animate[impact_id] = false 214 | else: 215 | time_impacts.append(0.0) 216 | update_material("_time_impact", time_impacts) 217 | 218 | # increment the current impact index 219 | _current_impact += 1 220 | _current_impact = _current_impact % _MAX_IMPACTS 221 | 222 | 223 | func _physics_process(delta: float) -> void: 224 | # update the shield generation or collapse animation 225 | if _generating_or_collapsing && _generate_time <= 1.0: 226 | _generate_time += delta 227 | update_material("_time_generate", _generate_time) 228 | else: 229 | if _generating_or_collapsing: 230 | _collapsed = !_collapsed 231 | _generating_or_collapsing = false 232 | 233 | # update the impact animations if active 234 | var any_update = false 235 | var time_impacts = [] 236 | for impact_id in _animate.size(): 237 | if _animate[impact_id]: 238 | any_update = true 239 | if _elapsed_time[impact_id] < anim_time: 240 | var normalized_time = _elapsed_time[impact_id] / anim_time 241 | time_impacts.append(animation_curve.sample(normalized_time)) 242 | _elapsed_time[impact_id] += delta 243 | else: 244 | time_impacts.append(0.0) 245 | _elapsed_time[impact_id] = 0.0 246 | _animate[impact_id] = false 247 | else: 248 | time_impacts.append(0.0) 249 | if any_update: 250 | update_material("_time_impact", time_impacts) 251 | 252 | var new_scale = max( 253 | global_transform.basis.get_scale().x, 254 | global_transform.basis.get_scale().y, 255 | global_transform.basis.get_scale().z 256 | ) 257 | update_material("_object_scale", new_scale) 258 | 259 | 260 | func _on_area_3d_input_event( 261 | _camera: Node, event: InputEvent, event_position: Vector3, _normal: Vector3, _shape_idx: int 262 | ) -> void: 263 | # event handling for mouse interaction with the shield 264 | if is_instance_of(event, InputEventMouseButton) and event.is_pressed(): 265 | var shift_pressed = Input.is_key_pressed(KEY_CTRL) 266 | var mouse_event: InputEventMouseButton = event 267 | if mouse_event.button_index == MOUSE_BUTTON_LEFT: 268 | if not shift_pressed: 269 | if not _collapsed: 270 | impact(event_position) 271 | else: 272 | if _collapsed: 273 | generate_from(event_position) 274 | else: 275 | collapse_from(event_position) 276 | 277 | 278 | func _on_area_3d_body_entered(body: Node3D) -> void: 279 | if body_entered_impact: 280 | impact(body.global_position) 281 | body_entered.emit(body) 282 | 283 | 284 | func _on_area_3d_body_shape_entered( 285 | body_rid: RID, body: Node3D, body_shape_index: int, local_shape_index: int 286 | ) -> void: 287 | if body_shape_entered_impact: 288 | impact(body.global_position) 289 | body_shape_entered.emit(body_rid, body, body_shape_index, local_shape_index) 290 | 291 | 292 | # Load web-optimized shader that defines WEB preprocessor directive 293 | func _load_web_shader() -> void: 294 | # Check if web shader exists, otherwise create it dynamically 295 | var web_shader_path = "res://addons/nojoule-energy-shield/shield_web.gdshader" 296 | if ResourceLoader.exists(web_shader_path): 297 | var web_shader = load(web_shader_path) 298 | material.shader = web_shader 299 | print("Loaded web-optimized shader") 300 | -------------------------------------------------------------------------------- /addons/nojoule-energy-shield/shield_base.gdshaderinc: -------------------------------------------------------------------------------- 1 | render_mode shadows_disabled, specular_disabled, 2 | ambient_light_disabled, unshaded 3 | 4 | #ifdef SHIELD_BACK 5 | ,cull_front 6 | #else 7 | #ifdef SHIELD_FRONT 8 | ,cull_back, depth_draw_opaque 9 | #else 10 | ,cull_disabled, depth_draw_opaque 11 | #endif 12 | #endif 13 | ; 14 | 15 | varying smooth vec3 world_pos; 16 | varying smooth float impact_offset; 17 | varying smooth float static_offset; 18 | varying flat vec3 origin_static_world; 19 | varying flat vec3 origin_generate_world; 20 | 21 | /** Maximum number of impacts, which can be used to generate impact ripples. */ 22 | const int max_impacts = 5; 23 | 24 | float easeInEaseOut(float t) { 25 | return t * t * 3.0 - 2.0 * t * t * t; 26 | } 27 | 28 | /** 29 | * Time is expected to be normalized between 0 and 1. Denormalize it to the actual time based on the frequency, desired waves and maximum distance. 30 | */ 31 | float denormalizeTime( 32 | float time, 33 | float frequency, 34 | float waves, 35 | float max_distance 36 | ) { 37 | float length = 0.5 * PI + 2.0 * PI * waves + max_distance * frequency; 38 | float wave_start_offset = 0.5 * PI; 39 | return (time * length - wave_start_offset) / frequency; 40 | } 41 | 42 | /** 43 | * Compute the offset for the vertex position from impacts. 44 | */ 45 | float computeImpactOffset( 46 | vec3 origin_offset, 47 | float radius, 48 | float frequency, 49 | float waves, 50 | float fade_waves, 51 | float amplitude, 52 | float time 53 | ) { 54 | float impact_distance = length(origin_offset); 55 | // the wave starts at -sin(-0.5 * PI) 56 | float wave_position = 57 | max((time - impact_distance) * frequency, - 0.5 * PI); 58 | 59 | float surface_offset = -sin(wave_position) * amplitude; 60 | 61 | // -sin(-0.5 * PI) is 1.0, but to start with an offset of 0 from the original vertex position, we modify the displacement for the first part of the wave to only displace inward. This prevents the mesh to be inflated by default. 62 | if (wave_position < 0.5 * PI) { 63 | surface_offset = surface_offset * 0.5 - 0.5 * amplitude; 64 | } 65 | 66 | // to have a smooth surface at the origin of the wave, we blend the surface offset near the origin 67 | if (impact_distance <= PI/frequency) { 68 | float wave_impact_position = (time) * frequency; 69 | float blend_surface_offset = -sin(wave_impact_position) * amplitude; 70 | if (wave_impact_position < 0.5 * PI) { 71 | blend_surface_offset = blend_surface_offset * 0.5 - 0.5 * amplitude; 72 | } 73 | float blend = easeInEaseOut( 74 | clamp(impact_distance / (PI/frequency), 0.0, 1.0)); 75 | surface_offset = mix(blend_surface_offset, surface_offset, blend); 76 | } 77 | 78 | // fade out the waves over time after the initial waves are through for the fade_waves 79 | float current_wave = wave_position / (2.0 * PI); 80 | float time_fade = 81 | 1.0 - smoothstep(waves, waves + fade_waves, current_wave); 82 | 83 | // fade out the waves over distance 84 | float distance_fade = smoothstep(radius, 0.0, impact_distance); 85 | 86 | return surface_offset * distance_fade * time_fade; 87 | } 88 | 89 | /** 90 | * Compute the offset for the vertex position from static waves. 91 | */ 92 | float computeStaticOffset( 93 | vec3 origin_offset, 94 | float radius, 95 | float frequency, 96 | float amplitude, 97 | float time 98 | ) { 99 | float impact_distance = length(origin_offset); 100 | float wave_position = (time - impact_distance) * frequency; 101 | float surface_offset = -sin(wave_position) * amplitude; 102 | 103 | // to have a smooth surface at the origin of the wave, we blend the surface offset near the origin 104 | if (impact_distance < PI/frequency) { 105 | float wave_impact_position = (time) * frequency; 106 | float blend_surface_offset = -sin(wave_impact_position) * amplitude; 107 | float blend = easeInEaseOut( 108 | clamp(impact_distance / (PI/frequency), 0.0, 1.0)); 109 | surface_offset = mix(blend_surface_offset, surface_offset, blend); 110 | } 111 | 112 | // fade out the waves over distance 113 | float distance_fade = smoothstep(radius, 0.0, impact_distance); 114 | 115 | return surface_offset * distance_fade; 116 | } 117 | 118 | /** 119 | * Compute the fresnel effect based on the normal and view direction. 120 | */ 121 | float computeFresnel(vec3 normal, vec3 view_dir, float intensity) { 122 | float fresnel = clamp(1.0 - dot(normal, view_dir), 0.0, 1.0); 123 | fresnel = pow(fresnel, intensity); 124 | return fresnel; 125 | } 126 | 127 | /** 128 | * Calculate the normal from the tangent of the wave. 129 | */ 130 | vec3 calculateNormalFromTangent(vec3 tangent) { 131 | vec3 binormal = vec3(0.0, 0.0, 1.0); // Assume z-axis binormal 132 | vec3 normal = cross(normalize(tangent), binormal); 133 | return normal; 134 | } 135 | 136 | /** 137 | * Calculate the slope at the current surface position on a sinus wave. 138 | */ 139 | float calculateSlope( 140 | float time, 141 | float amplitude, 142 | float frequency, 143 | float phase 144 | ) { 145 | return -cos(frequency * time + phase) * frequency * amplitude; 146 | } 147 | 148 | /** 149 | * Adjust the default normal based on the wave direction and current slope of the wave. 150 | */ 151 | vec3 adjustNormal( 152 | vec3 wave_direction, 153 | float wave_slope, 154 | vec3 orig_normal, 155 | bool backface 156 | ) { 157 | vec3 wave_tangent = vec3(1.0, wave_slope, 0.0); 158 | vec3 wave_normal = -calculateNormalFromTangent(wave_tangent); 159 | if (!backface) { 160 | wave_normal = vec3(-wave_normal.x, wave_normal.y, wave_normal.z); 161 | } 162 | vec3 binormal = normalize(cross(orig_normal, wave_direction)); 163 | vec3 surface_tangent = normalize(cross(orig_normal, binormal)); 164 | vec3 wave_adjusted_normal = 165 | normalize(wave_normal.x * surface_tangent + wave_normal.y * orig_normal); 166 | return wave_adjusted_normal; 167 | } 168 | 169 | /** 170 | * Adjust the normal based on the wave generated from an impact and check if the effect is active at the position based on the time. 171 | */ 172 | vec3 adjustImpactNormal( 173 | vec3 origin_offset, 174 | float radius, 175 | float frequency, 176 | float waves, 177 | float fade_waves, 178 | float amplitude, 179 | float time, 180 | vec3 normal, 181 | mat4 model_view, 182 | bool backface 183 | ) { 184 | float distance = length(origin_offset); 185 | float wave_phase = -distance * frequency; 186 | float current_wave_position = 187 | max((time - distance) * frequency, - 0.5 * PI); 188 | float current_wave_count = current_wave_position / (2.0 * PI); 189 | 190 | // check if all impact waves have passed the current fragment position 191 | if (current_wave_count < waves + fade_waves 192 | && (time - distance) * frequency >= - 0.5 * PI) { 193 | // fade out the waves over time after the initial waves are through for the fade_waves 194 | float time_fade = 195 | 1.0 - smoothstep(waves, waves + fade_waves, current_wave_count); 196 | // fade out the waves over distance 197 | float distance_fade = smoothstep(radius, 0.0, distance); 198 | 199 | // calculate direction and the slope of the wave at the current position 200 | vec3 wave_direction = normalize(-origin_offset); 201 | wave_direction = 202 | normalize((model_view * vec4(wave_direction, 0.0)).xyz); 203 | float wave_amplitude = amplitude * distance_fade * time_fade; 204 | float slope = calculateSlope(time, wave_amplitude, frequency, wave_phase); 205 | 206 | // to have a smooth surface at the origin of the wave, we blend the surface offset near the origin 207 | if (distance < PI/frequency) { 208 | float blend = easeInEaseOut( 209 | clamp(distance / (PI/frequency), 0.0, 1.0)); 210 | slope = mix(0.0, slope, blend); 211 | } 212 | 213 | return adjustNormal( 214 | wave_direction, 215 | slope, 216 | normal, 217 | backface 218 | ) * wave_amplitude * abs(slope); 219 | } 220 | return normal * 0.00001; 221 | } 222 | 223 | /** 224 | * Adjust the normal based on the wave generated from a static effect. 225 | */ 226 | vec3 adjustStaticNormal( 227 | vec3 origin_offset, 228 | float radius, 229 | float frequency, 230 | float amplitude, 231 | float time, 232 | vec3 normal, 233 | mat4 model_view, 234 | bool backface 235 | ) { 236 | float distance = length(origin_offset); 237 | 238 | // fade out the waves over distance 239 | float distance_fade = smoothstep(radius, 0.0, distance); 240 | 241 | // calculate direction and the slope of the wave at the current position 242 | float wave_phase = -distance * frequency; 243 | vec3 wave_direction = normalize(-origin_offset); 244 | wave_direction = normalize((model_view * vec4(wave_direction, 0.0)).xyz); 245 | float wave_amplitude = amplitude * distance_fade; 246 | float slope = calculateSlope(time, wave_amplitude, frequency, wave_phase); 247 | 248 | // to have a smooth surface at the origin of the wave, we blend the surface offset near the origin 249 | if (distance < PI/frequency) { 250 | float blend = easeInEaseOut( 251 | clamp(distance / (PI/frequency), 0.0, 1.0)); 252 | slope = mix(0.0, slope, blend); 253 | } 254 | 255 | return adjustNormal( 256 | wave_direction, 257 | slope, 258 | normal, 259 | backface 260 | ) * wave_amplitude * abs(slope); 261 | } 262 | 263 | float getAffectionStrengthStatic( 264 | vec3 origin_offset, 265 | float radius 266 | ) { 267 | float distance = length(origin_offset); 268 | return smoothstep(radius, 0.0, distance); 269 | } 270 | 271 | float getAffectionStrengthImpact( 272 | vec3 origin_offset, 273 | float radius, 274 | float frequency, 275 | float waves, 276 | float fade_waves, 277 | float time 278 | ) { 279 | float distance = length(origin_offset); 280 | float wave_phase = -distance * frequency; 281 | float current_wave_position = (time - distance) * frequency; 282 | float current_wave_count = current_wave_position / (2.0 * PI); 283 | 284 | float time_fade = 1.0 - clamp( 285 | (time - _start_falloff_visibility) / 286 | (1.0 - _start_falloff_visibility - _end_falloff_visibility), 287 | 0.0, 288 | 1.0 289 | ); 290 | float distance_fade = smoothstep(radius * _distance_multiplier_activation, 0.0, distance); 291 | 292 | float norm_distance = clamp(distance/radius, 0.0, 1.0); 293 | float activate_threshold = clamp(time * _time_multiplier_activation, 0.0, 1.0); 294 | 295 | if (activate_threshold < norm_distance) { 296 | return 0.0; 297 | } else if (activate_threshold - _width_time_activation < norm_distance) { 298 | float activation_fade = smoothstep(activate_threshold, activate_threshold - _width_time_activation, norm_distance); 299 | return easeInEaseOut(activation_fade) * distance_fade * time_fade; 300 | } else { 301 | return distance_fade * time_fade; 302 | } 303 | } 304 | 305 | #ifndef WEB 306 | /** 307 | * Compute the highlight effect, based on the distance to any object behind the shield-surface. 308 | */ 309 | float computeDepthDifference( 310 | vec2 screen_uv, 311 | vec3 vertex, 312 | mat4 inv_projection, 313 | float intensity, 314 | float width 315 | ) { 316 | // calculate a value representing the distance to any object behind the shield 317 | float depth_offset = width/_intensity_shield * _object_scale; 318 | float depth_tex = texture(depth_texture, screen_uv).r; 319 | vec4 proj_depth_pos = vec4(screen_uv * 2.0 - 1.0, depth_tex, 1.0); 320 | vec4 depth_world_pos = inv_projection * proj_depth_pos; 321 | depth_world_pos.xyz /= depth_world_pos.w; 322 | float depth_diff = clamp( 323 | smoothstep(depth_world_pos.z + depth_offset, depth_world_pos.z, vertex.z), 324 | 0.0, 325 | 1.0 326 | ); 327 | 328 | // apply intensity to the depth difference to create the highlight strength 329 | depth_diff = pow(depth_diff, intensity); 330 | return depth_diff; 331 | } 332 | #endif 333 | 334 | /** 335 | * Compute the progression of the shield generation or collapse, normalized between 0.0 and 1.0, based on the distance to the origin and the time. 336 | */ 337 | float computeGenerationProgress( 338 | vec3 vertex, 339 | vec3 origin, 340 | float thickness, 341 | float size, 342 | float time 343 | ) { 344 | float impact_distance = length(origin - vertex); 345 | return clamp(((time * (1.0 + thickness)) * size - impact_distance) / (thickness * size), 0.0, 1.0); 346 | } 347 | 348 | void vertex() { 349 | // world_position of the vertex 350 | world_pos = (MODEL_MATRIX * vec4(VERTEX, 1.0)).xyz; 351 | 352 | // calculate the vertex displacement from dynamic impact effects 353 | impact_offset = 0.0; 354 | for(int i=0;i 0.0 && _time_impact[i] < 1.0) { 366 | float denormalized_time = denormalizeTime( 367 | _time_impact[i], 368 | _frequency_impact, 369 | _waves_impact + _fade_waves_impact, 370 | _radius_impact 371 | ); 372 | 373 | impact_offset += computeImpactOffset( 374 | origin_impact_offset, 375 | _radius_impact, 376 | _frequency_impact, 377 | _waves_impact, 378 | _fade_waves_impact, 379 | _amplitude_impact, 380 | denormalized_time 381 | ); 382 | } 383 | } 384 | 385 | // calculate the vertex displacement from the static wave effect 386 | if (_active_static) { 387 | 388 | // transform the static origin to world space 389 | if (_relative_origin_static) { 390 | origin_static_world = (MODEL_MATRIX * vec4(_origin_static, 1.0)).xyz; 391 | } else { 392 | origin_static_world = _origin_static; 393 | } 394 | vec3 origin_static_offset = (origin_static_world - world_pos); 395 | if (_relative_origin_static) { 396 | origin_static_offset = origin_static_offset / _object_scale; 397 | } 398 | static_offset = computeStaticOffset( 399 | origin_static_offset, 400 | _effect_radius_static, 401 | _frequency_static, 402 | _amplitude_static, 403 | TIME * _speed_static 404 | ); 405 | } else { 406 | static_offset = 0.0; 407 | } 408 | 409 | // transform the generation origin to world space 410 | if (true) { 411 | origin_generate_world = (MODEL_MATRIX * vec4(_origin_generate, 1.0)).xyz; 412 | } else { 413 | origin_generate_world = _origin_generate; 414 | } 415 | 416 | VERTEX += NORMAL * (impact_offset + static_offset); 417 | } 418 | 419 | void fragment() { 420 | // discard backfacing fragments when the debug option for showing normals is active 421 | //if (_show_normals && !FRONT_FACING) discard; 422 | 423 | float effect_visibility = 0.0; 424 | 425 | // calculate the modified normal based on static wave traveling across the shield surface 426 | vec3 static_normal = vec3(0.0); 427 | if (_active_static) { 428 | vec3 origin_static_offset = (origin_static_world - world_pos); 429 | if (_relative_origin_static) { 430 | origin_static_offset = origin_static_offset / _object_scale; 431 | } 432 | static_normal = adjustStaticNormal( 433 | origin_static_offset, 434 | _effect_radius_static, 435 | _frequency_static, 436 | _normal_amplitude_static, 437 | TIME * _speed_static, 438 | NORMAL, 439 | VIEW_MATRIX, 440 | FRONT_FACING 441 | ); 442 | if (_only_on_wave_visibility) { 443 | float static_affection = getAffectionStrengthStatic( 444 | origin_static_offset, 445 | _effect_radius_static 446 | ); 447 | effect_visibility = max(effect_visibility, static_affection); 448 | } 449 | } 450 | 451 | // calculate the modified normal based on impact waves traveling across the shield surface 452 | vec3 impact_normal = vec3(0.0); 453 | for(int i=0;i 0.0 && _time_impact[i] < 1.0) { 463 | float denormalized_time = denormalizeTime( 464 | _time_impact[i], 465 | _frequency_impact, 466 | _waves_impact + _fade_waves_impact, 467 | _radius_impact 468 | ); 469 | 470 | impact_normal += adjustImpactNormal( 471 | origin_impact_offset, 472 | _radius_impact, 473 | _frequency_impact, 474 | _waves_impact, 475 | _fade_waves_impact, 476 | _normal_amplitude_impact, 477 | denormalized_time, 478 | NORMAL, 479 | VIEW_MATRIX, 480 | FRONT_FACING 481 | ); 482 | if (_only_on_wave_visibility) { 483 | float impact_affection = getAffectionStrengthImpact( 484 | origin_impact_offset, 485 | _radius_impact, 486 | _frequency_impact, 487 | _waves_impact, 488 | _fade_waves_impact, 489 | _time_impact[i] 490 | ); 491 | effect_visibility = max(effect_visibility, impact_affection); 492 | } 493 | } 494 | } 495 | 496 | // combine the normals and normalize the result, this is the new surface normal at this fragment 497 | vec3 new_normal = normalize(static_normal + impact_normal + 0.001 * NORMAL); 498 | NORMAL = new_normal; 499 | 500 | // calculate the shield visibility, which determines the color and transparency of the shield. 501 | float shield_visibility = 0.0; 502 | 503 | shield_visibility = computeFresnel(NORMAL, VIEW, _intensity_shield); 504 | 505 | // apply surface displacement highlight for impacts 506 | if (_active_impact_offset_hl) { 507 | float impact_offset_hl = pow( 508 | -_strength_impact_offset_hl * impact_offset/_amplitude_impact, 509 | _intensity_impact_offset_hl 510 | ); 511 | shield_visibility = max(shield_visibility, impact_offset_hl); 512 | } 513 | 514 | // apply surface displacement highlight for static waves 515 | if (_active_static_offset_hl) { 516 | float static_offset_hl = pow( 517 | -_strength_static_offset_hl * static_offset/_amplitude_static, 518 | _intensity_static_offset_hl 519 | ); 520 | shield_visibility = max(shield_visibility, static_offset_hl); 521 | } 522 | 523 | #ifndef WEB 524 | if (_enable_highlight_intersection) { 525 | // apply depth difference highlight for objects behind the shield 526 | float depth_diff = computeDepthDifference( 527 | SCREEN_UV, 528 | VERTEX, 529 | INV_PROJECTION_MATRIX, 530 | _intensity_shield, 531 | _width_highlight_intersection 532 | ); 533 | shield_visibility = max(shield_visibility, depth_diff); 534 | } 535 | #endif 536 | 537 | // apply border highlighting 538 | if (_active_border) { 539 | float border_closeness = min( 540 | min(UV.x, UV.y), 541 | min(1.0 - UV.x, 1.0 - UV.y) 542 | ); 543 | float border_visibility = clamp( 544 | _percentage_border - border_closeness * 2.0, 545 | 0.0, 546 | _percentage_border 547 | ) / _percentage_border; 548 | border_visibility = pow(border_visibility, _intensity_border); 549 | shield_visibility = max(shield_visibility, border_visibility); 550 | } 551 | 552 | // apply shield generation or collapse animation highlight 553 | float creation_progress = computeGenerationProgress( 554 | world_pos, 555 | origin_generate_world, 556 | _thickness_generate, 557 | _object_scale * _object_size, 558 | _time_generate 559 | //mod(TIME, 1.0 / _object_scale) //see the effect looping 560 | ); 561 | if (_collapse) { 562 | if (creation_progress >= 1.0) { 563 | shield_visibility = 0.0; 564 | } else { 565 | float creation_visibility = pow(creation_progress, 5.0); 566 | shield_visibility = max(shield_visibility, creation_visibility); 567 | } 568 | } else { 569 | if (creation_progress <= 0.0) { 570 | shield_visibility = 0.0; 571 | } else { 572 | float creation_visibility = pow(1.0 - creation_progress, 5.0); 573 | shield_visibility = max(shield_visibility, creation_visibility); 574 | } 575 | } 576 | 577 | // modify value by noise texture to the shield visibility 578 | shield_visibility = shield_visibility * (texture( 579 | _noise_texture, 580 | vec2(UV.x + TIME * _speed_noise.x, UV.y - TIME * _speed_noise.y) 581 | ).r + 0.5); 582 | 583 | // apply quantization for the value 584 | if (_quantization) { 585 | float quantization_offset = 1.0; 586 | shield_visibility = round(shield_visibility * ( 587 | float(_steps_quantization) + quantization_offset)) 588 | / float(_steps_quantization); 589 | } 590 | 591 | if (_show_normals) { 592 | ALBEDO = vec3( 593 | (NORMAL.x + 1.0)/2.0, 594 | (NORMAL.y + 1.0)/2.0, 595 | (NORMAL.z + 1.0)/2.0 596 | ); 597 | ALPHA = 1.0; 598 | } else { 599 | vec3 color = pow(shield_visibility, _intensity_shield) 600 | * _color_brightness_shield * _color_shield; 601 | vec3 clamped_color = vec3( 602 | clamp(color.r, 0.0, 1.0), 603 | clamp(color.g, 0.0, 1.0), 604 | clamp(color.b, 0.0, 1.0) 605 | ); 606 | 607 | if (glow_enabled) { 608 | ALBEDO = clamped_color + glow_strength * (color - clamped_color); 609 | } else { 610 | ALBEDO = clamped_color; 611 | } 612 | if (!_only_on_wave_visibility) effect_visibility = 1.0; 613 | else effect_visibility = mix( 614 | 0.0, 1.0, easeInEaseOut(effect_visibility)); 615 | ALPHA = clamp(shield_visibility, 0.0, 1.0) * effect_visibility; 616 | } 617 | } 618 | -------------------------------------------------------------------------------- /addons/nojoule-energy-shield/examples.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=58 format=3 uid="uid://b687koijwjkt4"] 2 | 3 | [ext_resource type="Script" uid="uid://f1263sbcv8qy" path="res://addons/nojoule-energy-shield/camera_movement.gd" id="1_1ksrw"] 4 | [ext_resource type="PackedScene" uid="uid://bvqb5fugcfm5k" path="res://addons/nojoule-energy-shield/shield_plane.tscn" id="1_uycqw"] 5 | [ext_resource type="Shader" uid="uid://dcko35tc4k343" path="res://addons/nojoule-energy-shield/shield.gdshader" id="2_u8gy5"] 6 | [ext_resource type="PackedScene" uid="uid://bqo3es5yd4r70" path="res://addons/nojoule-energy-shield/shield_sphere.tscn" id="3_twgkm"] 7 | [ext_resource type="Texture2D" uid="uid://dnqegf8mxqli" path="res://addons/nojoule-energy-shield/shield_noise.tres" id="4_cgev7"] 8 | 9 | [sub_resource type="Environment" id="Environment_nl0ma"] 10 | background_mode = 1 11 | background_color = Color(0.0863636, 0.0863636, 0.0863636, 1) 12 | ambient_light_source = 2 13 | ambient_light_color = Color(0.2, 0.2, 0.2, 1) 14 | glow_enabled = true 15 | glow_mix = 0.01 16 | glow_blend_mode = 4 17 | 18 | [sub_resource type="GDScript" id="GDScript_mlkug"] 19 | script/source = "@tool 20 | extends Node3D 21 | 22 | var rotation_speed: float = 45.0 23 | 24 | @onready var plane: MeshInstance3D = $ShieldPlane 25 | 26 | func _process(delta: float) -> void: 27 | plane.rotate(Vector3.UP, deg_to_rad(rotation_speed * delta)) 28 | " 29 | 30 | [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_wy7so"] 31 | albedo_color = Color(0.4, 0.4, 0.4, 1) 32 | 33 | [sub_resource type="QuadMesh" id="QuadMesh_f5biq"] 34 | material = SubResource("StandardMaterial3D_wy7so") 35 | size = Vector2(4, 1) 36 | orientation = 1 37 | 38 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_trfil"] 39 | render_priority = 0 40 | shader = ExtResource("2_u8gy5") 41 | shader_parameter/_quantization = true 42 | shader_parameter/_steps_quantization = 5 43 | shader_parameter/_object_scale = 1.0 44 | shader_parameter/_object_size = 1.8 45 | shader_parameter/_only_on_wave_visibility = false 46 | shader_parameter/_start_falloff_visibility = 0.5 47 | shader_parameter/_end_falloff_visibility = 0.3 48 | shader_parameter/_time_multiplier_activation = 1.0 49 | shader_parameter/_distance_multiplier_activation = 1.0 50 | shader_parameter/_width_time_activation = 1.0 51 | shader_parameter/_enable_highlight_intersection = true 52 | shader_parameter/_width_highlight_intersection = 1.0 53 | shader_parameter/_noise_texture = ExtResource("4_cgev7") 54 | shader_parameter/_speed_noise = Vector2(0.02, 0.02) 55 | shader_parameter/_origin_generate = Vector3(0, 0.5, 0) 56 | shader_parameter/_relative_origin_generate = true 57 | shader_parameter/_time_generate = 1.0 58 | shader_parameter/_thickness_generate = 0.25 59 | shader_parameter/_collapse = false 60 | shader_parameter/_color_shield = Color(0.26, 0.975, 1, 1) 61 | shader_parameter/_color_brightness_shield = 15.0 62 | shader_parameter/_intensity_shield = 2.5 63 | shader_parameter/glow_enabled = true 64 | shader_parameter/glow_strength = 1.0 65 | shader_parameter/_active_static = false 66 | shader_parameter/_origin_static = Vector3(0, 0.5, 0) 67 | shader_parameter/_speed_static = 0.1 68 | shader_parameter/_frequency_static = 80.0 69 | shader_parameter/_amplitude_static = 0.002 70 | shader_parameter/_normal_amplitude_static = 0.002 71 | shader_parameter/_effect_radius_static = 1.2 72 | shader_parameter/_active_static_offset_hl = true 73 | shader_parameter/_strength_static_offset_hl = 1.0 74 | shader_parameter/_intensity_static_offset_hl = 5.0 75 | shader_parameter/_origin_impact = PackedVector3Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) 76 | shader_parameter/_time_impact = PackedFloat32Array(0, 0, 0, 0, 0) 77 | shader_parameter/_frequency_impact = 20.0 78 | shader_parameter/_waves_impact = 0.0 79 | shader_parameter/_fade_waves_impact = 2.0 80 | shader_parameter/_amplitude_impact = 0.02 81 | shader_parameter/_normal_amplitude_impact = 0.05 82 | shader_parameter/_radius_impact = 1.0 83 | shader_parameter/_active_impact_offset_hl = true 84 | shader_parameter/_strength_impact_offset_hl = 1.0 85 | shader_parameter/_intensity_impact_offset_hl = 5.0 86 | shader_parameter/_active_border = true 87 | shader_parameter/_intensity_border = 2.0 88 | shader_parameter/_percentage_border = 0.2 89 | shader_parameter/_show_normals = false 90 | 91 | [sub_resource type="PlaneMesh" id="PlaneMesh_e83g8"] 92 | resource_local_to_scene = true 93 | material = SubResource("ShaderMaterial_trfil") 94 | size = Vector2(1, 1) 95 | subdivide_width = 128 96 | subdivide_depth = 128 97 | 98 | [sub_resource type="Curve" id="Curve_cwp47"] 99 | resource_local_to_scene = true 100 | resource_name = "animation_curve" 101 | _data = [Vector2(0, 0), 0.0, 2.60088, 0, 0, Vector2(0.996183, 1), 0.0, 0.0, 0, 0] 102 | point_count = 2 103 | 104 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_cq5mx"] 105 | render_priority = 0 106 | shader = ExtResource("2_u8gy5") 107 | shader_parameter/_quantization = true 108 | shader_parameter/_steps_quantization = 5 109 | shader_parameter/_object_scale = 1.0 110 | shader_parameter/_object_size = 1.0 111 | shader_parameter/_only_on_wave_visibility = false 112 | shader_parameter/_start_falloff_visibility = 0.5 113 | shader_parameter/_end_falloff_visibility = 0.3 114 | shader_parameter/_time_multiplier_activation = 1.0 115 | shader_parameter/_distance_multiplier_activation = 1.0 116 | shader_parameter/_width_time_activation = 1.0 117 | shader_parameter/_enable_highlight_intersection = true 118 | shader_parameter/_width_highlight_intersection = 1.0 119 | shader_parameter/_noise_texture = ExtResource("4_cgev7") 120 | shader_parameter/_speed_noise = Vector2(0.02, 0.02) 121 | shader_parameter/_origin_generate = Vector3(0, 0.5, 0) 122 | shader_parameter/_relative_origin_generate = true 123 | shader_parameter/_time_generate = 1.0 124 | shader_parameter/_thickness_generate = 0.25 125 | shader_parameter/_collapse = false 126 | shader_parameter/_color_shield = Color(0.26, 0.975, 1, 1) 127 | shader_parameter/_color_brightness_shield = 15.0 128 | shader_parameter/_intensity_shield = 2.5 129 | shader_parameter/glow_enabled = true 130 | shader_parameter/glow_strength = 1.0 131 | shader_parameter/_active_static = false 132 | shader_parameter/_origin_static = Vector3(0, 0.5, 0) 133 | shader_parameter/_speed_static = 0.1 134 | shader_parameter/_frequency_static = 80.0 135 | shader_parameter/_amplitude_static = 0.002 136 | shader_parameter/_normal_amplitude_static = 0.002 137 | shader_parameter/_effect_radius_static = 1.2 138 | shader_parameter/_active_static_offset_hl = true 139 | shader_parameter/_strength_static_offset_hl = 1.0 140 | shader_parameter/_intensity_static_offset_hl = 5.0 141 | shader_parameter/_origin_impact = PackedVector3Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) 142 | shader_parameter/_time_impact = PackedFloat32Array(0, 0, 0, 0, 0) 143 | shader_parameter/_frequency_impact = 20.0 144 | shader_parameter/_waves_impact = 0.0 145 | shader_parameter/_fade_waves_impact = 2.0 146 | shader_parameter/_amplitude_impact = 0.02 147 | shader_parameter/_normal_amplitude_impact = 0.05 148 | shader_parameter/_radius_impact = 1.0 149 | shader_parameter/_active_impact_offset_hl = true 150 | shader_parameter/_strength_impact_offset_hl = 1.0 151 | shader_parameter/_intensity_impact_offset_hl = 5.0 152 | shader_parameter/_active_border = false 153 | shader_parameter/_intensity_border = 2.0 154 | shader_parameter/_percentage_border = 0.1 155 | shader_parameter/_show_normals = false 156 | 157 | [sub_resource type="SphereMesh" id="SphereMesh_jhkwg"] 158 | resource_local_to_scene = true 159 | material = SubResource("ShaderMaterial_cq5mx") 160 | radial_segments = 256 161 | rings = 256 162 | 163 | [sub_resource type="Curve" id="Curve_8n046"] 164 | resource_local_to_scene = true 165 | resource_name = "animation_curve" 166 | _data = [Vector2(0, 0), 0.0, 2.60088, 0, 0, Vector2(0.996183, 1), 0.0, 0.0, 0, 0] 167 | point_count = 2 168 | 169 | [sub_resource type="GDScript" id="GDScript_1dyov"] 170 | script/source = "@tool 171 | extends Node3D 172 | 173 | var rotation_speed: float = 45.0 174 | var rainbow_speed: float = 0.2 175 | var hue: float = 0.0 176 | 177 | @onready var sphere: MeshInstance3D = $ShieldSphere 178 | @onready var plane: MeshInstance3D = $ShieldPlane 179 | 180 | func _process(delta: float): 181 | plane.rotate(Vector3.UP, deg_to_rad(rotation_speed * delta)) 182 | hue += rainbow_speed * delta 183 | hue = wrapf(hue, 0.0, 1.4) 184 | var brightness = 1.0 185 | var saturation = 0.7 186 | if hue > 1.0: 187 | brightness = clamp(1.0 - (hue - 1.0) * 10.0, 0.0, 1.0) 188 | if hue > 1.2: 189 | brightness = clamp((hue - 1.2) * 10.0, 0.0, 1.0) 190 | saturation = 0.0 191 | if hue > 1.3: 192 | saturation = clamp((hue - 1.3) * 10.0, 0.0, 1.0) 193 | 194 | var color = Color.from_hsv(clamp(hue, 0.0, 1.0), saturation, brightness) 195 | if Engine.is_editor_hint(): 196 | sphere.get_active_material(0).set_shader_parameter(\"_color_shield\", color) 197 | else: 198 | sphere.update_material(\"_color_shield\", color) 199 | color = Color.from_hsv(1.0 - clamp(hue, 0.0, 1.0), saturation, brightness) 200 | if Engine.is_editor_hint(): 201 | plane.get_active_material(0).set_shader_parameter(\"_color_shield\", color) 202 | else: 203 | plane.update_material(\"_color_shield\", color) 204 | " 205 | 206 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_3q470"] 207 | render_priority = 0 208 | shader = ExtResource("2_u8gy5") 209 | shader_parameter/_quantization = true 210 | shader_parameter/_steps_quantization = 5 211 | shader_parameter/_object_scale = 1.0 212 | shader_parameter/_object_size = 1.0 213 | shader_parameter/_only_on_wave_visibility = false 214 | shader_parameter/_start_falloff_visibility = 0.5 215 | shader_parameter/_end_falloff_visibility = 0.3 216 | shader_parameter/_time_multiplier_activation = 1.0 217 | shader_parameter/_distance_multiplier_activation = 1.0 218 | shader_parameter/_width_time_activation = 1.0 219 | shader_parameter/_enable_highlight_intersection = true 220 | shader_parameter/_width_highlight_intersection = 1.0 221 | shader_parameter/_noise_texture = ExtResource("4_cgev7") 222 | shader_parameter/_speed_noise = Vector2(0.02, 0.02) 223 | shader_parameter/_origin_generate = Vector3(0, 0.5, 0) 224 | shader_parameter/_relative_origin_generate = true 225 | shader_parameter/_time_generate = 1.0 226 | shader_parameter/_thickness_generate = 0.25 227 | shader_parameter/_collapse = false 228 | shader_parameter/_color_shield = Color(0.3, 1, 0.6397878, 1) 229 | shader_parameter/_color_brightness_shield = 15.0 230 | shader_parameter/_intensity_shield = 2.5 231 | shader_parameter/glow_enabled = true 232 | shader_parameter/glow_strength = 1.0 233 | shader_parameter/_active_static = false 234 | shader_parameter/_origin_static = Vector3(0, 0.5, 0) 235 | shader_parameter/_speed_static = 0.1 236 | shader_parameter/_frequency_static = 80.0 237 | shader_parameter/_amplitude_static = 0.002 238 | shader_parameter/_normal_amplitude_static = 0.002 239 | shader_parameter/_effect_radius_static = 1.2 240 | shader_parameter/_active_static_offset_hl = true 241 | shader_parameter/_strength_static_offset_hl = 1.0 242 | shader_parameter/_intensity_static_offset_hl = 5.0 243 | shader_parameter/_origin_impact = PackedVector3Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) 244 | shader_parameter/_time_impact = PackedFloat32Array(0, 0, 0, 0, 0) 245 | shader_parameter/_frequency_impact = 20.0 246 | shader_parameter/_waves_impact = 0.0 247 | shader_parameter/_fade_waves_impact = 2.0 248 | shader_parameter/_amplitude_impact = 0.02 249 | shader_parameter/_normal_amplitude_impact = 0.05 250 | shader_parameter/_radius_impact = 1.0 251 | shader_parameter/_active_impact_offset_hl = true 252 | shader_parameter/_strength_impact_offset_hl = 1.0 253 | shader_parameter/_intensity_impact_offset_hl = 5.0 254 | shader_parameter/_active_border = false 255 | shader_parameter/_intensity_border = 2.0 256 | shader_parameter/_percentage_border = 0.1 257 | shader_parameter/_show_normals = false 258 | 259 | [sub_resource type="SphereMesh" id="SphereMesh_q2ark"] 260 | resource_local_to_scene = true 261 | material = SubResource("ShaderMaterial_3q470") 262 | radial_segments = 256 263 | rings = 256 264 | 265 | [sub_resource type="Curve" id="Curve_ibf8e"] 266 | resource_local_to_scene = true 267 | resource_name = "animation_curve" 268 | _data = [Vector2(0, 0), 0.0, 2.60088, 0, 0, Vector2(0.996183, 1), 0.0, 0.0, 0, 0] 269 | point_count = 2 270 | 271 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_84whp"] 272 | render_priority = 0 273 | shader = ExtResource("2_u8gy5") 274 | shader_parameter/_quantization = true 275 | shader_parameter/_steps_quantization = 5 276 | shader_parameter/_object_scale = 1.0 277 | shader_parameter/_object_size = 1.42 278 | shader_parameter/_only_on_wave_visibility = false 279 | shader_parameter/_start_falloff_visibility = 0.5 280 | shader_parameter/_end_falloff_visibility = 0.3 281 | shader_parameter/_time_multiplier_activation = 1.0 282 | shader_parameter/_distance_multiplier_activation = 1.0 283 | shader_parameter/_width_time_activation = 1.0 284 | shader_parameter/_enable_highlight_intersection = true 285 | shader_parameter/_width_highlight_intersection = 1.0 286 | shader_parameter/_noise_texture = ExtResource("4_cgev7") 287 | shader_parameter/_speed_noise = Vector2(0.02, 0.02) 288 | shader_parameter/_origin_generate = Vector3(0, 0.5, 0) 289 | shader_parameter/_relative_origin_generate = true 290 | shader_parameter/_time_generate = 1.0 291 | shader_parameter/_thickness_generate = 0.25 292 | shader_parameter/_collapse = false 293 | shader_parameter/_color_shield = Color(0.3, 0.6397878, 1, 1) 294 | shader_parameter/_color_brightness_shield = 15.0 295 | shader_parameter/_intensity_shield = 2.5 296 | shader_parameter/glow_enabled = true 297 | shader_parameter/glow_strength = 1.0 298 | shader_parameter/_active_static = false 299 | shader_parameter/_origin_static = Vector3(0, 0, 0) 300 | shader_parameter/_speed_static = 0.1 301 | shader_parameter/_frequency_static = 80.0 302 | shader_parameter/_amplitude_static = 0.002 303 | shader_parameter/_normal_amplitude_static = 0.002 304 | shader_parameter/_effect_radius_static = 1.2 305 | shader_parameter/_active_static_offset_hl = true 306 | shader_parameter/_strength_static_offset_hl = 1.0 307 | shader_parameter/_intensity_static_offset_hl = 5.0 308 | shader_parameter/_origin_impact = PackedVector3Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) 309 | shader_parameter/_time_impact = PackedFloat32Array(0, 0, 0, 0, 0) 310 | shader_parameter/_frequency_impact = 20.0 311 | shader_parameter/_waves_impact = 0.0 312 | shader_parameter/_fade_waves_impact = 2.0 313 | shader_parameter/_amplitude_impact = 0.02 314 | shader_parameter/_normal_amplitude_impact = 0.05 315 | shader_parameter/_radius_impact = 1.0 316 | shader_parameter/_active_impact_offset_hl = true 317 | shader_parameter/_strength_impact_offset_hl = 1.0 318 | shader_parameter/_intensity_impact_offset_hl = 5.0 319 | shader_parameter/_active_border = true 320 | shader_parameter/_intensity_border = 2.0 321 | shader_parameter/_percentage_border = 0.2 322 | shader_parameter/_show_normals = false 323 | 324 | [sub_resource type="PlaneMesh" id="PlaneMesh_tb5o1"] 325 | resource_local_to_scene = true 326 | material = SubResource("ShaderMaterial_84whp") 327 | size = Vector2(1, 1) 328 | subdivide_width = 128 329 | subdivide_depth = 128 330 | 331 | [sub_resource type="Curve" id="Curve_u31ny"] 332 | resource_local_to_scene = true 333 | resource_name = "animation_curve" 334 | _data = [Vector2(0, 0), 0.0, 2.60088, 0, 0, Vector2(0.996183, 1), 0.0, 0.0, 0, 0] 335 | point_count = 2 336 | 337 | [sub_resource type="GDScript" id="GDScript_r2b7w"] 338 | script/source = "@tool 339 | extends Node3D 340 | 341 | var rotation_speed: float = 45.0 342 | 343 | var amplitude: float = 0.5 344 | var frequency: float = 0.2 345 | var time_passed: float = 0.0 346 | var initial_position: Vector3 = Vector3(0.75, 0.6, 0.0) 347 | 348 | @onready var sphere: MeshInstance3D = $ShieldSphere 349 | @onready var plane: MeshInstance3D = $ShieldPlane 350 | @onready var moving_box: MeshInstance3D = $EnvironmentMovingPlatform 351 | 352 | func _process(delta: float): 353 | if moving_box: 354 | time_passed += delta 355 | var y_offset = amplitude * sin(time_passed * frequency * TAU) 356 | moving_box.transform.origin = initial_position + Vector3(0, y_offset, 0) 357 | 358 | plane.rotate(Vector3.UP, deg_to_rad(rotation_speed * delta)) 359 | " 360 | 361 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_mpt4m"] 362 | render_priority = 0 363 | shader = ExtResource("2_u8gy5") 364 | shader_parameter/_quantization = true 365 | shader_parameter/_steps_quantization = 5 366 | shader_parameter/_object_scale = 1.0 367 | shader_parameter/_object_size = 1.0 368 | shader_parameter/_only_on_wave_visibility = false 369 | shader_parameter/_start_falloff_visibility = 0.5 370 | shader_parameter/_end_falloff_visibility = 0.3 371 | shader_parameter/_time_multiplier_activation = 1.0 372 | shader_parameter/_distance_multiplier_activation = 1.0 373 | shader_parameter/_width_time_activation = 1.0 374 | shader_parameter/_enable_highlight_intersection = true 375 | shader_parameter/_width_highlight_intersection = 1.0 376 | shader_parameter/_noise_texture = ExtResource("4_cgev7") 377 | shader_parameter/_speed_noise = Vector2(0.02, 0.02) 378 | shader_parameter/_origin_generate = Vector3(0, 0.5, 0) 379 | shader_parameter/_relative_origin_generate = true 380 | shader_parameter/_time_generate = 1.0 381 | shader_parameter/_thickness_generate = 0.25 382 | shader_parameter/_collapse = false 383 | shader_parameter/_color_shield = Color(0.26, 0.975, 1, 1) 384 | shader_parameter/_color_brightness_shield = 15.0 385 | shader_parameter/_intensity_shield = 2.5 386 | shader_parameter/glow_enabled = true 387 | shader_parameter/glow_strength = 1.0 388 | shader_parameter/_active_static = false 389 | shader_parameter/_origin_static = Vector3(0, 0.5, 0) 390 | shader_parameter/_speed_static = 0.1 391 | shader_parameter/_frequency_static = 80.0 392 | shader_parameter/_amplitude_static = 0.002 393 | shader_parameter/_normal_amplitude_static = 0.002 394 | shader_parameter/_effect_radius_static = 1.2 395 | shader_parameter/_active_static_offset_hl = true 396 | shader_parameter/_strength_static_offset_hl = 1.0 397 | shader_parameter/_intensity_static_offset_hl = 5.0 398 | shader_parameter/_origin_impact = PackedVector3Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) 399 | shader_parameter/_time_impact = PackedFloat32Array(0, 0, 0, 0, 0) 400 | shader_parameter/_frequency_impact = 20.0 401 | shader_parameter/_waves_impact = 0.0 402 | shader_parameter/_fade_waves_impact = 2.0 403 | shader_parameter/_amplitude_impact = 0.02 404 | shader_parameter/_normal_amplitude_impact = 0.05 405 | shader_parameter/_radius_impact = 1.0 406 | shader_parameter/_active_impact_offset_hl = true 407 | shader_parameter/_strength_impact_offset_hl = 1.0 408 | shader_parameter/_intensity_impact_offset_hl = 5.0 409 | shader_parameter/_active_border = false 410 | shader_parameter/_intensity_border = 2.0 411 | shader_parameter/_percentage_border = 0.1 412 | shader_parameter/_show_normals = false 413 | 414 | [sub_resource type="SphereMesh" id="SphereMesh_bycw3"] 415 | resource_local_to_scene = true 416 | material = SubResource("ShaderMaterial_mpt4m") 417 | radial_segments = 256 418 | rings = 256 419 | 420 | [sub_resource type="Curve" id="Curve_t2u8o"] 421 | resource_local_to_scene = true 422 | resource_name = "animation_curve" 423 | _data = [Vector2(0, 0), 0.0, 2.60088, 0, 0, Vector2(0.996183, 1), 0.0, 0.0, 0, 0] 424 | point_count = 2 425 | 426 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_64ak4"] 427 | render_priority = 0 428 | shader = ExtResource("2_u8gy5") 429 | shader_parameter/_quantization = true 430 | shader_parameter/_steps_quantization = 5 431 | shader_parameter/_object_scale = 1.0 432 | shader_parameter/_object_size = 1.8 433 | shader_parameter/_only_on_wave_visibility = false 434 | shader_parameter/_start_falloff_visibility = 0.5 435 | shader_parameter/_end_falloff_visibility = 0.3 436 | shader_parameter/_time_multiplier_activation = 1.0 437 | shader_parameter/_distance_multiplier_activation = 1.0 438 | shader_parameter/_width_time_activation = 1.0 439 | shader_parameter/_enable_highlight_intersection = true 440 | shader_parameter/_width_highlight_intersection = 1.0 441 | shader_parameter/_noise_texture = ExtResource("4_cgev7") 442 | shader_parameter/_speed_noise = Vector2(0.02, 0.02) 443 | shader_parameter/_origin_generate = Vector3(0, 0.5, 0) 444 | shader_parameter/_relative_origin_generate = true 445 | shader_parameter/_time_generate = 1.0 446 | shader_parameter/_thickness_generate = 0.25 447 | shader_parameter/_collapse = false 448 | shader_parameter/_color_shield = Color(0.26, 0.975, 1, 1) 449 | shader_parameter/_color_brightness_shield = 15.0 450 | shader_parameter/_intensity_shield = 2.5 451 | shader_parameter/glow_enabled = true 452 | shader_parameter/glow_strength = 1.0 453 | shader_parameter/_active_static = false 454 | shader_parameter/_origin_static = Vector3(0, 0, 0) 455 | shader_parameter/_speed_static = 0.1 456 | shader_parameter/_frequency_static = 80.0 457 | shader_parameter/_amplitude_static = 0.002 458 | shader_parameter/_normal_amplitude_static = 0.002 459 | shader_parameter/_effect_radius_static = 1.2 460 | shader_parameter/_active_static_offset_hl = true 461 | shader_parameter/_strength_static_offset_hl = 1.0 462 | shader_parameter/_intensity_static_offset_hl = 5.0 463 | shader_parameter/_origin_impact = PackedVector3Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) 464 | shader_parameter/_time_impact = PackedFloat32Array(0, 0, 0, 0, 0) 465 | shader_parameter/_frequency_impact = 20.0 466 | shader_parameter/_waves_impact = 0.0 467 | shader_parameter/_fade_waves_impact = 2.0 468 | shader_parameter/_amplitude_impact = 0.02 469 | shader_parameter/_normal_amplitude_impact = 0.05 470 | shader_parameter/_radius_impact = 1.0 471 | shader_parameter/_active_impact_offset_hl = true 472 | shader_parameter/_strength_impact_offset_hl = 1.0 473 | shader_parameter/_intensity_impact_offset_hl = 5.0 474 | shader_parameter/_active_border = true 475 | shader_parameter/_intensity_border = 2.0 476 | shader_parameter/_percentage_border = 0.2 477 | shader_parameter/_show_normals = false 478 | 479 | [sub_resource type="PlaneMesh" id="PlaneMesh_6jtgg"] 480 | resource_local_to_scene = true 481 | material = SubResource("ShaderMaterial_64ak4") 482 | size = Vector2(1, 1) 483 | subdivide_width = 128 484 | subdivide_depth = 128 485 | 486 | [sub_resource type="Curve" id="Curve_wk33k"] 487 | resource_local_to_scene = true 488 | resource_name = "animation_curve" 489 | _data = [Vector2(0, 0), 0.0, 2.60088, 0, 0, Vector2(0.996183, 1), 0.0, 0.0, 0, 0] 490 | point_count = 2 491 | 492 | [sub_resource type="SphereMesh" id="SphereMesh_7cs7f"] 493 | radius = 0.2 494 | height = 0.4 495 | 496 | [sub_resource type="BoxMesh" id="BoxMesh_qsywp"] 497 | size = Vector3(0.3, 0.3, 0.3) 498 | 499 | [sub_resource type="BoxMesh" id="BoxMesh_8tyb0"] 500 | size = Vector3(1.1, 0.05, 1.1) 501 | 502 | [sub_resource type="GDScript" id="GDScript_v1qj6"] 503 | script/source = "@tool 504 | extends Node3D 505 | 506 | var rotation_speed: float = 45.0 507 | 508 | var impact_cooldown: float = 1.0 509 | var time_passed: float = 0.0 510 | var initial_position: Vector3 = Vector3(0.75, 0.6, 0.0) 511 | 512 | @onready var left_sphere: MeshInstance3D = $ShieldSphere 513 | @onready var right_sphere: MeshInstance3D = $ShieldSphere2 514 | 515 | 516 | func random_point_on_sphere(radius: float) -> Vector3: 517 | var theta = randf() * PI * 2.0 518 | var phi = acos(1.0 - 2.0 * randf()) 519 | 520 | var x = radius * sin(phi) * cos(theta) 521 | var y = radius * sin(phi) * sin(theta) 522 | var z = radius * cos(phi) 523 | 524 | return Vector3(x, y, z) 525 | 526 | func _process(delta: float): 527 | time_passed += delta 528 | if time_passed > impact_cooldown: 529 | var impact_point = left_sphere.global_position 530 | var random_point = random_point_on_sphere(0.5) 531 | left_sphere.impact(impact_point + random_point) 532 | impact_point = right_sphere.global_position 533 | right_sphere.impact(impact_point + random_point) 534 | time_passed -= impact_cooldown 535 | " 536 | 537 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_6c8gp"] 538 | render_priority = 0 539 | shader = ExtResource("2_u8gy5") 540 | shader_parameter/_quantization = false 541 | shader_parameter/_steps_quantization = 5 542 | shader_parameter/_object_scale = 1.0 543 | shader_parameter/_object_size = 1.0 544 | shader_parameter/_only_on_wave_visibility = false 545 | shader_parameter/_start_falloff_visibility = 0.5 546 | shader_parameter/_end_falloff_visibility = 0.3 547 | shader_parameter/_time_multiplier_activation = 1.0 548 | shader_parameter/_distance_multiplier_activation = 1.0 549 | shader_parameter/_width_time_activation = 1.0 550 | shader_parameter/_enable_highlight_intersection = true 551 | shader_parameter/_width_highlight_intersection = 1.0 552 | shader_parameter/_speed_noise = Vector2(0.02, 0.02) 553 | shader_parameter/_origin_generate = Vector3(0, 0.5, 0) 554 | shader_parameter/_relative_origin_generate = true 555 | shader_parameter/_time_generate = 1.0 556 | shader_parameter/_thickness_generate = 0.25 557 | shader_parameter/_collapse = false 558 | shader_parameter/_color_shield = Color(0.26, 0.975, 1, 1) 559 | shader_parameter/_color_brightness_shield = 15.0 560 | shader_parameter/_intensity_shield = 2.5 561 | shader_parameter/glow_enabled = true 562 | shader_parameter/glow_strength = 1.0 563 | shader_parameter/_active_static = false 564 | shader_parameter/_origin_static = Vector3(0, 0.5, 0) 565 | shader_parameter/_speed_static = 0.1 566 | shader_parameter/_frequency_static = 80.0 567 | shader_parameter/_amplitude_static = 0.002 568 | shader_parameter/_normal_amplitude_static = 0.002 569 | shader_parameter/_effect_radius_static = 1.2 570 | shader_parameter/_active_static_offset_hl = true 571 | shader_parameter/_strength_static_offset_hl = 1.0 572 | shader_parameter/_intensity_static_offset_hl = 5.0 573 | shader_parameter/_origin_impact = Array[Vector3]([Vector3(14.497001, 0.23522007, 0.23648778), Vector3(13.981965, 0.36764258, 0.35237405), Vector3(14.088791, 0.9282105, -0.34101248), Vector3(13.754924, 0.59253764, -0.06960046), Vector3(14.214417, 0.9765745, 0.32699472)]) 574 | shader_parameter/_time_impact = [0.032168627, 0.0, 0.9710595, 0.839314, 0.5485546] 575 | shader_parameter/_frequency_impact = 20.0 576 | shader_parameter/_waves_impact = 0.0 577 | shader_parameter/_fade_waves_impact = 2.0 578 | shader_parameter/_amplitude_impact = 0.02 579 | shader_parameter/_normal_amplitude_impact = 0.05 580 | shader_parameter/_radius_impact = 1.0 581 | shader_parameter/_active_impact_offset_hl = true 582 | shader_parameter/_strength_impact_offset_hl = 1.0 583 | shader_parameter/_intensity_impact_offset_hl = 5.0 584 | shader_parameter/_active_border = false 585 | shader_parameter/_intensity_border = 2.0 586 | shader_parameter/_percentage_border = 0.1 587 | shader_parameter/_show_normals = false 588 | 589 | [sub_resource type="SphereMesh" id="SphereMesh_yjboh"] 590 | resource_local_to_scene = true 591 | material = SubResource("ShaderMaterial_6c8gp") 592 | radial_segments = 256 593 | rings = 256 594 | 595 | [sub_resource type="GDScript" id="GDScript_6h0e3"] 596 | script/source = "@tool 597 | extends \"res://addons/nojoule-energy-shield/shield.gd\" 598 | " 599 | 600 | [sub_resource type="Curve" id="Curve_7vbqd"] 601 | resource_local_to_scene = true 602 | resource_name = "animation_curve" 603 | _data = [Vector2(0, 0), 0.0, 2.60088, 0, 0, Vector2(0.996183, 1), 0.0, 0.0, 0, 0] 604 | point_count = 2 605 | 606 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_8terc"] 607 | render_priority = 0 608 | shader = ExtResource("2_u8gy5") 609 | shader_parameter/_quantization = true 610 | shader_parameter/_steps_quantization = 7 611 | shader_parameter/_object_scale = 1.0 612 | shader_parameter/_object_size = 1.0 613 | shader_parameter/_only_on_wave_visibility = false 614 | shader_parameter/_start_falloff_visibility = 0.5 615 | shader_parameter/_end_falloff_visibility = 0.3 616 | shader_parameter/_time_multiplier_activation = 1.0 617 | shader_parameter/_distance_multiplier_activation = 1.0 618 | shader_parameter/_width_time_activation = 1.0 619 | shader_parameter/_enable_highlight_intersection = true 620 | shader_parameter/_width_highlight_intersection = 1.0 621 | shader_parameter/_speed_noise = Vector2(0.02, 0.02) 622 | shader_parameter/_origin_generate = Vector3(0, 0.5, 0) 623 | shader_parameter/_relative_origin_generate = true 624 | shader_parameter/_time_generate = 1.0 625 | shader_parameter/_thickness_generate = 0.25 626 | shader_parameter/_collapse = false 627 | shader_parameter/_color_shield = Color(0.26, 0.975, 1, 1) 628 | shader_parameter/_color_brightness_shield = 15.0 629 | shader_parameter/_intensity_shield = 2.5 630 | shader_parameter/glow_enabled = true 631 | shader_parameter/glow_strength = 1.0 632 | shader_parameter/_active_static = false 633 | shader_parameter/_origin_static = Vector3(0, 0.5, 0) 634 | shader_parameter/_speed_static = 0.1 635 | shader_parameter/_frequency_static = 80.0 636 | shader_parameter/_amplitude_static = 0.002 637 | shader_parameter/_normal_amplitude_static = 0.002 638 | shader_parameter/_effect_radius_static = 1.2 639 | shader_parameter/_active_static_offset_hl = true 640 | shader_parameter/_strength_static_offset_hl = 1.0 641 | shader_parameter/_intensity_static_offset_hl = 5.0 642 | shader_parameter/_origin_impact = Array[Vector3]([Vector3(15.997001, 0.23522007, 0.23648778), Vector3(15.481965, 0.36764258, 0.35237405), Vector3(15.588791, 0.9282105, -0.34101248), Vector3(15.254924, 0.59253764, -0.06960046), Vector3(15.714417, 0.9765745, 0.32699472)]) 643 | shader_parameter/_time_impact = [0.032168627, 0.0, 0.9710595, 0.839314, 0.5485546] 644 | shader_parameter/_frequency_impact = 20.0 645 | shader_parameter/_waves_impact = 0.0 646 | shader_parameter/_fade_waves_impact = 2.0 647 | shader_parameter/_amplitude_impact = 0.02 648 | shader_parameter/_normal_amplitude_impact = 0.05 649 | shader_parameter/_radius_impact = 1.0 650 | shader_parameter/_active_impact_offset_hl = true 651 | shader_parameter/_strength_impact_offset_hl = 1.0 652 | shader_parameter/_intensity_impact_offset_hl = 5.0 653 | shader_parameter/_active_border = false 654 | shader_parameter/_intensity_border = 2.0 655 | shader_parameter/_percentage_border = 0.1 656 | shader_parameter/_show_normals = false 657 | 658 | [sub_resource type="SphereMesh" id="SphereMesh_bkub6"] 659 | resource_local_to_scene = true 660 | material = SubResource("ShaderMaterial_8terc") 661 | radial_segments = 256 662 | rings = 256 663 | 664 | [sub_resource type="GDScript" id="GDScript_eeeod"] 665 | script/source = "@tool 666 | extends \"res://addons/nojoule-energy-shield/shield.gd\" 667 | " 668 | 669 | [sub_resource type="Curve" id="Curve_dggen"] 670 | resource_local_to_scene = true 671 | resource_name = "animation_curve" 672 | _data = [Vector2(0, 0), 0.0, 2.60088, 0, 0, Vector2(0.996183, 1), 0.0, 0.0, 0, 0] 673 | point_count = 2 674 | 675 | [sub_resource type="GDScript" id="GDScript_sq7vv"] 676 | script/source = "@tool 677 | extends Node3D 678 | 679 | var rotation_speed: float = 45.0 680 | 681 | var impact_cooldown: float = 1.0 682 | var time_passed: float = 0.0 683 | var initial_position: Vector3 = Vector3(0.75, 0.6, 0.0) 684 | 685 | @onready var left_sphere: MeshInstance3D = $ShieldSphere 686 | @onready var right_sphere: MeshInstance3D = $ShieldSphere2 687 | 688 | 689 | func random_point_on_sphere(radius: float) -> Vector3: 690 | var theta = randf() * PI * 2.0 691 | var phi = acos(1.0 - 2.0 * randf()) 692 | 693 | var x = radius * sin(phi) * cos(theta) 694 | var y = radius * sin(phi) * sin(theta) 695 | var z = radius * cos(phi) 696 | 697 | return Vector3(x, y, z) 698 | 699 | func _process(delta: float): 700 | time_passed += delta 701 | if time_passed > impact_cooldown: 702 | var impact_point = left_sphere.global_position 703 | var random_point = random_point_on_sphere(0.5) 704 | left_sphere.impact(impact_point + random_point) 705 | impact_point = right_sphere.global_position 706 | right_sphere.impact(impact_point + random_point) 707 | time_passed -= impact_cooldown 708 | " 709 | 710 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_67oo1"] 711 | render_priority = 0 712 | shader = ExtResource("2_u8gy5") 713 | shader_parameter/_quantization = false 714 | shader_parameter/_steps_quantization = 5 715 | shader_parameter/_object_scale = 1.0 716 | shader_parameter/_object_size = 1.0 717 | shader_parameter/_only_on_wave_visibility = false 718 | shader_parameter/_start_falloff_visibility = 0.5 719 | shader_parameter/_end_falloff_visibility = 0.3 720 | shader_parameter/_time_multiplier_activation = 1.0 721 | shader_parameter/_distance_multiplier_activation = 1.0 722 | shader_parameter/_width_time_activation = 1.0 723 | shader_parameter/_enable_highlight_intersection = true 724 | shader_parameter/_width_highlight_intersection = 1.0 725 | shader_parameter/_speed_noise = Vector2(0.02, 0.02) 726 | shader_parameter/_origin_generate = Vector3(0, 0.5, 0) 727 | shader_parameter/_relative_origin_generate = true 728 | shader_parameter/_time_generate = 1.0 729 | shader_parameter/_thickness_generate = 0.25 730 | shader_parameter/_collapse = false 731 | shader_parameter/_color_shield = Color(0.26, 0.975, 1, 1) 732 | shader_parameter/_color_brightness_shield = 15.0 733 | shader_parameter/_intensity_shield = 2.5 734 | shader_parameter/glow_enabled = true 735 | shader_parameter/glow_strength = 1.0 736 | shader_parameter/_active_static = false 737 | shader_parameter/_origin_static = Vector3(0, 0.5, 0) 738 | shader_parameter/_speed_static = 0.1 739 | shader_parameter/_frequency_static = 80.0 740 | shader_parameter/_amplitude_static = 0.002 741 | shader_parameter/_normal_amplitude_static = 0.002 742 | shader_parameter/_effect_radius_static = 1.2 743 | shader_parameter/_active_static_offset_hl = true 744 | shader_parameter/_strength_static_offset_hl = 1.0 745 | shader_parameter/_intensity_static_offset_hl = 5.0 746 | shader_parameter/_origin_impact = Array[Vector3]([Vector3(19.603283, 0.85798013, 0.24215195), Vector3(18.760767, 0.5147334, -0.058139145), Vector3(19.584608, 0.8253898, -0.29535818), Vector3(18.817627, 0.3491, 0.010151118), Vector3(19.471684, 0.9117845, 0.3219427)]) 747 | shader_parameter/_time_impact = [0.032168627, 0.0, 0.9710595, 0.839314, 0.5485546] 748 | shader_parameter/_frequency_impact = 20.0 749 | shader_parameter/_waves_impact = 0.0 750 | shader_parameter/_fade_waves_impact = 2.0 751 | shader_parameter/_amplitude_impact = 0.02 752 | shader_parameter/_normal_amplitude_impact = 0.05 753 | shader_parameter/_radius_impact = 1.0 754 | shader_parameter/_active_impact_offset_hl = true 755 | shader_parameter/_strength_impact_offset_hl = 1.0 756 | shader_parameter/_intensity_impact_offset_hl = 5.0 757 | shader_parameter/_active_border = false 758 | shader_parameter/_intensity_border = 2.0 759 | shader_parameter/_percentage_border = 0.1 760 | shader_parameter/_show_normals = false 761 | 762 | [sub_resource type="SphereMesh" id="SphereMesh_ptlbr"] 763 | resource_local_to_scene = true 764 | material = SubResource("ShaderMaterial_67oo1") 765 | radial_segments = 256 766 | rings = 256 767 | 768 | [sub_resource type="GDScript" id="GDScript_nr1vk"] 769 | script/source = "@tool 770 | extends \"res://addons/nojoule-energy-shield/shield.gd\" 771 | " 772 | 773 | [sub_resource type="Curve" id="Curve_rgfh0"] 774 | resource_local_to_scene = true 775 | resource_name = "animation_curve" 776 | _data = [Vector2(0, 0), 0.0, 2.60088, 0, 0, Vector2(0.996183, 1), 0.0, 0.0, 0, 0] 777 | point_count = 2 778 | 779 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_x0bsn"] 780 | render_priority = 0 781 | shader = ExtResource("2_u8gy5") 782 | shader_parameter/_quantization = false 783 | shader_parameter/_steps_quantization = 5 784 | shader_parameter/_object_scale = 1.0 785 | shader_parameter/_object_size = 1.0 786 | shader_parameter/_only_on_wave_visibility = false 787 | shader_parameter/_start_falloff_visibility = 0.5 788 | shader_parameter/_end_falloff_visibility = 0.3 789 | shader_parameter/_time_multiplier_activation = 1.0 790 | shader_parameter/_distance_multiplier_activation = 1.0 791 | shader_parameter/_width_time_activation = 1.0 792 | shader_parameter/_enable_highlight_intersection = true 793 | shader_parameter/_width_highlight_intersection = 1.0 794 | shader_parameter/_noise_texture = ExtResource("4_cgev7") 795 | shader_parameter/_speed_noise = Vector2(0.02, 0.02) 796 | shader_parameter/_origin_generate = Vector3(0, 0.5, 0) 797 | shader_parameter/_relative_origin_generate = true 798 | shader_parameter/_time_generate = 1.0 799 | shader_parameter/_thickness_generate = 0.25 800 | shader_parameter/_collapse = false 801 | shader_parameter/_color_shield = Color(0.26, 0.975, 1, 1) 802 | shader_parameter/_color_brightness_shield = 15.0 803 | shader_parameter/_intensity_shield = 2.5 804 | shader_parameter/glow_enabled = true 805 | shader_parameter/glow_strength = 1.0 806 | shader_parameter/_active_static = false 807 | shader_parameter/_origin_static = Vector3(0, 0.5, 0) 808 | shader_parameter/_speed_static = 0.1 809 | shader_parameter/_frequency_static = 80.0 810 | shader_parameter/_amplitude_static = 0.002 811 | shader_parameter/_normal_amplitude_static = 0.002 812 | shader_parameter/_effect_radius_static = 1.2 813 | shader_parameter/_active_static_offset_hl = true 814 | shader_parameter/_strength_static_offset_hl = 1.0 815 | shader_parameter/_intensity_static_offset_hl = 5.0 816 | shader_parameter/_origin_impact = Array[Vector3]([Vector3(21.103283, 0.85798013, 0.24215195), Vector3(20.260767, 0.5147334, -0.058139145), Vector3(21.084608, 0.8253898, -0.29535818), Vector3(20.317627, 0.3491, 0.010151118), Vector3(20.971684, 0.9117845, 0.3219427)]) 817 | shader_parameter/_time_impact = [0.032168627, 0.0, 0.9710595, 0.839314, 0.5485546] 818 | shader_parameter/_frequency_impact = 20.0 819 | shader_parameter/_waves_impact = 0.0 820 | shader_parameter/_fade_waves_impact = 2.0 821 | shader_parameter/_amplitude_impact = 0.02 822 | shader_parameter/_normal_amplitude_impact = 0.05 823 | shader_parameter/_radius_impact = 1.0 824 | shader_parameter/_active_impact_offset_hl = true 825 | shader_parameter/_strength_impact_offset_hl = 1.0 826 | shader_parameter/_intensity_impact_offset_hl = 5.0 827 | shader_parameter/_active_border = false 828 | shader_parameter/_intensity_border = 2.0 829 | shader_parameter/_percentage_border = 0.1 830 | shader_parameter/_show_normals = false 831 | 832 | [sub_resource type="SphereMesh" id="SphereMesh_5y2kl"] 833 | resource_local_to_scene = true 834 | material = SubResource("ShaderMaterial_x0bsn") 835 | radial_segments = 256 836 | rings = 256 837 | 838 | [sub_resource type="GDScript" id="GDScript_dkdx8"] 839 | script/source = "@tool 840 | extends \"res://addons/nojoule-energy-shield/shield.gd\" 841 | " 842 | 843 | [sub_resource type="Curve" id="Curve_envml"] 844 | resource_local_to_scene = true 845 | resource_name = "animation_curve" 846 | _data = [Vector2(0, 0), 0.0, 2.60088, 0, 0, Vector2(0.996183, 1), 0.0, 0.0, 0, 0] 847 | point_count = 2 848 | 849 | [sub_resource type="GDScript" id="GDScript_iiy7r"] 850 | script/source = "@tool 851 | extends Node3D 852 | 853 | var rotation_speed: float = 45.0 854 | 855 | @onready var sphere: MeshInstance3D = $ShieldSphere 856 | @onready var plane: MeshInstance3D = $ShieldPlane 857 | 858 | func _process(delta: float) -> void: 859 | sphere.rotate(Vector3.UP, deg_to_rad(rotation_speed * delta)) 860 | plane.rotate(Vector3.UP, deg_to_rad(rotation_speed * delta)) 861 | " 862 | 863 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_8qd4a"] 864 | render_priority = 0 865 | shader = ExtResource("2_u8gy5") 866 | shader_parameter/_quantization = true 867 | shader_parameter/_steps_quantization = 5 868 | shader_parameter/_object_scale = 1.0 869 | shader_parameter/_object_size = 1.1 870 | shader_parameter/_only_on_wave_visibility = false 871 | shader_parameter/_start_falloff_visibility = 0.5 872 | shader_parameter/_end_falloff_visibility = 0.3 873 | shader_parameter/_time_multiplier_activation = 1.0 874 | shader_parameter/_distance_multiplier_activation = 1.0 875 | shader_parameter/_width_time_activation = 1.0 876 | shader_parameter/_enable_highlight_intersection = true 877 | shader_parameter/_width_highlight_intersection = 1.0 878 | shader_parameter/_noise_texture = ExtResource("4_cgev7") 879 | shader_parameter/_speed_noise = Vector2(0.02, 0.02) 880 | shader_parameter/_origin_generate = Vector3(0, 0.5, 0) 881 | shader_parameter/_relative_origin_generate = true 882 | shader_parameter/_time_generate = 1.0 883 | shader_parameter/_thickness_generate = 0.25 884 | shader_parameter/_collapse = false 885 | shader_parameter/_color_shield = Color(0.26, 0.975, 1, 1) 886 | shader_parameter/_color_brightness_shield = 15.0 887 | shader_parameter/_intensity_shield = 3.0 888 | shader_parameter/glow_enabled = true 889 | shader_parameter/glow_strength = 1.0 890 | shader_parameter/_active_static = true 891 | shader_parameter/_origin_static = Vector3(0.4, 0.4, 0) 892 | shader_parameter/_speed_static = 0.4 893 | shader_parameter/_frequency_static = 20.0 894 | shader_parameter/_amplitude_static = 0.05 895 | shader_parameter/_normal_amplitude_static = 0.05 896 | shader_parameter/_effect_radius_static = 2.0 897 | shader_parameter/_active_static_offset_hl = false 898 | shader_parameter/_strength_static_offset_hl = 1.0 899 | shader_parameter/_intensity_static_offset_hl = 5.0 900 | shader_parameter/_origin_impact = PackedVector3Array(0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) 901 | shader_parameter/_time_impact = PackedFloat32Array(0, 0, 0, 0, 0) 902 | shader_parameter/_frequency_impact = 20.0 903 | shader_parameter/_waves_impact = 0.0 904 | shader_parameter/_fade_waves_impact = 2.0 905 | shader_parameter/_amplitude_impact = 0.05 906 | shader_parameter/_normal_amplitude_impact = 0.05 907 | shader_parameter/_radius_impact = 1.0 908 | shader_parameter/_active_impact_offset_hl = true 909 | shader_parameter/_strength_impact_offset_hl = 1.0 910 | shader_parameter/_intensity_impact_offset_hl = 5.0 911 | shader_parameter/_active_border = false 912 | shader_parameter/_intensity_border = 2.0 913 | shader_parameter/_percentage_border = 0.1 914 | shader_parameter/_show_normals = false 915 | 916 | [sub_resource type="SphereMesh" id="SphereMesh_n6kln"] 917 | resource_local_to_scene = true 918 | material = SubResource("ShaderMaterial_8qd4a") 919 | radial_segments = 256 920 | rings = 256 921 | 922 | [sub_resource type="Curve" id="Curve_l06v0"] 923 | resource_local_to_scene = true 924 | resource_name = "animation_curve" 925 | _data = [Vector2(0, 0), 0.0, 2.60088, 0, 0, Vector2(0.996183, 1), 0.0, 0.0, 0, 0] 926 | point_count = 2 927 | 928 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_ycdec"] 929 | render_priority = 0 930 | shader = ExtResource("2_u8gy5") 931 | shader_parameter/_quantization = true 932 | shader_parameter/_steps_quantization = 5 933 | shader_parameter/_object_scale = 1.0 934 | shader_parameter/_object_size = 1.4 935 | shader_parameter/_only_on_wave_visibility = false 936 | shader_parameter/_start_falloff_visibility = 0.5 937 | shader_parameter/_end_falloff_visibility = 0.3 938 | shader_parameter/_time_multiplier_activation = 1.0 939 | shader_parameter/_distance_multiplier_activation = 1.0 940 | shader_parameter/_width_time_activation = 1.0 941 | shader_parameter/_enable_highlight_intersection = true 942 | shader_parameter/_width_highlight_intersection = 1.0 943 | shader_parameter/_noise_texture = ExtResource("4_cgev7") 944 | shader_parameter/_speed_noise = Vector2(0.02, 0.02) 945 | shader_parameter/_origin_generate = Vector3(0, 0.5, 0) 946 | shader_parameter/_relative_origin_generate = true 947 | shader_parameter/_time_generate = 1.0 948 | shader_parameter/_thickness_generate = 0.25 949 | shader_parameter/_collapse = false 950 | shader_parameter/_color_shield = Color(0.26, 0.975, 1, 1) 951 | shader_parameter/_color_brightness_shield = 15.0 952 | shader_parameter/_intensity_shield = 3.0 953 | shader_parameter/glow_enabled = true 954 | shader_parameter/glow_strength = 1.0 955 | shader_parameter/_active_static = true 956 | shader_parameter/_origin_static = Vector3(0, 0, 0) 957 | shader_parameter/_speed_static = 0.4 958 | shader_parameter/_frequency_static = 20.0 959 | shader_parameter/_amplitude_static = 0.05 960 | shader_parameter/_normal_amplitude_static = 0.05 961 | shader_parameter/_effect_radius_static = 2.0 962 | shader_parameter/_active_static_offset_hl = false 963 | shader_parameter/_strength_static_offset_hl = 1.0 964 | shader_parameter/_intensity_static_offset_hl = 5.0 965 | shader_parameter/_origin_impact = PackedVector3Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) 966 | shader_parameter/_time_impact = PackedFloat32Array(0, 0, 0, 0, 0) 967 | shader_parameter/_frequency_impact = 20.0 968 | shader_parameter/_waves_impact = 0.0 969 | shader_parameter/_fade_waves_impact = 2.0 970 | shader_parameter/_amplitude_impact = 0.05 971 | shader_parameter/_normal_amplitude_impact = 0.05 972 | shader_parameter/_radius_impact = 1.0 973 | shader_parameter/_active_impact_offset_hl = true 974 | shader_parameter/_strength_impact_offset_hl = 1.0 975 | shader_parameter/_intensity_impact_offset_hl = 5.0 976 | shader_parameter/_active_border = true 977 | shader_parameter/_intensity_border = 2.0 978 | shader_parameter/_percentage_border = 0.1 979 | shader_parameter/_show_normals = false 980 | 981 | [sub_resource type="PlaneMesh" id="PlaneMesh_h6f4g"] 982 | resource_local_to_scene = true 983 | material = SubResource("ShaderMaterial_ycdec") 984 | size = Vector2(1, 1) 985 | subdivide_width = 128 986 | subdivide_depth = 128 987 | 988 | [sub_resource type="Curve" id="Curve_24ojw"] 989 | resource_local_to_scene = true 990 | resource_name = "animation_curve" 991 | _data = [Vector2(0, 0), 0.0, 2.60088, 0, 0, Vector2(0.996183, 1), 0.0, 0.0, 0, 0] 992 | point_count = 2 993 | 994 | [node name="EnergyShieldExamples" type="Node3D"] 995 | 996 | [node name="WorldEnv" type="WorldEnvironment" parent="."] 997 | environment = SubResource("Environment_nl0ma") 998 | 999 | [node name="MainLight" type="DirectionalLight3D" parent="."] 1000 | transform = Transform3D(0.925871, -0.32722, 0.18892, 0, 0.5, 0.866025, -0.377841, -0.801827, 0.462935, 0, 10, 0) 1001 | light_energy = 0.2 1002 | 1003 | [node name="Camera3D" type="Camera3D" parent="."] 1004 | transform = Transform3D(1, 0, 0, 0, 0.951428, 0.307871, 0, -0.307871, 0.951428, 0, 0.797, 1.867) 1005 | script = ExtResource("1_1ksrw") 1006 | 1007 | [node name="InteractionExample" type="Node3D" parent="."] 1008 | script = SubResource("GDScript_mlkug") 1009 | 1010 | [node name="Heading" type="Label3D" parent="InteractionExample"] 1011 | transform = Transform3D(1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107, 0, -0.0775828, 0.61109) 1012 | pixel_size = 0.003 1013 | modulate = Color(1, 0.763636, 0, 1) 1014 | text = "ENERGY SHIELD INTERACTION" 1015 | font_size = 40 1016 | 1017 | [node name="Description" type="Label3D" parent="InteractionExample"] 1018 | transform = Transform3D(1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107, 0, -0.138092, 0.671599) 1019 | pixel_size = 0.003 1020 | text = "LMB to interact. Ctrl + LMB to collapse/regenerate the shields." 1021 | vertical_alignment = 0 1022 | autowrap_mode = 3 1023 | width = 700.0 1024 | 1025 | [node name="Ground" type="MeshInstance3D" parent="InteractionExample"] 1026 | mesh = SubResource("QuadMesh_f5biq") 1027 | 1028 | [node name="ShieldPlane" parent="InteractionExample" instance=ExtResource("1_uycqw")] 1029 | transform = Transform3D(0.918748, -0.43056622, 1.8846613e-08, 0, -4.37114e-08, -1, 0.43056622, 0.918748, -4.0211024e-08, -0.75, 0.6, 0) 1030 | mesh = SubResource("PlaneMesh_e83g8") 1031 | animation_curve = SubResource("Curve_cwp47") 1032 | 1033 | [node name="ShieldSphere" parent="InteractionExample" instance=ExtResource("3_twgkm")] 1034 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.75, 0.6, 0) 1035 | mesh = SubResource("SphereMesh_jhkwg") 1036 | animation_curve = SubResource("Curve_8n046") 1037 | 1038 | [node name="ColorExample" type="Node3D" parent="."] 1039 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 0, 0) 1040 | script = SubResource("GDScript_1dyov") 1041 | 1042 | [node name="Heading" type="Label3D" parent="ColorExample"] 1043 | transform = Transform3D(1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107, 0, -0.0775828, 0.61109) 1044 | pixel_size = 0.003 1045 | modulate = Color(1, 0.763636, 0, 1) 1046 | text = "COLOR" 1047 | font_size = 40 1048 | 1049 | [node name="Description" type="Label3D" parent="ColorExample"] 1050 | transform = Transform3D(1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107, 0, -0.138092, 0.671599) 1051 | pixel_size = 0.003 1052 | text = "You can freely choose the color." 1053 | vertical_alignment = 0 1054 | autowrap_mode = 3 1055 | width = 700.0 1056 | 1057 | [node name="Ground" type="MeshInstance3D" parent="ColorExample"] 1058 | mesh = SubResource("QuadMesh_f5biq") 1059 | 1060 | [node name="ShieldSphere" parent="ColorExample" instance=ExtResource("3_twgkm")] 1061 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.75, 0.6, 0) 1062 | mesh = SubResource("SphereMesh_q2ark") 1063 | skeleton = NodePath("../..") 1064 | animation_curve = SubResource("Curve_ibf8e") 1065 | 1066 | [node name="ShieldPlane" parent="ColorExample" instance=ExtResource("1_uycqw")] 1067 | transform = Transform3D(0.9914784, -0.21550941, 9.434337e-09, 0, -4.37114e-08, -1, 0.21550941, 0.9914784, -4.3390425e-08, -0.75, 0.6, 0) 1068 | mesh = SubResource("PlaneMesh_tb5o1") 1069 | skeleton = NodePath("../ShieldSphere") 1070 | animation_curve = SubResource("Curve_u31ny") 1071 | 1072 | [node name="DepthHighlight" type="Node3D" parent="."] 1073 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 10, 0, 0) 1074 | script = SubResource("GDScript_r2b7w") 1075 | 1076 | [node name="Heading" type="Label3D" parent="DepthHighlight"] 1077 | transform = Transform3D(1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107, 0, -0.0775828, 0.61109) 1078 | pixel_size = 0.003 1079 | modulate = Color(1, 0.763636, 0, 1) 1080 | text = "HIGHLIGHT INTERSECTION" 1081 | font_size = 40 1082 | 1083 | [node name="Description" type="Label3D" parent="DepthHighlight"] 1084 | transform = Transform3D(1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107, 0, -0.138092, 0.671599) 1085 | pixel_size = 0.003 1086 | text = "Using the depth values, close objects will cause a highlight on the material. (not for web builds) 1087 | " 1088 | vertical_alignment = 0 1089 | autowrap_mode = 3 1090 | width = 700.0 1091 | 1092 | [node name="Ground" type="MeshInstance3D" parent="DepthHighlight"] 1093 | mesh = SubResource("QuadMesh_f5biq") 1094 | 1095 | [node name="ShieldSphere" parent="DepthHighlight" instance=ExtResource("3_twgkm")] 1096 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.75, 0.6, 0) 1097 | mesh = SubResource("SphereMesh_bycw3") 1098 | animation_curve = SubResource("Curve_t2u8o") 1099 | 1100 | [node name="ShieldPlane" parent="DepthHighlight" instance=ExtResource("1_uycqw")] 1101 | transform = Transform3D(-0.509868, -0.8747979, 3.8259852e-08, 0, -4.37114e-08, -1, 0.8747979, -0.509868, 2.2299426e-08, -0.75, 0.6, 0) 1102 | mesh = SubResource("PlaneMesh_6jtgg") 1103 | animation_curve = SubResource("Curve_wk33k") 1104 | 1105 | [node name="EnvironmentSphere" type="MeshInstance3D" parent="DepthHighlight"] 1106 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.5, 0.6, -0.126896) 1107 | mesh = SubResource("SphereMesh_7cs7f") 1108 | 1109 | [node name="EnvironmentCube" type="MeshInstance3D" parent="DepthHighlight"] 1110 | transform = Transform3D(0.999781, -0.013037, -0.0163897, 0, 0.782608, -0.622515, 0.0209424, 0.622378, 0.782436, -1, 0.6, 0) 1111 | mesh = SubResource("BoxMesh_qsywp") 1112 | skeleton = NodePath("../EnvironmentSphere") 1113 | 1114 | [node name="EnvironmentMovingPlatform" type="MeshInstance3D" parent="DepthHighlight"] 1115 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.75, 1.0874286, 0) 1116 | mesh = SubResource("BoxMesh_8tyb0") 1117 | 1118 | [node name="QuantizationExample" type="Node3D" parent="."] 1119 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 15, 0, 0) 1120 | script = SubResource("GDScript_v1qj6") 1121 | 1122 | [node name="Heading" type="Label3D" parent="QuantizationExample"] 1123 | transform = Transform3D(1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107, 0, -0.0775828, 0.61109) 1124 | pixel_size = 0.003 1125 | modulate = Color(1, 0.763636, 0, 1) 1126 | text = "QUANTIZATION" 1127 | font_size = 40 1128 | 1129 | [node name="Description" type="Label3D" parent="QuantizationExample"] 1130 | transform = Transform3D(1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107, 0, -0.138092, 0.671599) 1131 | pixel_size = 0.003 1132 | text = "You can turn quantization off (left) or on (right), to better match different artstyles." 1133 | vertical_alignment = 0 1134 | autowrap_mode = 3 1135 | width = 700.0 1136 | 1137 | [node name="Ground" type="MeshInstance3D" parent="QuantizationExample"] 1138 | mesh = SubResource("QuadMesh_f5biq") 1139 | 1140 | [node name="ShieldSphere" parent="QuantizationExample" instance=ExtResource("3_twgkm")] 1141 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.75, 0.6, 0) 1142 | mesh = SubResource("SphereMesh_yjboh") 1143 | skeleton = NodePath("../..") 1144 | script = SubResource("GDScript_6h0e3") 1145 | animation_curve = SubResource("Curve_7vbqd") 1146 | 1147 | [node name="ShieldSphere2" parent="QuantizationExample" instance=ExtResource("3_twgkm")] 1148 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.75, 0.6, 0) 1149 | mesh = SubResource("SphereMesh_bkub6") 1150 | skeleton = NodePath("../ShieldSphere") 1151 | script = SubResource("GDScript_eeeod") 1152 | animation_curve = SubResource("Curve_dggen") 1153 | 1154 | [node name="NoiseTextureExample" type="Node3D" parent="."] 1155 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 20, 0, 0) 1156 | script = SubResource("GDScript_sq7vv") 1157 | 1158 | [node name="Heading" type="Label3D" parent="NoiseTextureExample"] 1159 | transform = Transform3D(1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107, 0, -0.0775828, 0.61109) 1160 | pixel_size = 0.003 1161 | modulate = Color(1, 0.763636, 0, 1) 1162 | text = "NOISE TEXTURE 1163 | " 1164 | font_size = 40 1165 | 1166 | [node name="Description" type="Label3D" parent="NoiseTextureExample"] 1167 | transform = Transform3D(1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107, 0, -0.138092, 0.671599) 1168 | pixel_size = 0.003 1169 | text = "Adding a noise texture can add more details to the shield highlights. 1170 | Left - without texture, Right - with texture" 1171 | vertical_alignment = 0 1172 | autowrap_mode = 3 1173 | width = 700.0 1174 | 1175 | [node name="Ground" type="MeshInstance3D" parent="NoiseTextureExample"] 1176 | mesh = SubResource("QuadMesh_f5biq") 1177 | 1178 | [node name="ShieldSphere" parent="NoiseTextureExample" instance=ExtResource("3_twgkm")] 1179 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.75, 0.6, 0) 1180 | mesh = SubResource("SphereMesh_ptlbr") 1181 | skeleton = NodePath("../Description") 1182 | script = SubResource("GDScript_nr1vk") 1183 | animation_curve = SubResource("Curve_rgfh0") 1184 | 1185 | [node name="ShieldSphere2" parent="NoiseTextureExample" instance=ExtResource("3_twgkm")] 1186 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.75, 0.6, 0) 1187 | mesh = SubResource("SphereMesh_5y2kl") 1188 | skeleton = NodePath("../ShieldSphere") 1189 | script = SubResource("GDScript_dkdx8") 1190 | animation_curve = SubResource("Curve_envml") 1191 | 1192 | [node name="WaveOptionsExample" type="Node3D" parent="."] 1193 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 25, 0, 0) 1194 | script = SubResource("GDScript_iiy7r") 1195 | 1196 | [node name="Heading" type="Label3D" parent="WaveOptionsExample"] 1197 | transform = Transform3D(1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107, 0, -0.0775828, 0.61109) 1198 | pixel_size = 0.003 1199 | modulate = Color(1, 0.763636, 0, 1) 1200 | text = "WAVE OPTIONS 1201 | " 1202 | font_size = 40 1203 | 1204 | [node name="Description" type="Label3D" parent="WaveOptionsExample"] 1205 | transform = Transform3D(1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107, 0, -0.138092, 0.671599) 1206 | pixel_size = 0.003 1207 | text = "Adjustable settings for the waves." 1208 | vertical_alignment = 0 1209 | autowrap_mode = 3 1210 | width = 640.0 1211 | 1212 | [node name="Ground" type="MeshInstance3D" parent="WaveOptionsExample"] 1213 | mesh = SubResource("QuadMesh_f5biq") 1214 | 1215 | [node name="ShieldSphere" parent="WaveOptionsExample" instance=ExtResource("3_twgkm")] 1216 | transform = Transform3D(0.9746316, 0, 0.2345926, 0, 1, 0, -0.2345926, 0, 0.9746316, 0.75, 0.6, 0) 1217 | mesh = SubResource("SphereMesh_n6kln") 1218 | skeleton = NodePath("../..") 1219 | animation_curve = SubResource("Curve_l06v0") 1220 | 1221 | [node name="ShieldPlane" parent="WaveOptionsExample" instance=ExtResource("1_uycqw")] 1222 | transform = Transform3D(0.9746316, 0.16604257, 0.16604257, 0, 0.707107, -0.707107, -0.2345926, 0.6898981, 0.6898981, -0.75, 0.6, 0) 1223 | mesh = SubResource("PlaneMesh_h6f4g") 1224 | skeleton = NodePath("../..") 1225 | animation_curve = SubResource("Curve_24ojw") 1226 | --------------------------------------------------------------------------------