└── addons └── post_processing ├── AboutShaders.txt ├── assets ├── ascii.png ├── ascii.png.import ├── green_palette.png ├── green_palette.png.import ├── interesting_palette.png ├── interesting_palette.png.import ├── lens_aura.png ├── lens_aura.png.import ├── lens_divine.png ├── lens_divine.png.import └── lens_flare.gd ├── node ├── children │ ├── CRT.tscn │ ├── ChromaticAberration.tscn │ ├── analog_monitor.tscn │ ├── ascii.tscn │ ├── bloom.tscn │ ├── blur.tscn │ ├── circular_waves.tscn │ ├── color_correction.tscn │ ├── directional_drift.tscn │ ├── fish_eye.tscn │ ├── glitch.tscn │ ├── grain.tscn │ ├── kaleidoscope.gdshader │ ├── outline.gdshader │ ├── outline.tscn │ ├── palette.tscn │ ├── particle_storm.tscn │ ├── pixelate.tscn │ ├── screen_shake.tscn │ ├── speed_lines.tscn │ └── vignette.tscn ├── post_process.gd ├── post_process.svg └── post_process.svg.import ├── plugin.cfg ├── plugin.gd ├── resource ├── fish_eye_example.tres ├── no_effects_example.tres └── post_processing_configuration.gd └── shaders ├── CLREDIT.gdshaderinc ├── CRT.gdshader ├── LensFlares.gdshader ├── analog_monitor.gdshader ├── ascii.gdshader ├── bloom.gdshader ├── blur.gdshader ├── chromatic.gdshader ├── circularwaves.gdshader ├── color_correction.gdshader ├── directional_drift_shader.gdshader ├── dither.gdshader ├── fish_eye.gdshader ├── glitch.gdshader ├── grain.gdshader ├── painted.gdshader ├── palette_limiter.gdshader ├── particle_storm.gdshader ├── pixelate.gdshader ├── post_process.svg ├── post_process.svg.import ├── screen_shake.gdshader ├── speed_lines.gdshader ├── vignette.gdshader └── water.gdshader /addons/post_processing/AboutShaders.txt: -------------------------------------------------------------------------------- 1 | Hey, you may notice that when exploring the /shaders/ directory there are some unused shaders, that means that they either are worked on or werent properly removed! 2 | -------------------------------------------------------------------------------- /addons/post_processing/assets/ascii.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ItsKorin/Godot-Post-Process-Plugin/6c42c8d557e56a130b260d8152c8f7716b50012f/addons/post_processing/assets/ascii.png -------------------------------------------------------------------------------- /addons/post_processing/assets/ascii.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://5rj5tlylm7bt" 6 | path="res://.godot/imported/ascii.png-152231094f5e4e2669cec888e3c259a5.ctex" 7 | metadata={ 8 | "vram_texture": false 9 | } 10 | 11 | [deps] 12 | 13 | source_file="res://addons/post_processing/assets/ascii.png" 14 | dest_files=["res://.godot/imported/ascii.png-152231094f5e4e2669cec888e3c259a5.ctex"] 15 | 16 | [params] 17 | 18 | compress/mode=0 19 | compress/high_quality=false 20 | compress/lossy_quality=0.7 21 | compress/hdr_compression=1 22 | compress/normal_map=0 23 | compress/channel_pack=0 24 | mipmaps/generate=false 25 | mipmaps/limit=-1 26 | roughness/mode=0 27 | roughness/src_normal="" 28 | process/fix_alpha_border=true 29 | process/premult_alpha=false 30 | process/normal_map_invert_y=false 31 | process/hdr_as_srgb=false 32 | process/hdr_clamp_exposure=false 33 | process/size_limit=0 34 | detect_3d/compress_to=1 35 | -------------------------------------------------------------------------------- /addons/post_processing/assets/green_palette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ItsKorin/Godot-Post-Process-Plugin/6c42c8d557e56a130b260d8152c8f7716b50012f/addons/post_processing/assets/green_palette.png -------------------------------------------------------------------------------- /addons/post_processing/assets/green_palette.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://dovbwkiwlo153" 6 | path="res://.godot/imported/green_palette.png-6c780678de384f7686b5b49556c64591.ctex" 7 | metadata={ 8 | "vram_texture": false 9 | } 10 | 11 | [deps] 12 | 13 | source_file="res://addons/post_processing/assets/green_palette.png" 14 | dest_files=["res://.godot/imported/green_palette.png-6c780678de384f7686b5b49556c64591.ctex"] 15 | 16 | [params] 17 | 18 | compress/mode=0 19 | compress/high_quality=false 20 | compress/lossy_quality=0.7 21 | compress/hdr_compression=1 22 | compress/normal_map=0 23 | compress/channel_pack=0 24 | mipmaps/generate=false 25 | mipmaps/limit=-1 26 | roughness/mode=0 27 | roughness/src_normal="" 28 | process/fix_alpha_border=true 29 | process/premult_alpha=false 30 | process/normal_map_invert_y=false 31 | process/hdr_as_srgb=false 32 | process/hdr_clamp_exposure=false 33 | process/size_limit=0 34 | detect_3d/compress_to=1 35 | -------------------------------------------------------------------------------- /addons/post_processing/assets/interesting_palette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ItsKorin/Godot-Post-Process-Plugin/6c42c8d557e56a130b260d8152c8f7716b50012f/addons/post_processing/assets/interesting_palette.png -------------------------------------------------------------------------------- /addons/post_processing/assets/interesting_palette.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://nf2dcuadvrh7" 6 | path="res://.godot/imported/interesting_palette.png-f0563a3abea2f173a022c18d0ec48433.ctex" 7 | metadata={ 8 | "vram_texture": false 9 | } 10 | 11 | [deps] 12 | 13 | source_file="res://addons/post_processing/assets/interesting_palette.png" 14 | dest_files=["res://.godot/imported/interesting_palette.png-f0563a3abea2f173a022c18d0ec48433.ctex"] 15 | 16 | [params] 17 | 18 | compress/mode=0 19 | compress/high_quality=false 20 | compress/lossy_quality=0.7 21 | compress/hdr_compression=1 22 | compress/normal_map=0 23 | compress/channel_pack=0 24 | mipmaps/generate=false 25 | mipmaps/limit=-1 26 | roughness/mode=0 27 | roughness/src_normal="" 28 | process/fix_alpha_border=true 29 | process/premult_alpha=false 30 | process/normal_map_invert_y=false 31 | process/hdr_as_srgb=false 32 | process/hdr_clamp_exposure=false 33 | process/size_limit=0 34 | detect_3d/compress_to=1 35 | -------------------------------------------------------------------------------- /addons/post_processing/assets/lens_aura.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ItsKorin/Godot-Post-Process-Plugin/6c42c8d557e56a130b260d8152c8f7716b50012f/addons/post_processing/assets/lens_aura.png -------------------------------------------------------------------------------- /addons/post_processing/assets/lens_aura.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://3ee7ii2w44gd" 6 | path="res://.godot/imported/lens_aura.png-e27f19e14a0272728e7b44bd21dd8800.ctex" 7 | metadata={ 8 | "vram_texture": false 9 | } 10 | 11 | [deps] 12 | 13 | source_file="res://addons/post_processing/assets/lens_aura.png" 14 | dest_files=["res://.godot/imported/lens_aura.png-e27f19e14a0272728e7b44bd21dd8800.ctex"] 15 | 16 | [params] 17 | 18 | compress/mode=0 19 | compress/high_quality=false 20 | compress/lossy_quality=0.7 21 | compress/hdr_compression=1 22 | compress/normal_map=0 23 | compress/channel_pack=0 24 | mipmaps/generate=false 25 | mipmaps/limit=-1 26 | roughness/mode=0 27 | roughness/src_normal="" 28 | process/fix_alpha_border=true 29 | process/premult_alpha=false 30 | process/normal_map_invert_y=false 31 | process/hdr_as_srgb=false 32 | process/hdr_clamp_exposure=false 33 | process/size_limit=0 34 | detect_3d/compress_to=1 35 | -------------------------------------------------------------------------------- /addons/post_processing/assets/lens_divine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ItsKorin/Godot-Post-Process-Plugin/6c42c8d557e56a130b260d8152c8f7716b50012f/addons/post_processing/assets/lens_divine.png -------------------------------------------------------------------------------- /addons/post_processing/assets/lens_divine.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://dhlg318yf5dvo" 6 | path="res://.godot/imported/lens_divine.png-f89592ebc844543be1487a3ee051ee93.ctex" 7 | metadata={ 8 | "vram_texture": false 9 | } 10 | 11 | [deps] 12 | 13 | source_file="res://addons/post_processing/assets/lens_divine.png" 14 | dest_files=["res://.godot/imported/lens_divine.png-f89592ebc844543be1487a3ee051ee93.ctex"] 15 | 16 | [params] 17 | 18 | compress/mode=0 19 | compress/high_quality=false 20 | compress/lossy_quality=0.7 21 | compress/hdr_compression=1 22 | compress/normal_map=0 23 | compress/channel_pack=0 24 | mipmaps/generate=false 25 | mipmaps/limit=-1 26 | roughness/mode=0 27 | roughness/src_normal="" 28 | process/fix_alpha_border=true 29 | process/premult_alpha=false 30 | process/normal_map_invert_y=false 31 | process/hdr_as_srgb=false 32 | process/hdr_clamp_exposure=false 33 | process/size_limit=0 34 | detect_3d/compress_to=1 35 | -------------------------------------------------------------------------------- /addons/post_processing/assets/lens_flare.gd: -------------------------------------------------------------------------------- 1 | extends CanvasLayer 2 | 3 | # In your main scene script 4 | 5 | var camera = null 6 | var light_source = null 7 | var light_pos_world = null 8 | var screen_pos = null 9 | var light_pos_screen = null 10 | var material = null 11 | 12 | func _ready(): 13 | # Get camera node automatically based on type 14 | camera = get_tree().get_root().find_child("Camera3D", true, true) # Searches entire scene tree 15 | if not camera: 16 | print("Warning: No Camera node found in scene!") 17 | return 18 | 19 | # Get first light node (adjust if you need a specific light) 20 | light_source = get_tree().get_root().find_child("Light3D", true, true) # Searches entire scene tree 21 | if not light_source: 22 | print("Warning: No Light node found in scene!") 23 | return 24 | 25 | func _physics_process(delta): 26 | if not camera or not light_source: 27 | return # Skip if camera or light not found 28 | 29 | # Calculate and set light position as before 30 | light_pos_world = light_source.global_transform.origin 31 | screen_pos = camera.project_world_ray(light_pos_world) 32 | light_pos_screen = screen_pos / screen_pos.w 33 | 34 | material = $data.material 35 | material.set_uniform("LightPositionWorldSpace", light_pos_screen) 36 | -------------------------------------------------------------------------------- /addons/post_processing/node/children/CRT.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=3 format=3 uid="uid://mfrkdk8k6ojn"] 2 | 3 | [ext_resource type="Shader" path="res://addons/post_processing/shaders/CRT.gdshader" id="1_7bog5"] 4 | 5 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_ju4eq"] 6 | shader = ExtResource("1_7bog5") 7 | shader_parameter/overlay = false 8 | shader_parameter/scanlines_opacity = 0.4 9 | shader_parameter/scanlines_width = 0.25 10 | shader_parameter/grille_opacity = 0.3 11 | shader_parameter/resolution = Vector2(640, 480) 12 | shader_parameter/pixelate = true 13 | shader_parameter/roll = true 14 | shader_parameter/roll_speed = 8.0 15 | shader_parameter/roll_size = 15.0 16 | shader_parameter/roll_variation = 1.8 17 | shader_parameter/distort_intensity = 0.05 18 | shader_parameter/noise_opacity = 0.4 19 | shader_parameter/noise_speed = 5.0 20 | shader_parameter/static_noise_intensity = 0.06 21 | shader_parameter/aberration = 0.03 22 | shader_parameter/brightness = 1.4 23 | shader_parameter/discolor = true 24 | shader_parameter/warp_amount = 1.0 25 | shader_parameter/clip_warp = false 26 | shader_parameter/vignette_intensity = 0.4 27 | shader_parameter/vignette_opacity = 0.5 28 | 29 | [node name="CRT" type="CanvasLayer"] 30 | layer = 103 31 | visible = false 32 | 33 | [node name="data" type="ColorRect" parent="."] 34 | material = SubResource("ShaderMaterial_ju4eq") 35 | anchors_preset = 15 36 | anchor_right = 1.0 37 | anchor_bottom = 1.0 38 | grow_horizontal = 2 39 | grow_vertical = 2 40 | mouse_filter = 2 41 | -------------------------------------------------------------------------------- /addons/post_processing/node/children/ChromaticAberration.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=3 format=3 uid="uid://ccxkudlhbgmv7"] 2 | 3 | [ext_resource type="Shader" path="res://addons/post_processing/shaders/chromatic.gdshader" id="1_qxjen"] 4 | 5 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_ke5y5"] 6 | shader = ExtResource("1_qxjen") 7 | shader_parameter/offset = 5.23 8 | 9 | [node name="ChromaticAberration" type="CanvasLayer"] 10 | visible = false 11 | layer = 102 12 | 13 | [node name="data" type="ColorRect" parent="."] 14 | material = SubResource("ShaderMaterial_ke5y5") 15 | anchors_preset = 15 16 | anchor_right = 1.0 17 | anchor_bottom = 1.0 18 | grow_horizontal = 2 19 | grow_vertical = 2 20 | mouse_filter = 2 21 | -------------------------------------------------------------------------------- /addons/post_processing/node/children/analog_monitor.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=3 format=3 uid="uid://ctdvjs742haos"] 2 | 3 | [ext_resource type="Shader" path="res://addons/post_processing/shaders/analog_monitor.gdshader" id="1_yo3om"] 4 | 5 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_s1g6v"] 6 | shader = ExtResource("1_yo3om") 7 | shader_parameter/res = Vector2(256, 256) 8 | shader_parameter/mask_type = 0 9 | shader_parameter/bloom_type = 1 10 | shader_parameter/hardScan = -8.0 11 | shader_parameter/hardPix = -2.0 12 | shader_parameter/hardBloomScan = -2.0 13 | shader_parameter/hardBloomPix = -1.5 14 | shader_parameter/bloomAmount = 2.12 15 | shader_parameter/warp = Vector2(64, 24) 16 | shader_parameter/maskDark = 0.5 17 | shader_parameter/maskLight = 1.5 18 | 19 | [node name="AnalogMonitor" type="CanvasLayer"] 20 | visible = false 21 | 22 | [node name="data" type="ColorRect" parent="."] 23 | material = SubResource("ShaderMaterial_s1g6v") 24 | anchors_preset = 15 25 | anchor_right = 1.0 26 | anchor_bottom = 1.0 27 | grow_horizontal = 2 28 | grow_vertical = 2 29 | mouse_filter = 2 30 | -------------------------------------------------------------------------------- /addons/post_processing/node/children/ascii.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=4 format=3 uid="uid://k8tnsut5pohj"] 2 | 3 | [ext_resource type="Shader" path="res://addons/post_processing/shaders/ascii.gdshader" id="1_bp3vh"] 4 | [ext_resource type="Texture2D" uid="uid://5rj5tlylm7bt" path="res://addons/post_processing/assets/ascii.png" id="2_qs7p5"] 5 | 6 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_ppj3i"] 7 | shader = ExtResource("1_bp3vh") 8 | shader_parameter/ascii_size = Vector2(5, 10) 9 | shader_parameter/available_columns = 10 10 | shader_parameter/max_columns = 16 11 | shader_parameter/ascii_tex = ExtResource("2_qs7p5") 12 | 13 | [node name="Ascii" type="CanvasLayer"] 14 | layer = 99 15 | visible = false 16 | 17 | [node name="data" type="ColorRect" parent="."] 18 | material = SubResource("ShaderMaterial_ppj3i") 19 | anchors_preset = 15 20 | anchor_right = 1.0 21 | anchor_bottom = 1.0 22 | grow_horizontal = 2 23 | grow_vertical = 2 24 | mouse_filter = 2 25 | -------------------------------------------------------------------------------- /addons/post_processing/node/children/bloom.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=3 format=3 uid="uid://dvpfe511myfg5"] 2 | 3 | [ext_resource type="Shader" path="res://addons/post_processing/shaders/bloom.gdshader" id="1_qyxdw"] 4 | 5 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_qv2yl"] 6 | shader = ExtResource("1_qyxdw") 7 | shader_parameter/BlurAmount = null 8 | shader_parameter/FlareThreshold = null 9 | shader_parameter/Flares = null 10 | shader_parameter/FlareSpacing = null 11 | shader_parameter/Intensity = null 12 | shader_parameter/Saturation_ = null 13 | shader_parameter/FalloffStart = null 14 | shader_parameter/FalloffEnd = null 15 | 16 | [node name="Bloom" type="CanvasLayer"] 17 | 18 | [node name="SubViewportContainer" type="SubViewportContainer" parent="."] 19 | anchors_preset = 15 20 | anchor_right = 1.0 21 | anchor_bottom = 1.0 22 | grow_horizontal = 2 23 | grow_vertical = 2 24 | mouse_filter = 2 25 | stretch = true 26 | 27 | [node name="SubViewport" type="SubViewport" parent="SubViewportContainer"] 28 | handle_input_locally = false 29 | size = Vector2i(1152, 648) 30 | render_target_update_mode = 4 31 | 32 | [node name="TextureRect" type="ColorRect" parent="."] 33 | z_index = 105 34 | material = SubResource("ShaderMaterial_qv2yl") 35 | anchors_preset = 15 36 | anchor_right = 1.0 37 | anchor_bottom = 1.0 38 | grow_horizontal = 2 39 | grow_vertical = 2 40 | mouse_filter = 2 41 | -------------------------------------------------------------------------------- /addons/post_processing/node/children/blur.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=3 format=3 uid="uid://cxsuld87nxd0v"] 2 | 3 | [ext_resource type="Shader" path="res://addons/post_processing/shaders/blur.gdshader" id="1_6v1pv"] 4 | 5 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_efbmf"] 6 | shader = ExtResource("1_6v1pv") 7 | shader_parameter/lod = 4.615 8 | 9 | [node name="Blur" type="CanvasLayer"] 10 | layer = 101 11 | visible = false 12 | 13 | [node name="data" type="ColorRect" parent="."] 14 | material = SubResource("ShaderMaterial_efbmf") 15 | anchors_preset = 15 16 | anchor_right = 1.0 17 | anchor_bottom = 1.0 18 | grow_horizontal = 2 19 | grow_vertical = 2 20 | mouse_filter = 2 21 | -------------------------------------------------------------------------------- /addons/post_processing/node/children/circular_waves.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=5 format=3 uid="uid://b0770lwctcbti"] 2 | 3 | [ext_resource type="Shader" path="res://addons/post_processing/shaders/circularwaves.gdshader" id="1_s8hqx"] 4 | 5 | [sub_resource type="FastNoiseLite" id="FastNoiseLite_mq5id"] 6 | 7 | [sub_resource type="NoiseTexture2D" id="NoiseTexture2D_bheeo"] 8 | noise = SubResource("FastNoiseLite_mq5id") 9 | 10 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_6bcgb"] 11 | shader = ExtResource("1_s8hqx") 12 | shader_parameter/amplitude = 0.99 13 | shader_parameter/frequency = 15.0 14 | shader_parameter/rippleRate = 7.7 15 | shader_parameter/waveAmplitude = 0.1 16 | shader_parameter/waveFrequency = 4.39 17 | shader_parameter/blendingAmount = 0.6 18 | shader_parameter/noise = SubResource("NoiseTexture2D_bheeo") 19 | 20 | [node name="CircularWaves" type="CanvasLayer"] 21 | visible = false 22 | 23 | [node name="data" type="ColorRect" parent="."] 24 | material = SubResource("ShaderMaterial_6bcgb") 25 | anchors_preset = 15 26 | anchor_right = 1.0 27 | anchor_bottom = 1.0 28 | grow_horizontal = 2 29 | grow_vertical = 2 30 | mouse_filter = 2 31 | -------------------------------------------------------------------------------- /addons/post_processing/node/children/color_correction.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=3 format=3 uid="uid://q8472v8awese"] 2 | 3 | [ext_resource type="Shader" path="res://addons/post_processing/shaders/color_correction.gdshader" id="1_cf4sj"] 4 | 5 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_nmxm8"] 6 | shader = ExtResource("1_cf4sj") 7 | shader_parameter/tint = Color(1, 1, 1, 1) 8 | shader_parameter/brightness = 0.0 9 | shader_parameter/saturation = 0.0 10 | 11 | [node name="ColorCorrection" type="CanvasLayer"] 12 | visible = false 13 | 14 | [node name="data" type="ColorRect" parent="."] 15 | material = SubResource("ShaderMaterial_nmxm8") 16 | anchors_preset = 15 17 | anchor_right = 1.0 18 | anchor_bottom = 1.0 19 | grow_horizontal = 2 20 | grow_vertical = 2 21 | mouse_filter = 2 22 | -------------------------------------------------------------------------------- /addons/post_processing/node/children/directional_drift.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=3 format=3 uid="uid://xtejdfho465q"] 2 | 3 | [ext_resource type="Shader" path="res://addons/post_processing/shaders/directional_drift_shader.gdshader" id="1_5lpdk"] 4 | 5 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_directional_drift"] 6 | shader = ExtResource("1_5lpdk") 7 | shader_parameter/particle_color = Color(0.87, 0.78, 0.6, 1) 8 | shader_parameter/particle_density = 0.3 9 | shader_parameter/flow_speed = 1.0 10 | shader_parameter/pattern_scale = 30.0 11 | shader_parameter/flow_direction = Vector2(1, 0.5) 12 | shader_parameter/layer_velocity_ratio = 1.2 13 | 14 | [node name="directional_drift" type="CanvasLayer"] 15 | visible = false 16 | 17 | [node name="data" type="ColorRect" parent="."] 18 | material = SubResource("ShaderMaterial_directional_drift") 19 | anchors_preset = 15 20 | anchor_right = 1.0 21 | anchor_bottom = 1.0 22 | grow_horizontal = 2 23 | grow_vertical = 2 24 | mouse_filter = 2 25 | -------------------------------------------------------------------------------- /addons/post_processing/node/children/fish_eye.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=3 format=3 uid="uid://c5qv7q54m4xn6"] 2 | 3 | [ext_resource type="Shader" path="res://addons/post_processing/shaders/fish_eye.gdshader" id="1_eks6e"] 4 | 5 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_v56sw"] 6 | shader = ExtResource("1_eks6e") 7 | shader_parameter/aspect = 1.0 8 | shader_parameter/distortion = 1.0 9 | shader_parameter/radius = 1.0 10 | shader_parameter/alpha = 1.0 11 | shader_parameter/crop = 1.0 12 | shader_parameter/crop_color = Color(0, 0, 0, 1) 13 | 14 | [node name="FishEye" type="CanvasLayer"] 15 | layer = 103 16 | visible = false 17 | 18 | [node name="data" type="ColorRect" parent="."] 19 | material = SubResource("ShaderMaterial_v56sw") 20 | anchors_preset = 15 21 | anchor_right = 1.0 22 | anchor_bottom = 1.0 23 | grow_horizontal = 2 24 | grow_vertical = 2 25 | mouse_filter = 2 26 | -------------------------------------------------------------------------------- /addons/post_processing/node/children/glitch.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=3 format=3 uid="uid://dwioerk4ps6rr"] 2 | 3 | [ext_resource type="Shader" path="res://addons/post_processing/shaders/glitch.gdshader" id="1_3euvy"] 4 | 5 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_gdr74"] 6 | shader = ExtResource("1_3euvy") 7 | shader_parameter/range = 0.05 8 | shader_parameter/noiseQuality = 250.0 9 | shader_parameter/noiseIntensity = 0.0088 10 | shader_parameter/offsetIntensity = 0.03 11 | shader_parameter/colorOffsetIntensity = 1.3 12 | 13 | [node name="Glitch" type="CanvasLayer"] 14 | layer = 104 15 | visible = false 16 | 17 | [node name="data" type="ColorRect" parent="."] 18 | material = SubResource("ShaderMaterial_gdr74") 19 | anchors_preset = 15 20 | anchor_right = 1.0 21 | anchor_bottom = 1.0 22 | grow_horizontal = 2 23 | grow_vertical = 2 24 | mouse_filter = 2 25 | -------------------------------------------------------------------------------- /addons/post_processing/node/children/grain.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=3 format=3 uid="uid://b2fkqs44w2304"] 2 | 3 | [ext_resource type="Shader" path="res://addons/post_processing/shaders/grain.gdshader" id="1_wos36"] 4 | 5 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_wb4vw"] 6 | render_priority = 0 7 | shader = ExtResource("1_wos36") 8 | 9 | [node name="Grain" type="CanvasLayer"] 10 | visible = false 11 | 12 | [node name="ColorRect" type="ColorRect" parent="."] 13 | material = SubResource("ShaderMaterial_wb4vw") 14 | anchors_preset = 15 15 | anchor_right = 1.0 16 | anchor_bottom = 1.0 17 | grow_horizontal = 2 18 | grow_vertical = 2 19 | mouse_filter = 2 20 | -------------------------------------------------------------------------------- /addons/post_processing/node/children/kaleidoscope.gdshader: -------------------------------------------------------------------------------- 1 | shader_type canvas_item; 2 | 3 | // CC0: Truchet + Kaleidoscope FTW 4 | // Bit of experimenting with kaleidoscopes and truchet turned out nice 5 | // Quite similar to an earlier shader I did but I utilized a different truchet pattern this time 6 | 7 | uniform float animate_speed = 0.25; 8 | uniform float resolution = 1.0; 9 | 10 | // License: Unknown, author: Unknown, found: don't remember 11 | vec4 alphaBlend(vec4 back, vec4 front) { 12 | float w = front.w + back.w*(1.0-front.w); 13 | vec3 xyz = (front.xyz*front.w + back.xyz*back.w*(1.0-front.w))/w; 14 | return w > 0.0 ? vec4(xyz, w) : vec4(0.0); 15 | 16 | } 17 | mat2 ROT(float a){ 18 | return mat2(vec2(cos(a),sin(a)),vec2(-sin(a),cos(a))); 19 | } 20 | float PCOS(float x){ 21 | return 0.5+0.5*cos(x); 22 | } 23 | 24 | // License: Unknown, author: Unknown, found: don't remember 25 | vec3 alphaBlend34(vec3 back, vec4 front) { 26 | return mix(back, front.xyz, front.w); 27 | } 28 | 29 | // License: Unknown, author: Unknown, found: don't remember 30 | float hashf(float co) { 31 | return fract(sin(co*12.9898) * 13758.5453); 32 | } 33 | 34 | // License: Unknown, author: Unknown, found: don't remember 35 | float hashv(vec2 p) { 36 | float a = dot(p, vec2 (127.1, 311.7)); 37 | return fract(sin (a)*43758.5453123); 38 | } 39 | 40 | // License: Unknown, author: Unknown, found: don't remember 41 | float tanh_approx(float x) { 42 | // Found this somewhere on the interwebs 43 | // return tanh(x); 44 | float x2 = x*x; 45 | return clamp(x*(27.0 + x2)/(27.0+9.0*x2), -1.0, 1.0); 46 | } 47 | 48 | // License: MIT, author: Inigo Quilez, found: https://www.iquilezles.org/www/articles/smin/smin.htm 49 | float pmin(float a, float b, float k) { 50 | float h = clamp(0.5+0.5*(b-a)/k, 0.0, 1.0); 51 | return mix(b, a, h) - k*h*(1.0-h); 52 | } 53 | 54 | // License: MIT, author: Inigo Quilez, found: https://www.iquilezles.org/www/index.htm 55 | vec3 postProcess(vec3 col, vec2 q) { 56 | col = clamp(col, 0.0, 1.0); 57 | col = pow(col, vec3(1.0/2.2)); 58 | col = col*0.6+0.4*col*col*(3.0-2.0*col); 59 | col = mix(col, vec3(dot(col, vec3(0.33))), -0.4); 60 | col *=0.5+0.5*pow(19.0*q.x*q.y*(1.0-q.x)*(1.0-q.y),0.7); 61 | return col; 62 | } 63 | 64 | float pmax(float a, float b, float k) { 65 | return -pmin(-a, -b, k); 66 | } 67 | 68 | float pabs(float a, float k) { 69 | return pmax(a, -a, k); 70 | } 71 | 72 | vec2 toPolar(vec2 p) { 73 | return vec2(length(p), atan(p.y, p.x)); 74 | } 75 | 76 | vec2 toRect(vec2 p) { 77 | return vec2(p.x*cos(p.y), p.x*sin(p.y)); 78 | } 79 | 80 | // License: MIT OR CC-BY-NC-4.0, author: mercury, found: https://mercury.sexy/hg_sdf/ 81 | float modMirror1(inout float p, float size) { 82 | float halfsize = size*0.5; 83 | float c = floor((p + halfsize)/size); 84 | p = mod(p + halfsize,size) - halfsize; 85 | p *= mod(c, 2.0)*2.0 - 1.0; 86 | return c; 87 | } 88 | 89 | float smoothKaleidoscope(inout vec2 p, float sm, float rep) { 90 | vec2 hp = p; 91 | 92 | vec2 hpp = toPolar(hp); 93 | float rn = modMirror1(hpp.y, 2.0*PI/rep); 94 | 95 | float sa = PI/rep - pabs(PI/rep - abs(hpp.y), sm); 96 | hpp.y = sign(hpp.y)*(sa); 97 | 98 | hp = toRect(hpp); 99 | 100 | p = hp; 101 | 102 | return rn; 103 | } 104 | 105 | // The path function 106 | vec3 offset(float z) { 107 | float a = z; 108 | vec2 p = -0.075*(vec2(cos(a), sin(a*sqrt(2.0))) + vec2(cos(a*sqrt(0.75)), sin(a*sqrt(0.5)))); 109 | return vec3(p, z); 110 | } 111 | 112 | // The derivate of the path function 113 | // Used to generate where we are looking 114 | vec3 doffset(float z) { 115 | float eps = 0.1; 116 | return 0.5*(offset(z + eps) - offset(z - eps))/eps; 117 | } 118 | 119 | // The second derivate of the path function 120 | // Used to generate tilt 121 | vec3 ddoffset(float z) { 122 | float eps = 0.1; 123 | return 0.125*(doffset(z + eps) - doffset(z - eps))/eps; 124 | } 125 | 126 | vec2 cell_df(float r, vec2 np, vec2 mp, vec2 off) { 127 | 128 | vec2 n0 = normalize(vec2(1.0, 1.0)); 129 | vec2 n1 = normalize(vec2(1.0, -1.0)); 130 | 131 | np += off; 132 | mp -= off; 133 | 134 | float hh = hashv(np); 135 | float h0 = hh; 136 | 137 | vec2 p0 = mp; 138 | p0 = abs(p0); 139 | p0 -= 0.5; 140 | float d0 = length(p0); 141 | float d1 = abs(d0-r); 142 | 143 | float dot0 = dot(n0, mp); 144 | float dot1 = dot(n1, mp); 145 | 146 | float d2 = abs(dot0); 147 | float t2 = dot1; 148 | d2 = abs(t2) > sqrt(0.5) ? d0 : d2; 149 | 150 | float d3 = abs(dot1); 151 | float t3 = dot0; 152 | d3 = abs(t3) > sqrt(0.5) ? d0 : d3; 153 | 154 | 155 | float d = d0; 156 | d = min(d, d1); 157 | if (h0 > .85) 158 | { 159 | d = min(d, d2); 160 | d = min(d, d3); 161 | } 162 | else if(h0 > 0.5) 163 | { 164 | d = min(d, d2); 165 | } 166 | else if(h0 > 0.15) 167 | { 168 | d = min(d, d3); 169 | } 170 | 171 | return vec2(d, (d0-r)); 172 | } 173 | 174 | vec2 truchet_df(float r, vec2 p) { 175 | vec2 np = floor(p+0.5); 176 | vec2 mp = fract(p+0.5) - 0.5; 177 | return cell_df(r, np, mp, vec2(0.0)); 178 | } 179 | 180 | vec4 plane(vec3 ro, vec3 rd, vec3 pp, vec3 off, float aa, float n) { 181 | float h_ = hashf(n); 182 | float h0 = fract(1777.0*h_); 183 | float h1 = fract(2087.0*h_); 184 | float h2 = fract(2687.0*h_); 185 | float h3 = fract(3167.0*h_); 186 | float h4 = fract(3499.0*h_); 187 | 188 | float l = length(pp - ro); 189 | 190 | vec3 hn; 191 | vec2 p = (pp-off*vec3(1.0, 1.0, 0.0)).xy; 192 | p *= ROT(0.5*(h4 - 0.5)*TIME); 193 | float rep = 2.0*round(mix(5.0, 30.0, h2)); 194 | float sm = 0.05*20.0/rep; 195 | float sn = smoothKaleidoscope(p, sm, rep); 196 | p *= ROT(2.0*PI*h0+0.025*TIME); 197 | float z = mix(0.2, 0.4, h3); 198 | p /= z; 199 | p+=0.5+floor(h1*1000.0); 200 | float tl = tanh_approx(0.33*l); 201 | float r = mix(0.30, 0.45, PCOS(0.1*n)); 202 | vec2 d2 = truchet_df(r, p); 203 | d2 *= z; 204 | float d = d2.x; 205 | float lw =0.025*z; 206 | d -= lw; 207 | 208 | vec3 col = mix(vec3(1.0), vec3(0.0), smoothstep(aa, -aa, d)); 209 | col = mix(col, vec3(0.0), smoothstep(mix(1.0, -0.5, tl), 1.0, sin(PI*100.0*d))); 210 | // float t0 = smoothstep(aa, -aa, -d2.y-lw); 211 | col = mix(col, vec3(0.0), step(d2.y, 0.0)); 212 | //float t = smoothstep(3.0*lw, 0.0, -d2.y); 213 | // float t = smoothstep(aa, -aa, -d2.y-lw); 214 | float t = smoothstep(aa, -aa, -d2.y-3.0*lw)*mix(0.5, 1.0, smoothstep(aa, -aa, -d2.y-lw)); 215 | return vec4(col, t); 216 | } 217 | 218 | vec3 skyColor(vec3 ro, vec3 rd) { 219 | float d = pow(max(dot(rd, vec3(0.0, 0.0, 1.0)), 0.0), 20.0); 220 | return vec3(d); 221 | } 222 | 223 | 224 | vec3 color(vec3 ww, vec3 uu, vec3 vv, vec3 ro, vec2 p){ 225 | float lp = length(p); 226 | vec2 np = p + 1.0/vec2(1920.0*resolution,1080.0*resolution) ; 227 | float rdd = (2.0+1.0*tanh_approx(lp)); 228 | // float rdd = 2.0; 229 | vec3 rd = normalize(p.x*uu + p.y*vv + rdd*ww); 230 | vec3 nrd = normalize(np.x*uu + np.y*vv + rdd*ww); 231 | 232 | float planeDist = 1.0-0.25; 233 | int furthest = 6; 234 | int fadeFrom = max(furthest-5, 0); 235 | 236 | float fadeDist = planeDist*float(furthest - fadeFrom); 237 | float nz = floor(ro.z / planeDist); 238 | 239 | vec3 skyCol = skyColor(ro, rd); 240 | 241 | 242 | vec4 acol = vec4(0.0); 243 | float cutOff = 0.95; 244 | bool cutOut = false; 245 | 246 | // Steps from nearest to furthest plane and accumulates the color 247 | for (int i = 1; i <= furthest; ++i) { 248 | float pz = planeDist*nz + planeDist*float(i); 249 | 250 | float pd = (pz - ro.z)/rd.z; 251 | 252 | if (pd > 0.0 && acol.w < cutOff) { 253 | vec3 pp = ro + rd*pd; 254 | vec3 npp = ro + nrd*pd; 255 | 256 | float aa = 3.0*length(pp - npp); 257 | 258 | vec3 off = offset(pp.z); 259 | 260 | vec4 pcol = plane(ro, rd, pp, off, aa, nz+float(i)); 261 | 262 | float nz1 = pp.z-ro.z; 263 | float fadeIn = smoothstep(planeDist*float(furthest), planeDist*float(fadeFrom), nz1); 264 | float fadeOut = smoothstep(0.0, planeDist*0.1, nz1); 265 | pcol.xyz = mix(skyCol, pcol.xyz, fadeIn); 266 | pcol.w *= fadeOut; 267 | pcol = clamp(pcol, 0.0, 1.0); 268 | 269 | acol = alphaBlend(pcol, acol); 270 | } else { 271 | cutOut = true; 272 | break; 273 | } 274 | 275 | } 276 | 277 | vec3 col = alphaBlend34(skyCol, acol); 278 | // To debug cutouts due to transparency 279 | // col += cutOut ? vec3(1.0, -1.0, 0.0) : vec3(0.0); 280 | return col; 281 | } 282 | vec3 effect(vec2 p, vec2 q) { 283 | float tm = TIME*animate_speed; 284 | vec3 ro = offset(tm); 285 | vec3 dro = doffset(tm); 286 | vec3 ddro = ddoffset(tm); 287 | 288 | vec3 ww = normalize(dro); 289 | vec3 uu = normalize(cross(normalize(vec3(0.0,1.0,0.0)+ddro), ww)); 290 | vec3 vv = normalize(cross(ww, uu)); 291 | 292 | vec3 col = color(ww, uu, vv, ro, p); 293 | 294 | return col; 295 | } 296 | void fragment(){ 297 | 298 | 299 | 300 | vec2 q = FRAGCOORD.xy/(1.0 / SCREEN_PIXEL_SIZE).xy; 301 | vec2 p = -1. + 2. * q; 302 | p.x *= (1.0 / SCREEN_PIXEL_SIZE).x/(1.0 / SCREEN_PIXEL_SIZE).y; 303 | 304 | vec3 col = effect(p, q); 305 | col *= smoothstep(0.0, 4.0, TIME); 306 | col = postProcess(col, q); 307 | 308 | COLOR = vec4(col, 1.0); 309 | } -------------------------------------------------------------------------------- /addons/post_processing/node/children/outline.gdshader: -------------------------------------------------------------------------------- 1 | // NekotoArts YouTube: https://www.youtube.com/channel/UCD7K_FECPHTF0z5okAVlh0g 2 | // Adapted from https://www.shadertoy.com/view/ldsfRn 3 | 4 | shader_type canvas_item; 5 | 6 | uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap; 7 | 8 | uniform vec4 edge_color : source_color = vec4(0.0, 0.0, 0.0, 1.0); 9 | uniform float threshold = 0.0; 10 | uniform float blend = 0.01; 11 | 12 | float getGrayScale(sampler2D sampler, vec2 coods){ 13 | vec4 color = texture(sampler,coods); 14 | float gray = (color.r + color.g + color.b)/3.0; 15 | return gray; 16 | } 17 | 18 | void fragment(){ 19 | vec2 delta = vec2(0.0,0.003); 20 | vec2 iResolution = 1.0 / SCREEN_PIXEL_SIZE; 21 | float m = max(iResolution.x,iResolution.y); 22 | vec2 texCoords = SCREEN_UV; 23 | 24 | vec3 screen_color = texture(SCREEN_TEXTURE, SCREEN_UV).rgb; 25 | 26 | float c1y = getGrayScale(SCREEN_TEXTURE, texCoords.xy-delta/2.0); 27 | float c2y = getGrayScale(SCREEN_TEXTURE, texCoords.xy+delta/2.0); 28 | 29 | float c1x = getGrayScale(SCREEN_TEXTURE, texCoords.xy-delta.yx/2.0); 30 | float c2x = getGrayScale(SCREEN_TEXTURE, texCoords.xy+delta.yx/2.0); 31 | 32 | float dcdx = (c2x - c1x)/(delta.y*10.0); 33 | float dcdy = (c2y - c1y)/(delta.y*10.0); 34 | 35 | vec2 dcdi = vec2(dcdx,dcdy); 36 | float edge = length(dcdi)/10.0; 37 | edge = 1.0 - edge; 38 | edge = smoothstep(threshold, threshold + blend, edge); 39 | 40 | COLOR.rgb = mix(edge_color.rgb, screen_color.rgb, edge); 41 | } -------------------------------------------------------------------------------- /addons/post_processing/node/children/outline.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=3 format=3 uid="uid://c0d4h1un0350r"] 2 | 3 | [ext_resource type="Shader" path="res://addons/post_processing/node/children/outline.gdshader" id="1_x8jvf"] 4 | 5 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_yuki3"] 6 | shader = ExtResource("1_x8jvf") 7 | shader_parameter/edge_color = Color(0, 0, 0, 1) 8 | shader_parameter/threshold = 0.0 9 | shader_parameter/blend = 0.1 10 | 11 | [node name="Outline" type="CanvasLayer"] 12 | visible = false 13 | 14 | [node name="data" type="ColorRect" parent="."] 15 | material = SubResource("ShaderMaterial_yuki3") 16 | anchors_preset = 15 17 | anchor_right = 1.0 18 | anchor_bottom = 1.0 19 | grow_horizontal = 2 20 | grow_vertical = 2 21 | mouse_filter = 2 22 | -------------------------------------------------------------------------------- /addons/post_processing/node/children/palette.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=4 format=3 uid="uid://b31wqmjq3q7ad"] 2 | 3 | [ext_resource type="Shader" path="res://addons/post_processing/shaders/palette_limiter.gdshader" id="1_e4qfa"] 4 | [ext_resource type="Texture2D" uid="uid://nf2dcuadvrh7" path="res://addons/post_processing/assets/interesting_palette.png" id="2_y1cuq"] 5 | 6 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_x8ge8"] 7 | shader = ExtResource("1_e4qfa") 8 | shader_parameter/palette = ExtResource("2_y1cuq") 9 | 10 | [node name="Palette" type="CanvasLayer"] 11 | 12 | [node name="data" type="ColorRect" parent="."] 13 | material = SubResource("ShaderMaterial_x8ge8") 14 | anchors_preset = 15 15 | anchor_right = 1.0 16 | anchor_bottom = 1.0 17 | grow_horizontal = 2 18 | grow_vertical = 2 19 | mouse_filter = 2 20 | -------------------------------------------------------------------------------- /addons/post_processing/node/children/particle_storm.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=3 format=3 uid="uid://c0d4h1un0350r"] 2 | 3 | [ext_resource type="Shader" path="res://addons/post_processing/shaders/particle_storm.gdshader" id="1_wnruh"] 4 | 5 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_particle_storm"] 6 | shader = ExtResource("1_wnruh") 7 | shader_parameter/particle_color = Color(0.87, 0.78, 0.6, 1) 8 | shader_parameter/wind_direction = Vector2(1, 0.2) 9 | shader_parameter/wind_speed = 1.0 10 | shader_parameter/intensity = 0.5 11 | shader_parameter/chaos = 1.075 12 | shader_parameter/scale = 1.0 13 | shader_parameter/density = 1.0 14 | 15 | [node name="particle_storm" type="CanvasLayer"] 16 | visible = false 17 | 18 | [node name="data" type="ColorRect" parent="."] 19 | material = SubResource("ShaderMaterial_particle_storm") 20 | anchors_preset = 15 21 | anchor_right = 1.0 22 | anchor_bottom = 1.0 23 | grow_horizontal = 2 24 | grow_vertical = 2 25 | mouse_filter = 2 26 | -------------------------------------------------------------------------------- /addons/post_processing/node/children/pixelate.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=3 format=3 uid="uid://bs1yan5h4eao8"] 2 | 3 | [ext_resource type="Shader" path="res://addons/post_processing/shaders/pixelate.gdshader" id="1_yebq2"] 4 | 5 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_gfycf"] 6 | shader = ExtResource("1_yebq2") 7 | shader_parameter/pixelSize = 7 8 | 9 | [node name="Pixelate" type="CanvasLayer"] 10 | visible = false 11 | 12 | [node name="data" type="ColorRect" parent="."] 13 | material = SubResource("ShaderMaterial_gfycf") 14 | anchors_preset = 15 15 | anchor_right = 1.0 16 | anchor_bottom = 1.0 17 | grow_horizontal = 2 18 | grow_vertical = 2 19 | mouse_filter = 2 20 | -------------------------------------------------------------------------------- /addons/post_processing/node/children/screen_shake.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=3 format=3 uid="uid://b7k7vdwyhgqpd"] 2 | 3 | [ext_resource type="Shader" path="res://addons/post_processing/shaders/screen_shake.gdshader" id="1_62rht"] 4 | 5 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_4rxg5"] 6 | shader = ExtResource("1_62rht") 7 | shader_parameter/ShakeStrength = 0.1 8 | shader_parameter/FactorA = Vector2(100, 100) 9 | shader_parameter/FactorB = Vector2(1, 1) 10 | shader_parameter/magnitude = Vector2(0.01, 0.01) 11 | 12 | [node name="ScreenShake" type="CanvasLayer"] 13 | visible = false 14 | 15 | [node name="data" type="ColorRect" parent="."] 16 | material = SubResource("ShaderMaterial_4rxg5") 17 | anchors_preset = 15 18 | anchor_right = 1.0 19 | anchor_bottom = 1.0 20 | grow_horizontal = 2 21 | grow_vertical = 2 22 | mouse_filter = 2 23 | -------------------------------------------------------------------------------- /addons/post_processing/node/children/speed_lines.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=5 format=3 uid="uid://whsu0j72038r"] 2 | 3 | [ext_resource type="Shader" path="res://addons/post_processing/shaders/speed_lines.gdshader" id="1_2cyj1"] 4 | 5 | [sub_resource type="FastNoiseLite" id="FastNoiseLite_oyufo"] 6 | noise_type = 3 7 | frequency = 0.212 8 | 9 | [sub_resource type="NoiseTexture2D" id="NoiseTexture2D_yebuf"] 10 | width = 1080 11 | height = 1080 12 | seamless = true 13 | noise = SubResource("FastNoiseLite_oyufo") 14 | 15 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_uouvn"] 16 | shader = ExtResource("1_2cyj1") 17 | shader_parameter/line_color = Color(1, 1, 1, 0.768627) 18 | shader_parameter/line_count = 2.0 19 | shader_parameter/line_density = 0.056 20 | shader_parameter/line_faloff = 0.0 21 | shader_parameter/mask_size = 0.333 22 | shader_parameter/mask_edge = 0.372 23 | shader_parameter/animation_speed = 20.0 24 | shader_parameter/noise = SubResource("NoiseTexture2D_yebuf") 25 | 26 | [node name="SpeedLines" type="CanvasLayer"] 27 | visible = false 28 | 29 | [node name="data" type="ColorRect" parent="."] 30 | material = SubResource("ShaderMaterial_uouvn") 31 | anchors_preset = 15 32 | anchor_right = 1.0 33 | anchor_bottom = 1.0 34 | grow_horizontal = 2 35 | grow_vertical = 2 36 | mouse_filter = 2 37 | -------------------------------------------------------------------------------- /addons/post_processing/node/children/vignette.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=3 format=3 uid="uid://crm7gskny246i"] 2 | 3 | [ext_resource type="Shader" path="res://addons/post_processing/shaders/vignette.gdshader" id="1_1fqty"] 4 | 5 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_jiuwk"] 6 | shader = ExtResource("1_1fqty") 7 | shader_parameter/vignette_intensity = 1.48 8 | shader_parameter/vignette_opacity = 1.0 9 | shader_parameter/vignette_rgb = Color(0, 0, 0, 1) 10 | 11 | [node name="Vignette" type="CanvasLayer"] 12 | visible = false 13 | 14 | [node name="data" type="ColorRect" parent="."] 15 | material = SubResource("ShaderMaterial_jiuwk") 16 | anchors_preset = 15 17 | anchor_right = 1.0 18 | anchor_bottom = 1.0 19 | grow_horizontal = 2 20 | grow_vertical = 2 21 | mouse_filter = 2 22 | -------------------------------------------------------------------------------- /addons/post_processing/node/post_process.gd: -------------------------------------------------------------------------------- 1 | @tool 2 | extends CanvasLayer 3 | class_name PostProcess 4 | 5 | enum EffectType { 6 | ANALOG_MONITOR, 7 | ASCII, 8 | BLUR, 9 | CHROMATIC_ABERRATION, 10 | CIRCULAR_WAVES, 11 | COLOR_CORRECTION, 12 | CRT, 13 | DIRECTIONAL_DRIFT, 14 | FISHEYE, 15 | GLITCH, 16 | GRAIN, 17 | OUTLINE, 18 | PALETTE, 19 | PARTICLE_STORM, 20 | PIXELATE, 21 | SCREEN_SHAKE, 22 | SPEED_LINES, 23 | VIGNETTE, 24 | } 25 | 26 | ## Stores the instantiated color rect of an effect keyed to its EffectType 27 | var effects: Dictionary = {} 28 | 29 | @export_category("Post Process") 30 | @export var configuration : PostProcessingConfiguration 31 | @export var dynamically_update : bool = true 32 | 33 | 34 | func update_shaders() -> void: 35 | if not configuration: 36 | return 37 | for e in effects: 38 | var effect_canvas = effects[e] 39 | if effect_canvas: 40 | var effect_rect: ColorRect = effect_canvas.get_child(0) 41 | if effect_rect: 42 | _update_shader_parameters(e, effect_rect.material) 43 | effect_canvas.visible = _check_shader_visibility(e) 44 | 45 | 46 | func _update_shader_parameters( _type : EffectType, _material : Material) -> void: 47 | match _type: 48 | EffectType.PALETTE: 49 | _material.set_shader_parameter("palette", configuration.PalettePalette) 50 | EffectType.PIXELATE: 51 | _material.set_shader_parameter("pixelSize", configuration.PixelatePixelSize) 52 | EffectType.COLOR_CORRECTION: 53 | _material.set_shader_parameter("tint", configuration.ColorCorrectionTint) 54 | _material.set_shader_parameter("brightness", configuration.ColorCorrectionBrightness) 55 | _material.set_shader_parameter("saturation", configuration.ColorCorrectionSaturation) 56 | EffectType.CHROMATIC_ABERRATION: 57 | _material.set_shader_parameter("offset", configuration.StrenghtCA) 58 | EffectType.BLUR: 59 | _material.set_shader_parameter("lod", configuration.L_O_D) 60 | EffectType.FISHEYE: 61 | _material.set_shader_parameter("aspect", configuration.FishEyeAspect) 62 | _material.set_shader_parameter("distortion", configuration.FishEyeDistortion) 63 | _material.set_shader_parameter("radius", configuration.FishEyeRadius) 64 | _material.set_shader_parameter("alpha", configuration.FishEyeAlpha) 65 | _material.set_shader_parameter("crop", configuration.FishEyeCrop) 66 | _material.set_shader_parameter("crop_color", configuration.FishEyeCropColor) 67 | EffectType.VIGNETTE: 68 | _material.set_shader_parameter("vignette_intensity", configuration.VignetteIntensity) 69 | _material.set_shader_parameter("vignette_opacity", configuration.VignetteOpacity) 70 | _material.set_shader_parameter("vignette_rgb", configuration.VignetteR_G_B) 71 | EffectType.GLITCH: 72 | _material.set_shader_parameter("range", configuration.GlitchRange) 73 | _material.set_shader_parameter("noiseQuality", configuration.GlitchNoiseQuality) 74 | _material.set_shader_parameter("noiseIntensity", configuration.GlitchIntenity) 75 | _material.set_shader_parameter("offsetIntensity", configuration.GlitchOffset) 76 | _material.set_shader_parameter("colorOffsetIntensity", configuration.GlitchColorOffset) 77 | EffectType.OUTLINE: 78 | _material.set_shader_parameter("edge_color", configuration.OutlineColor) 79 | _material.set_shader_parameter("threshold", configuration.OutlineThreshold) 80 | _material.set_shader_parameter("blend", configuration.OutlineBlend) 81 | EffectType.SCREEN_SHAKE: 82 | _material.set_shader_parameter("ShakeStrength", configuration.ScreenShakePower) 83 | EffectType.ANALOG_MONITOR: 84 | _material.set_shader_parameter("res", configuration.AnalogMonitorResolution) 85 | EffectType.GRAIN: 86 | _material.set_shader_parameter("strength", configuration.GrainPower) 87 | EffectType.CIRCULAR_WAVES: 88 | _material.set_shader_parameter("amplitude", configuration.CircularWavesAmplitude) 89 | _material.set_shader_parameter("frequency", configuration.CircularWavesFrequency) 90 | _material.set_shader_parameter("rippleRate", configuration.CircularWavesRippleRate) 91 | EffectType.SPEED_LINES: 92 | _material.set_shader_parameter("line_color", configuration.SpeedLinesColor) 93 | _material.set_shader_parameter("line_count", configuration.SpeedLinesCount) 94 | _material.set_shader_parameter("line_density", configuration.SpeedLineDensity) 95 | _material.set_shader_parameter("animation_speed", configuration.SpeedLineSpeed) 96 | EffectType.ASCII: 97 | _material.set_shader_parameter("ascii_size", configuration.ASCIISize) 98 | EffectType.CRT: 99 | _material.set_shader_parameter("overlay", configuration.overlay) 100 | _material.set_shader_parameter("scanlines_opacity", configuration.scanlines_opacity) 101 | _material.set_shader_parameter("scanlines_width", configuration.scanlines_width) 102 | _material.set_shader_parameter("grille_opacity", configuration.grille_opacity) 103 | _material.set_shader_parameter("pixelate", configuration.pixelate) 104 | _material.set_shader_parameter("roll_speed", configuration.roll_speed) 105 | _material.set_shader_parameter("roll_size", configuration.roll_size) 106 | _material.set_shader_parameter("roll_variation", configuration.roll_variation) 107 | _material.set_shader_parameter("distort_intensity", configuration.distort_intensity) 108 | _material.set_shader_parameter("noise_opacity", configuration.noise_opacity) 109 | _material.set_shader_parameter("noise_speed", configuration.noise_speed) 110 | _material.set_shader_parameter("static_noise_intensity", configuration.static_noise_intensity) 111 | _material.set_shader_parameter("aberration", configuration.aberration) 112 | _material.set_shader_parameter("brightness", configuration.brightness) 113 | _material.set_shader_parameter("discolor", configuration.discolor) 114 | _material.set_shader_parameter("warp_amount", configuration.warp_amount) 115 | _material.set_shader_parameter("clip_warp", configuration.clip_warp) 116 | _material.set_shader_parameter("vignette_intensity", configuration.vignette_intensity) 117 | _material.set_shader_parameter("vignette_opacity", configuration.vignette_opacity) 118 | EffectType.PARTICLE_STORM: # Add new case 119 | _material.set_shader_parameter("particle_color", configuration.particle_storm_color) 120 | _material.set_shader_parameter("wind_direction", configuration.particle_storm_wind_direction) 121 | _material.set_shader_parameter("wind_speed", configuration.particle_storm_wind_speed) 122 | _material.set_shader_parameter("intensity", configuration.particle_storm_intensity) 123 | _material.set_shader_parameter("chaos", configuration.particle_storm_chaos) 124 | _material.set_shader_parameter("scale", configuration.particle_storm_scale) 125 | _material.set_shader_parameter("density", configuration.particle_storm_density) 126 | EffectType.DIRECTIONAL_DRIFT: 127 | _material.set_shader_parameter("particle_color", configuration.directional_drift_color) 128 | _material.set_shader_parameter("particle_density", configuration.directional_drift_density) 129 | _material.set_shader_parameter("flow_speed", configuration.directional_drift_speed) 130 | _material.set_shader_parameter("pattern_scale", configuration.directional_drift_scale) 131 | _material.set_shader_parameter("flow_direction", configuration.directional_drift_direction) 132 | _material.set_shader_parameter("layer_velocity_ratio", configuration.directional_drift_layer_ratio) 133 | _: 134 | push_error("Unhandled/Invalid EffectType: " + str(_type)) 135 | 136 | 137 | func _check_shader_visibility(_type: EffectType) -> bool: 138 | match _type: 139 | EffectType.ASCII: 140 | return configuration.ASCII 141 | EffectType.ANALOG_MONITOR: 142 | return configuration.AnalogMonitor 143 | EffectType.BLUR: 144 | return configuration.Blur 145 | EffectType.CHROMATIC_ABERRATION: 146 | return configuration.ChromaticAberration 147 | EffectType.CIRCULAR_WAVES: 148 | return configuration.CircularWaves 149 | EffectType.COLOR_CORRECTION: 150 | return configuration.ColorCorrection 151 | EffectType.CRT: 152 | return configuration.CRT 153 | EffectType.GLITCH: 154 | return configuration.Glitch 155 | EffectType.GRAIN: 156 | return configuration.Grain 157 | EffectType.FISHEYE: 158 | return configuration.FishEye 159 | EffectType.OUTLINE: 160 | return configuration.Outline 161 | EffectType.PALETTE: 162 | return configuration.Palette 163 | EffectType.PIXELATE: 164 | return configuration.Pixelate 165 | EffectType.SCREEN_SHAKE: 166 | return configuration.ScreenShake 167 | EffectType.SPEED_LINES: 168 | return configuration.SpeedLines 169 | EffectType.VIGNETTE: 170 | return configuration.Vignette 171 | EffectType.PARTICLE_STORM: 172 | return configuration.particle_storm 173 | EffectType.DIRECTIONAL_DRIFT: 174 | return configuration.directional_drift 175 | _: 176 | push_error("Unhandled/Invalid EffectType: " + str(_type)) 177 | return false 178 | 179 | 180 | func _ready(): 181 | _add_canvas_layer_children("res://addons/post_processing/node/children/ChromaticAberration.tscn", EffectType.CHROMATIC_ABERRATION) 182 | _add_canvas_layer_children("res://addons/post_processing/node/children/blur.tscn", EffectType.BLUR) 183 | _add_canvas_layer_children("res://addons/post_processing/node/children/fish_eye.tscn", EffectType.FISHEYE) 184 | _add_canvas_layer_children("res://addons/post_processing/node/children/vignette.tscn", EffectType.VIGNETTE) 185 | _add_canvas_layer_children("res://addons/post_processing/node/children/glitch.tscn", EffectType.GLITCH) 186 | _add_canvas_layer_children("res://addons/post_processing/node/children/outline.tscn", EffectType.OUTLINE) 187 | _add_canvas_layer_children("res://addons/post_processing/node/children/screen_shake.tscn", EffectType.SCREEN_SHAKE) 188 | _add_canvas_layer_children("res://addons/post_processing/node/children/analog_monitor.tscn", EffectType.ANALOG_MONITOR) 189 | _add_canvas_layer_children("res://addons/post_processing/node/children/grain.tscn", EffectType.GRAIN) 190 | _add_canvas_layer_children("res://addons/post_processing/node/children/circular_waves.tscn", EffectType.CIRCULAR_WAVES) 191 | _add_canvas_layer_children("res://addons/post_processing/node/children/speed_lines.tscn", EffectType.SPEED_LINES) 192 | _add_canvas_layer_children("res://addons/post_processing/node/children/ascii.tscn", EffectType.ASCII) 193 | _add_canvas_layer_children("res://addons/post_processing/node/children/CRT.tscn", EffectType.CRT) 194 | _add_canvas_layer_children("res://addons/post_processing/node/children/color_correction.tscn", EffectType.COLOR_CORRECTION) 195 | _add_canvas_layer_children("res://addons/post_processing/node/children/pixelate.tscn", EffectType.PIXELATE) 196 | _add_canvas_layer_children("res://addons/post_processing/node/children/palette.tscn", EffectType.PALETTE) 197 | _add_canvas_layer_children("res://addons/post_processing/node/children/particle_storm.tscn", EffectType.PARTICLE_STORM) 198 | _add_canvas_layer_children("res://addons/post_processing/node/children/directional_drift.tscn", EffectType.DIRECTIONAL_DRIFT) 199 | 200 | var null_effects: PackedStringArray = [] 201 | for e in effects: 202 | if (not effects.has(e)) or effects[e] == null: 203 | null_effects.append(EffectType.keys()[e]) 204 | if not null_effects.is_empty(): # Not all effects were added 205 | var null_warning = "" 206 | for e in null_effects: 207 | null_warning += e + " " 208 | push_warning("Post process effects missing: " + null_warning) 209 | 210 | update_shaders() 211 | 212 | 213 | func _enter_tree(): 214 | update_shaders() 215 | 216 | 217 | func _add_canvas_layer_children(_path : String, _type: EffectType) -> void: 218 | var child_instance = load(_path).instantiate() 219 | add_child(child_instance) 220 | var data = child_instance.get_child(0) 221 | var material_instance = data.material.duplicate() 222 | data.material = material_instance 223 | effects[_type] = child_instance 224 | 225 | 226 | func _process(delta): 227 | if not configuration: 228 | return 229 | if configuration.reload and (dynamically_update or Engine.is_editor_hint()): 230 | configuration.reload = false 231 | update_shaders() 232 | -------------------------------------------------------------------------------- /addons/post_processing/node/post_process.svg: -------------------------------------------------------------------------------- 1 | 2 | Projekt bez nazwy (2) 3 | 4 | 5 | 6 | 8 | 9 | -------------------------------------------------------------------------------- /addons/post_processing/node/post_process.svg.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://c76ob2amhl0ln" 6 | path="res://.godot/imported/post_process.svg-a28c497815b0e679908309d25a9b379d.ctex" 7 | metadata={ 8 | "has_editor_variant": true, 9 | "vram_texture": false 10 | } 11 | 12 | [deps] 13 | 14 | source_file="res://addons/post_processing/node/post_process.svg" 15 | dest_files=["res://.godot/imported/post_process.svg-a28c497815b0e679908309d25a9b379d.ctex"] 16 | 17 | [params] 18 | 19 | compress/mode=0 20 | compress/high_quality=false 21 | compress/lossy_quality=0.7 22 | compress/hdr_compression=1 23 | compress/normal_map=0 24 | compress/channel_pack=0 25 | mipmaps/generate=false 26 | mipmaps/limit=-1 27 | roughness/mode=0 28 | roughness/src_normal="" 29 | process/fix_alpha_border=true 30 | process/premult_alpha=false 31 | process/normal_map_invert_y=false 32 | process/hdr_as_srgb=false 33 | process/hdr_clamp_exposure=false 34 | process/size_limit=0 35 | detect_3d/compress_to=1 36 | svg/scale=1.0 37 | editor/scale_with_editor_scale=false 38 | editor/convert_colors_with_editor_theme=true 39 | -------------------------------------------------------------------------------- /addons/post_processing/plugin.cfg: -------------------------------------------------------------------------------- 1 | [plugin] 2 | 3 | name="PostProcessing" 4 | description="Simple Post Processing Plugin" 5 | author="Korin" 6 | version="0.1.0" 7 | script="plugin.gd" 8 | -------------------------------------------------------------------------------- /addons/post_processing/plugin.gd: -------------------------------------------------------------------------------- 1 | @tool 2 | extends EditorPlugin 3 | 4 | 5 | func _enter_tree(): 6 | add_custom_type("PostProcess", "CanvasLayer", load("res://addons/post_processing/node/post_process.gd"), load("res://addons/post_processing/node/post_process.svg")) 7 | 8 | 9 | func _exit_tree(): 10 | remove_custom_type("PostProcess") 11 | -------------------------------------------------------------------------------- /addons/post_processing/resource/fish_eye_example.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="PostProcessingConfiguration" load_steps=2 format=3 uid="uid://dg8amcb0jcyas"] 2 | 3 | [ext_resource type="Script" path="res://addons/post_processing/resource/post_processing_configuration.gd" id="1_3y12k"] 4 | 5 | [resource] 6 | script = ExtResource("1_3y12k") 7 | reload = false 8 | ASCII = false 9 | ASCIISize = Vector2(4, 9) 10 | ChromaticAberration = false 11 | StrenghtCA = 1.0 12 | Blur = false 13 | L_O_D = 1.0 14 | FishEye = true 15 | FishEyeAspect = 1.0 16 | FishEyeDistortion = 0.5 17 | FishEyeRadius = 1.0 18 | FishEyeAlpha = 1.0 19 | FishEyeCrop = 1.0 20 | FishEyeCropColor = Color(0, 0, 0, 1) 21 | Vignette = false 22 | VignetteIntensity = 0.4 23 | VignetteOpacity = 0.5 24 | VignetteR_G_B = Color(0, 0, 0, 1) 25 | Glitch = false 26 | GlitchRange = 0.05 27 | GlitchNoiseQuality = 250.0 28 | GlitchIntenity = 0.0088 29 | GlitchOffset = 0.03 30 | GlitchColorOffset = 1.3 31 | Outline = false 32 | OutlineColor = Color(0, 0, 0, 1) 33 | OutlineThreshold = 0.0 34 | OutlineBlend = 0.01 35 | ScreenShake = false 36 | ScreenShakePower = 0.1 37 | AnalogMonitor = false 38 | AnalogMonitorResolution = Vector2(256, 256) 39 | Grain = false 40 | GrainPower = 75 41 | CircularWaves = false 42 | CircularWavesAmplitude = 2.0 43 | CircularWavesFrequency = 12.69 44 | CircularWavesRippleRate = 9.2 45 | SpeedLines = false 46 | SpeedLinesColor = Color(1, 1, 1, 1) 47 | SpeedLinesCount = 2 48 | SpeedLineDensity = 0.072 49 | SpeedLineSpeed = 20 50 | -------------------------------------------------------------------------------- /addons/post_processing/resource/no_effects_example.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" script_class="PostProcessingConfiguration" load_steps=2 format=3 uid="uid://c0dsfxhwb8bwe"] 2 | 3 | [ext_resource type="Script" path="res://addons/post_processing/resource/post_processing_configuration.gd" id="1_6y0uy"] 4 | 5 | [resource] 6 | script = ExtResource("1_6y0uy") 7 | reload = false 8 | ASCII = false 9 | ASCIISize = Vector2(4, 9) 10 | ChromaticAberration = false 11 | StrenghtCA = 1.0 12 | Blur = false 13 | L_O_D = 1.0 14 | FishEye = false 15 | FishEyeAspect = 1.0 16 | FishEyeDistortion = 1.0 17 | FishEyeRadius = 1.0 18 | FishEyeAlpha = 1.0 19 | FishEyeCrop = 1.0 20 | FishEyeCropColor = Color(0, 0, 0, 1) 21 | Vignette = false 22 | VignetteIntensity = 0.4 23 | VignetteOpacity = 0.5 24 | VignetteR_G_B = Color(0, 0, 0, 1) 25 | Glitch = false 26 | GlitchRange = 0.05 27 | GlitchNoiseQuality = 250.0 28 | GlitchIntenity = 0.0088 29 | GlitchOffset = 0.03 30 | GlitchColorOffset = 1.3 31 | Outline = false 32 | OutlineColor = Color(0, 0, 0, 1) 33 | OutlineThreshold = 0.0 34 | OutlineBlend = 0.01 35 | Grain = false 36 | GrainPower = 75 37 | CircularWaves = false 38 | CircularWavesAmplitude = 2.0 39 | CircularWavesFrequency = 12.69 40 | CircularWavesRippleRate = 9.2 41 | SpeedLines = false 42 | SpeedLinesColor = Color(1, 1, 1, 1) 43 | SpeedLinesCount = 2 44 | SpeedLineDensity = 0.072 45 | SpeedLineSpeed = 20 46 | particle_storm = false 47 | particle_storm_color = Color(0.87, 0.78, 0.6, 1) 48 | particle_storm_intensity = 0.5 49 | particle_storm_chaos = 1.0 50 | particle_storm_scale = 1.0 51 | particle_storm_density = 1.0 52 | particle_storm_wind_direction = Vector2(1, 0.2) 53 | particle_storm_wind_speed = 1.0 54 | ColorCorrection = false 55 | ColorCorrectionTint = Color(0, 0, 0, 1) 56 | ColorCorrectionBrightness = 0.0 57 | ColorCorrectionSaturation = 0.0 58 | Palette = false 59 | Pixelate = false 60 | PixelatePixelSize = 8 61 | CRT = false 62 | overlay = false 63 | scanlines_opacity = 0.4 64 | scanlines_width = 0.25 65 | grille_opacity = 0.3 66 | pixelate = true 67 | roll_speed = 8.0 68 | roll_size = 15.0 69 | roll_variation = 1.8 70 | distort_intensity = 0.05 71 | noise_opacity = 0.4 72 | noise_speed = 5.0 73 | static_noise_intensity = 0.06 74 | aberration = 0.03 75 | brightness = 1.4 76 | discolor = true 77 | warp_amount = 1.0 78 | clip_warp = false 79 | vignette_intensity = 0.4 80 | vignette_opacity = 0.5 81 | AnalogMonitor = false 82 | AnalogMonitorResolution = Vector2(256, 256) 83 | ScreenShake = false 84 | ScreenShakePower = 0.1 85 | -------------------------------------------------------------------------------- /addons/post_processing/resource/post_processing_configuration.gd: -------------------------------------------------------------------------------- 1 | class_name PostProcessingConfiguration extends Resource 2 | 3 | # post-processing-config based system by loufe 4 | @export_group("Settings") 5 | @export var reload: bool 6 | @export_group("Visual Effects") 7 | @export_subgroup("ASCII (No Color)") 8 | @export var ASCII: bool: 9 | set(value): 10 | ASCII = value 11 | reload = true 12 | @export var ASCIISize: Vector2 = Vector2(4,9): 13 | set(value): 14 | ASCIISize = value 15 | reload = true 16 | @export_subgroup("Chromatic Aberration") 17 | @export var ChromaticAberration: bool: 18 | set(value): 19 | ChromaticAberration = value 20 | reload = true 21 | @export var StrenghtCA: float = 1: 22 | set(value): 23 | StrenghtCA = value 24 | reload = true 25 | @export_subgroup("Blur") 26 | @export var Blur: bool: 27 | set(value): 28 | Blur = value 29 | reload = true 30 | @export_range(0.0, 5) var L_O_D = 1.0: 31 | set(value): 32 | L_O_D = value 33 | reload = true 34 | @export_subgroup("Fish Eye") 35 | @export var FishEye: bool: 36 | set(value): 37 | FishEye = value 38 | reload = true 39 | @export var FishEyeAspect = 1.0: 40 | set(value): 41 | FishEyeAspect = value 42 | reload = true 43 | @export var FishEyeDistortion = 1.0: 44 | set(value): 45 | FishEyeDistortion = value 46 | reload = true 47 | @export var FishEyeRadius = 1.0: 48 | set(value): 49 | FishEyeRadius = value 50 | reload = true 51 | @export var FishEyeAlpha = 1.0: 52 | set(value): 53 | FishEyeAlpha = value 54 | reload = true 55 | @export var FishEyeCrop = 1.0: 56 | set(value): 57 | FishEyeCrop = value 58 | reload = true 59 | @export var FishEyeCropColor = Color.BLACK: 60 | set(value): 61 | FishEyeCropColor = value 62 | reload = true 63 | @export_subgroup("Vignette") 64 | @export var Vignette: bool: 65 | set(value): 66 | Vignette = value 67 | reload = true 68 | @export var VignetteIntensity = 0.4: 69 | set(value): 70 | VignetteIntensity = value 71 | reload = true 72 | @export_range(0.0, 1.0) var VignetteOpacity = 0.5: 73 | set(value): 74 | VignetteOpacity = value 75 | reload = true 76 | @export var VignetteR_G_B: Color = Color(0.0, 0.0, 0.0, 1.0): 77 | set(value): 78 | VignetteR_G_B = value 79 | reload = true 80 | @export_subgroup("Glitch") 81 | @export var Glitch: bool: 82 | set(value): 83 | Glitch = value 84 | reload = true 85 | @export_range(0.0, 0.1, 0.005) var GlitchRange = 0.05: 86 | set(value): 87 | GlitchRange = value 88 | reload = true 89 | @export_range(0.0, 300, 0.1) var GlitchNoiseQuality = 250.0: 90 | set(value): 91 | GlitchNoiseQuality = value 92 | reload = true 93 | @export_range(-0.6, 0.6, 0.0010) var GlitchIntenity = 0.0088: 94 | set(value): 95 | GlitchIntenity = value 96 | reload = true 97 | @export_range(-0.1, 0.1, 0.001) var GlitchOffset = 0.03: 98 | set(value): 99 | GlitchOffset = value 100 | reload = true 101 | @export_range(0.0, 5.0, 0.001) var GlitchColorOffset = 1.3: 102 | set(value): 103 | GlitchColorOffset = value 104 | reload = true 105 | @export_subgroup("Outline") 106 | @export var Outline: bool: 107 | set(value): 108 | Outline = value 109 | reload = true 110 | @export var OutlineColor: Color = Color(0.0, 0.0, 0.0, 1.0): 111 | set(value): 112 | OutlineColor = value 113 | reload = true 114 | @export_range(0.0, 1.0) var OutlineThreshold = 0.0: 115 | set(value): 116 | OutlineThreshold = value 117 | reload = true 118 | @export_range(0.0, 1.0) var OutlineBlend = 0.01: 119 | set(value): 120 | OutlineBlend = value 121 | reload = true 122 | @export_subgroup("Grain") 123 | @export var Grain: bool: 124 | set(value): 125 | Grain = value 126 | reload = true 127 | @export_range(0, 150, 0.1) var GrainPower = 75: 128 | set(value): 129 | GrainPower = value 130 | reload = true 131 | @export_subgroup("Circular Waves") 132 | @export var CircularWaves: bool: 133 | set(value): 134 | CircularWaves = value 135 | reload = true 136 | @export_range(0,2, 0.01) var CircularWavesAmplitude = 2.0: 137 | set(value): 138 | CircularWavesAmplitude = value 139 | reload = true 140 | @export_range(0, 15, 0.01) var CircularWavesFrequency = 12.69: 141 | set(value): 142 | CircularWavesFrequency = value 143 | reload = true 144 | @export_range(0.5, 150.0, 0.1) var CircularWavesRippleRate = 9.2: 145 | set(value): 146 | CircularWavesRippleRate = value 147 | reload = true 148 | @export_subgroup("Speed Lines") 149 | @export var SpeedLines: bool: 150 | set(value): 151 | SpeedLines = value 152 | reload = true 153 | @export var SpeedLinesColor: Color = Color.WHITE: 154 | set(value): 155 | SpeedLinesColor = value 156 | reload = true 157 | @export_range(0,2, 0.05) var SpeedLinesCount = 2: 158 | set(value): 159 | SpeedLinesCount = value 160 | reload = true 161 | @export_range(0.0, 1.0) var SpeedLineDensity = 0.072: 162 | set(value): 163 | SpeedLineDensity = value 164 | reload = true 165 | @export_range(1.0, 40.0, 1.0) var SpeedLineSpeed = 20: 166 | set(value): 167 | SpeedLineSpeed = value 168 | reload = true 169 | @export_subgroup("Particle Storm") 170 | @export var particle_storm: bool: 171 | set(value): 172 | particle_storm = value 173 | reload = true 174 | @export var particle_storm_color: Color = Color(0.87, 0.78, 0.60, 1.0): 175 | set(value): 176 | particle_storm_color = value 177 | reload = true 178 | @export_range(0.0, 10.0) var particle_storm_intensity = 0.5: 179 | set(value): 180 | particle_storm_intensity = value 181 | reload = true 182 | @export_range(0.0, 10.0) var particle_storm_chaos = 1.0: 183 | set(value): 184 | particle_storm_chaos = value 185 | reload = true 186 | @export_range(0.5, 10.0) var particle_storm_scale = 1.0: 187 | set(value): 188 | particle_storm_scale = value 189 | reload = true 190 | @export_range(0.0, 10.0) var particle_storm_density = 1.0: 191 | set(value): 192 | particle_storm_density = value 193 | reload = true 194 | @export var particle_storm_wind_direction = Vector2(1.0, 0.2): 195 | set(value): 196 | particle_storm_wind_direction = value 197 | reload = true 198 | @export_range(0.1, 5.0) var particle_storm_wind_speed = 1.0: 199 | set(value): 200 | particle_storm_wind_speed = value 201 | reload = true 202 | @export_subgroup("Directional Drift") 203 | @export var directional_drift: bool: 204 | set(value): 205 | directional_drift = value 206 | reload = true 207 | @export var directional_drift_color: Color = Color(0.76, 0.69, 0.5, 0.3): 208 | set(value): 209 | directional_drift_color = value 210 | reload = true 211 | @export_range(0.0, 3.0) var directional_drift_density = 0.3: 212 | set(value): 213 | directional_drift_density = value 214 | reload = true 215 | @export_range(0.0, 5.0) var directional_drift_speed = 1.0: 216 | set(value): 217 | directional_drift_speed = value 218 | reload = true 219 | @export var directional_drift_scale = 30.0: 220 | set(value): 221 | directional_drift_scale = value 222 | reload = true 223 | @export var directional_drift_direction = Vector2(1.0, 0.5): 224 | set(value): 225 | directional_drift_direction = value 226 | reload = true 227 | @export_range(0.1, 5.0) var directional_drift_layer_ratio = 1.2: 228 | set(value): 229 | directional_drift_layer_ratio = value 230 | reload = true 231 | 232 | 233 | @export_group("Display") 234 | @export_subgroup("Color Correction") 235 | @export var ColorCorrection: bool: 236 | set(value): 237 | ColorCorrection = value 238 | reload = true 239 | @export var ColorCorrectionTint : Color: 240 | set(value): 241 | ColorCorrectionTint = value 242 | reload = true 243 | @export_range(-1.0, 1.0) var ColorCorrectionBrightness : float = 0: 244 | set(value): 245 | ColorCorrectionBrightness = value 246 | reload = true 247 | @export_range(-1.0, 1.0) var ColorCorrectionSaturation : float = 0: 248 | set(value): 249 | ColorCorrectionSaturation = value 250 | reload = true 251 | @export_subgroup("Palette") 252 | @export var Palette : bool: 253 | set(value): 254 | Palette = value 255 | reload = true 256 | @export var PalettePalette : Texture2D: 257 | set(value): 258 | PalettePalette = value 259 | reload = true 260 | @export_subgroup("Pixelate") 261 | @export var Pixelate : bool: 262 | set(value): 263 | Pixelate = value 264 | reload = true 265 | @export_range(0, 64) var PixelatePixelSize = 8: 266 | set(value): 267 | PixelatePixelSize = value 268 | reload = true 269 | @export_subgroup("CRT") 270 | @export var CRT: bool: 271 | set(value): 272 | CRT = value 273 | reload = true 274 | @export var overlay : bool = false: 275 | set(value): 276 | overlay = value 277 | reload = true 278 | @export_range(0.0, 1.0) var scanlines_opacity : float = 0.4: 279 | set(value): 280 | scanlines_opacity = value 281 | reload = true 282 | @export_range(0.0, 0.5) var scanlines_width : float = 0.25: 283 | set(value): 284 | scanlines_width = value 285 | reload = true 286 | @export_range(0.0, 1.0) var grille_opacity : float = 0.3: 287 | set(value): 288 | grille_opacity = value 289 | reload = true 290 | @export var pixelate : bool = true: 291 | set(value): 292 | pixelate = value 293 | reload = true 294 | @export var roll_speed : float = 8.0: 295 | set(value): 296 | roll_speed = value 297 | reload = true 298 | @export_range(0.0, 100.0) var roll_size : float = 15.0: 299 | set(value): 300 | roll_size = value 301 | reload = true 302 | @export_range(0.1, 5.0) var roll_variation : float = 1.8: 303 | set(value): 304 | roll_variation = value 305 | reload = true 306 | @export_range(0.0, 0.2) var distort_intensity : float = 0.05: 307 | set(value): 308 | distort_intensity = value 309 | reload = true 310 | @export_range(0.0, 1.0) var noise_opacity : float = 0.4: 311 | set(value): 312 | noise_opacity = value 313 | reload = true 314 | @export var noise_speed : float = 5.0: 315 | set(value): 316 | noise_speed = value 317 | reload = true 318 | @export_range(0.0, 1.0) var static_noise_intensity : float = 0.06: 319 | set(value): 320 | static_noise_intensity = value 321 | reload = true 322 | @export_range(-1.0, 1.0) var aberration : float = 0.03: 323 | set(value): 324 | aberration = value 325 | reload = true 326 | @export var brightness : float = 1.4: 327 | set(value): 328 | brightness = value 329 | reload = true 330 | @export var discolor : bool = true: 331 | set(value): 332 | discolor = value 333 | reload = true 334 | @export_range(0.0, 5.0) var warp_amount : float = 1.0: 335 | set(value): 336 | warp_amount = value 337 | reload = true 338 | @export var clip_warp : bool = false: 339 | set(value): 340 | clip_warp = value 341 | reload = true 342 | @export var vignette_intensity : float = 0.4: 343 | set(value): 344 | vignette_intensity = value 345 | reload = true 346 | @export_range(0.0, 1.0) var vignette_opacity : float = 0.5: 347 | set(value): 348 | vignette_opacity = value 349 | reload = true 350 | @export_subgroup("Analog Monitor") 351 | @export var AnalogMonitor: bool: 352 | set(value): 353 | AnalogMonitor = value 354 | reload = true 355 | @export var AnalogMonitorResolution = Vector2(256, 256): 356 | set(value): 357 | AnalogMonitorResolution = value 358 | reload = true 359 | @export_group("Other") 360 | @export_subgroup("Screen Shake") 361 | @export var ScreenShake: bool: 362 | set(value): 363 | ScreenShake = value 364 | reload = true 365 | @export var ScreenShakePower = 0.1: 366 | set(value): 367 | ScreenShakePower = value 368 | reload = true 369 | -------------------------------------------------------------------------------- /addons/post_processing/shaders/CLREDIT.gdshaderinc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ItsKorin/Godot-Post-Process-Plugin/6c42c8d557e56a130b260d8152c8f7716b50012f/addons/post_processing/shaders/CLREDIT.gdshaderinc -------------------------------------------------------------------------------- /addons/post_processing/shaders/CRT.gdshader: -------------------------------------------------------------------------------- 1 | /* 2 | Shader from Godot Shaders - the free shader library. 3 | godotshaders.com/shader/VHS-and-CRT-monitor-effect 4 | 5 | This shader is under CC0 license. Feel free to use, improve and 6 | change this shader according to your needs and consider sharing 7 | the modified result to godotshaders.com. 8 | */ 9 | 10 | shader_type canvas_item; 11 | 12 | //*** IMPORTANT! ***/ 13 | // - If you are using this shader to affect the node it is applied to set 'overlay' to false (unchecked in the instepctor). 14 | // - If you are using this shader as an overlay, and want the shader to affect the nodes below in the Scene hierarchy, 15 | // set 'overlay' to true (checked in the inspector). 16 | // On Mac there is potentially a bug causing this to not work properly. If that is the case and you want to use the shader as an overlay 17 | // change all "overlay ? SCREEN_TEXTURE : TEXTURE" to only "SCREEN_TEXTURE" on lines 129-140, and "vec2 uv = overlay ? warp(SCREEN_UV) : warp(UV);" 18 | // to "vec2 uv = warp(SCREEN_UV);" on line 98. 19 | uniform bool overlay = false; 20 | uniform sampler2D SCREEN_TEXTURE : source_color, hint_screen_texture, filter_nearest; 21 | 22 | uniform float scanlines_opacity : hint_range(0.0, 1.0) = 0.4; 23 | uniform float scanlines_width : hint_range(0.0, 0.5) = 0.25; 24 | uniform float grille_opacity : hint_range(0.0, 1.0) = 0.3; 25 | uniform vec2 resolution = vec2(640.0, 480.0); // Set the number of rows and columns the texture will be divided in. Scanlines and grille will make a square based on these values 26 | 27 | uniform bool pixelate = true; // Fill each square ("pixel") with a sampled color, creating a pixel look and a more accurate representation of how a CRT monitor would work. 28 | 29 | uniform bool roll = true; 30 | uniform float roll_speed = 8.0; // Positive values are down, negative are up 31 | uniform float roll_size : hint_range(0.0, 100.0) = 15.0; 32 | uniform float roll_variation : hint_range(0.1, 5.0) = 1.8; // This valie is not an exact science. You have to play around with the value to find a look you like. How this works is explained in the code below. 33 | uniform float distort_intensity : hint_range(0.0, 0.2) = 0.05; // The distortion created by the rolling effect. 34 | 35 | uniform float noise_opacity : hint_range(0.0, 1.0) = 0.4; 36 | uniform float noise_speed = 5.0; // There is a movement in the noise pattern that can be hard to see first. This sets the speed of that movement. 37 | 38 | uniform float static_noise_intensity : hint_range(0.0, 1.0) = 0.06; 39 | 40 | uniform float aberration : hint_range(-1.0, 1.0) = 0.03; // Chromatic aberration, a distortion on each color channel. 41 | uniform float brightness = 1.4; // When adding scanline gaps and grille the image can get very dark. Brightness tries to compensate for that. 42 | uniform bool discolor = true; // Add a discolor effect simulating a VHS 43 | 44 | uniform float warp_amount :hint_range(0.0, 5.0) = 1.0; // Warp the texture edges simulating the curved glass of a CRT monitor or old TV. 45 | uniform bool clip_warp = false; 46 | 47 | uniform float vignette_intensity = 0.4; // Size of the vignette, how far towards the middle it should go. 48 | uniform float vignette_opacity : hint_range(0.0, 1.0) = 0.5; 49 | 50 | // Used by the noise functin to generate a pseudo random value between 0.0 and 1.0 51 | vec2 random(vec2 uv){ 52 | uv = vec2( dot(uv, vec2(127.1,311.7) ), 53 | dot(uv, vec2(269.5,183.3) ) ); 54 | return -1.0 + 2.0 * fract(sin(uv) * 43758.5453123); 55 | } 56 | 57 | // Generate a Perlin noise used by the distortion effects 58 | float noise(vec2 uv) { 59 | vec2 uv_index = floor(uv); 60 | vec2 uv_fract = fract(uv); 61 | 62 | vec2 blur = smoothstep(0.0, 1.0, uv_fract); 63 | 64 | return mix( mix( dot( random(uv_index + vec2(0.0,0.0) ), uv_fract - vec2(0.0,0.0) ), 65 | dot( random(uv_index + vec2(1.0,0.0) ), uv_fract - vec2(1.0,0.0) ), blur.x), 66 | mix( dot( random(uv_index + vec2(0.0,1.0) ), uv_fract - vec2(0.0,1.0) ), 67 | dot( random(uv_index + vec2(1.0,1.0) ), uv_fract - vec2(1.0,1.0) ), blur.x), blur.y) * 0.5 + 0.5; 68 | } 69 | 70 | // Takes in the UV and warps the edges, creating the spherized effect 71 | vec2 warp(vec2 uv){ 72 | vec2 delta = uv - 0.5; 73 | float delta2 = dot(delta.xy, delta.xy); 74 | float delta4 = delta2 * delta2; 75 | float delta_offset = delta4 * warp_amount; 76 | 77 | return uv + delta * delta_offset; 78 | } 79 | 80 | // Adds a black border to hide stretched pixel created by the warp effect 81 | float border (vec2 uv){ 82 | float radius = min(warp_amount, 0.08); 83 | radius = max(min(min(abs(radius * 2.0), abs(1.0)), abs(1.0)), 1e-5); 84 | vec2 abs_uv = abs(uv * 2.0 - 1.0) - vec2(1.0, 1.0) + radius; 85 | float dist = length(max(vec2(0.0), abs_uv)) / radius; 86 | float square = smoothstep(0.96, 1.0, dist); 87 | return clamp(1.0 - square, 0.0, 1.0); 88 | } 89 | 90 | // Adds a vignette shadow to the edges of the image 91 | float vignette(vec2 uv){ 92 | uv *= 1.0 - uv.xy; 93 | float vignette = uv.x * uv.y * 15.0; 94 | return pow(vignette, vignette_intensity * vignette_opacity); 95 | } 96 | 97 | void fragment() 98 | { 99 | vec2 uv = overlay ? warp(SCREEN_UV) : warp(UV); // Warp the uv. uv will be used in most cases instead of UV to keep the warping 100 | vec2 text_uv = uv; 101 | vec2 roll_uv = vec2(0.0); 102 | float time = roll ? TIME : 0.0; 103 | 104 | 105 | // Pixelate the texture based on the given resolution. 106 | if (pixelate) 107 | { 108 | text_uv = ceil(uv * resolution) / resolution; 109 | } 110 | 111 | // Create the rolling effect. We need roll_line a bit later to make the noise effect. 112 | // That is why this runs if roll is true OR noise_opacity is over 0. 113 | float roll_line = 0.0; 114 | if (roll || noise_opacity > 0.0) 115 | { 116 | // Create the areas/lines where the texture will be distorted. 117 | roll_line = smoothstep(0.3, 0.9, sin(uv.y * roll_size - (time * roll_speed) ) ); 118 | // Create more lines of a different size and apply to the first set of lines. This creates a bit of variation. 119 | roll_line *= roll_line * smoothstep(0.3, 0.9, sin(uv.y * roll_size * roll_variation - (time * roll_speed * roll_variation) ) ); 120 | // Distort the UV where where the lines are 121 | roll_uv = vec2(( roll_line * distort_intensity * (1.-UV.x)), 0.0); 122 | } 123 | 124 | vec4 text; 125 | if (roll) 126 | { 127 | // If roll is true distort the texture with roll_uv. The texture is split up into RGB to 128 | // make some chromatic aberration. We apply the aberration to the red and green channels accorging to the aberration parameter 129 | // and intensify it a bit in the roll distortion. 130 | text.r = texture(SCREEN_TEXTURE, text_uv + roll_uv * 0.8 + vec2(aberration, 0.0) * .1).r; 131 | text.g = texture(SCREEN_TEXTURE, text_uv + roll_uv * 1.2 - vec2(aberration, 0.0) * .1 ).g; 132 | text.b = texture(SCREEN_TEXTURE, text_uv + roll_uv).b; 133 | text.a = 1.0; 134 | } 135 | else 136 | { 137 | // If roll is false only apply the aberration without any distorion. The aberration values are very small so the .1 is only 138 | // to make the slider in the Inspector less sensitive. 139 | text.r = texture(SCREEN_TEXTURE, text_uv + vec2(aberration, 0.0) * .1).r; 140 | text.g = texture(SCREEN_TEXTURE, text_uv - vec2(aberration, 0.0) * .1).g; 141 | text.b = texture(SCREEN_TEXTURE, text_uv).b; 142 | text.a = 1.0; 143 | } 144 | 145 | float r = text.r; 146 | float g = text.g; 147 | float b = text.b; 148 | 149 | uv = warp(UV); 150 | 151 | // CRT monitors don't have pixels but groups of red, green and blue dots or lines, called grille. We isolate the texture's color channels 152 | // and divide it up in 3 offsetted lines to show the red, green and blue colors next to each other, with a small black gap between. 153 | if (grille_opacity > 0.0){ 154 | 155 | float g_r = smoothstep(0.85, 0.95, abs(sin(uv.x * (resolution.x * 3.14159265)))); 156 | r = mix(r, r * g_r, grille_opacity); 157 | 158 | float g_g = smoothstep(0.85, 0.95, abs(sin(1.05 + uv.x * (resolution.x * 3.14159265)))); 159 | g = mix(g, g * g_g, grille_opacity); 160 | 161 | float b_b = smoothstep(0.85, 0.95, abs(sin(2.1 + uv.x * (resolution.x * 3.14159265)))); 162 | b = mix(b, b * b_b, grille_opacity); 163 | 164 | } 165 | 166 | // Apply the grille to the texture's color channels and apply Brightness. Since the grille and the scanlines (below) make the image very dark you 167 | // can compensate by increasing the brightness. 168 | text.r = clamp(r * brightness, 0.0, 1.0); 169 | text.g = clamp(g * brightness, 0.0, 1.0); 170 | text.b = clamp(b * brightness, 0.0, 1.0); 171 | 172 | // Scanlines are the horizontal lines that make up the image on a CRT monitor. 173 | // Here we are actual setting the black gap between each line, which I guess is not the right definition of the word, but you get the idea 174 | float scanlines = 0.5; 175 | if (scanlines_opacity > 0.0) 176 | { 177 | // Same technique as above, create lines with sine and applying it to the texture. Smoothstep to allow setting the line size. 178 | scanlines = smoothstep(scanlines_width, scanlines_width + 0.5, abs(sin(uv.y * (resolution.y * 3.14159265)))); 179 | text.rgb = mix(text.rgb, text.rgb * vec3(scanlines), scanlines_opacity); 180 | } 181 | 182 | // Apply the banded noise. 183 | if (noise_opacity > 0.0) 184 | { 185 | // Generate a noise pattern that is very stretched horizontally, and animate it with noise_speed 186 | float noise = smoothstep(0.4, 0.5, noise(uv * vec2(2.0, 200.0) + vec2(10.0, (TIME * (noise_speed))) ) ); 187 | 188 | // We use roll_line (set above) to define how big the noise should be vertically (multiplying cuts off all black parts). 189 | // We also add in some basic noise with random() to break up the noise pattern above. The noise is sized according to 190 | // the resolution value set in the inspector. If you don't like this look you can 191 | // change "ceil(uv * resolution) / resolution" to only "uv" to make it less pixelated. Or multiply resolution with som value 192 | // greater than 1.0 to make them smaller. 193 | roll_line *= noise * scanlines * clamp(random((ceil(uv * resolution) / resolution) + vec2(TIME * 0.8, 0.0)).x + 0.8, 0.0, 1.0); 194 | // Add it to the texture based on noise_opacity 195 | text.rgb = clamp(mix(text.rgb, text.rgb + roll_line, noise_opacity), vec3(0.0), vec3(1.0)); 196 | } 197 | 198 | // Apply static noise by generating it over the whole screen in the same way as above 199 | if (static_noise_intensity > 0.0) 200 | { 201 | text.rgb += clamp(random((ceil(uv * resolution) / resolution) + fract(TIME)).x, 0.0, 1.0) * static_noise_intensity; 202 | } 203 | 204 | // Apply a black border to hide imperfections caused by the warping. 205 | // Also apply the vignette 206 | text.rgb *= border(uv); 207 | text.rgb *= vignette(uv); 208 | // Hides the black border and make that area transparent. Good if you want to add the the texture on top an image of a TV or monitor. 209 | if (clip_warp) 210 | { 211 | text.a = border(uv); 212 | } 213 | 214 | // Apply discoloration to get a VHS look (lower saturation and higher contrast) 215 | // You can play with the values below or expose them in the Inspector. 216 | float saturation = 0.5; 217 | float contrast = 1.2; 218 | if (discolor) 219 | { 220 | // Saturation 221 | vec3 greyscale = vec3(text.r + text.g + text.b) / 3.; 222 | text.rgb = mix(text.rgb, greyscale, saturation); 223 | 224 | // Contrast 225 | float midpoint = pow(0.5, 2.2); 226 | text.rgb = (text.rgb - vec3(midpoint)) * contrast + midpoint; 227 | } 228 | 229 | COLOR = text; 230 | } -------------------------------------------------------------------------------- /addons/post_processing/shaders/LensFlares.gdshader: -------------------------------------------------------------------------------- 1 | shader_type canvas_item; 2 | render_mode blend_mix; 3 | 4 | uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap; 5 | 6 | uniform vec2 sun_position = vec2(0.0); 7 | uniform vec3 tint = vec3(1.4,1.2,1.0); 8 | uniform sampler2D noise_texture; 9 | 10 | float noise_float(float t, vec2 texResolution) 11 | { 12 | return texture(noise_texture,vec2(t,0.0)/texResolution).x; 13 | } 14 | float noise_vec2(vec2 t, vec2 texResolution) 15 | { 16 | return texture(noise_texture,t/texResolution).x; 17 | } 18 | 19 | vec3 lensflare(vec2 uv,vec2 pos, vec2 texResolution) 20 | { 21 | vec2 main = uv-pos; 22 | vec2 uvd = uv*(length(uv)); 23 | 24 | float ang = atan(main.x,main.y); 25 | float dist = length(main); 26 | dist = pow(dist,0.1); 27 | 28 | float n = noise_vec2(vec2(ang*16.0,dist*32.0), texResolution); 29 | 30 | // Do not need an artificial sun 31 | //float f0 = 1.0/(length(uv-pos)*16.0+1.0); 32 | //f0 = f0 + f0*(sin(noise_float(sin(ang*2.+pos.x)*4.0 - cos(ang*3.+pos.y), texResolution)*16.)*.1 + dist*.1 + .8); 33 | 34 | float f1 = max(0.01-pow(length(uv+1.2*pos),1.9),.0)*7.0; 35 | 36 | float f2 = max(1.0/(1.0+32.0*pow(length(uvd+0.8*pos),2.0)),.0)*00.25; 37 | float f22 = max(1.0/(1.0+32.0*pow(length(uvd+0.85*pos),2.0)),.0)*00.23; 38 | float f23 = max(1.0/(1.0+32.0*pow(length(uvd+0.9*pos),2.0)),.0)*00.21; 39 | 40 | vec2 uvx = mix(uv,uvd,-0.5); 41 | 42 | float f4 = max(0.01-pow(length(uvx+0.4*pos),2.4),.0)*6.0; 43 | float f42 = max(0.01-pow(length(uvx+0.45*pos),2.4),.0)*5.0; 44 | float f43 = max(0.01-pow(length(uvx+0.5*pos),2.4),.0)*3.0; 45 | 46 | uvx = mix(uv,uvd,-.4); 47 | 48 | float f5 = max(0.01-pow(length(uvx+0.2*pos),5.5),.0)*2.0; 49 | float f52 = max(0.01-pow(length(uvx+0.4*pos),5.5),.0)*2.0; 50 | float f53 = max(0.01-pow(length(uvx+0.6*pos),5.5),.0)*2.0; 51 | 52 | uvx = mix(uv,uvd,-0.5); 53 | 54 | float f6 = max(0.01-pow(length(uvx-0.3*pos),1.6),.0)*6.0; 55 | float f62 = max(0.01-pow(length(uvx-0.325*pos),1.6),.0)*3.0; 56 | float f63 = max(0.01-pow(length(uvx-0.35*pos),1.6),.0)*5.0; 57 | 58 | vec3 c = vec3(.0); 59 | 60 | c.r+=f2+f4+f5+f6; c.g+=f22+f42+f52+f62; c.b+=f23+f43+f53+f63; 61 | c = c*1.3 - vec3(length(uvd)*.05); 62 | 63 | // Do not need an artificial sun 64 | //c+=vec3(f0); 65 | 66 | return c; 67 | } 68 | 69 | vec3 cc(vec3 color, float factor,float factor2) // color modifier 70 | { 71 | float w = color.x+color.y+color.z; 72 | return mix(color,vec3(w)*factor,w*factor2); 73 | } 74 | 75 | void fragment() 76 | { 77 | vec2 texResolution = 1.0 / TEXTURE_PIXEL_SIZE; 78 | vec2 resolution = 1.0 / SCREEN_PIXEL_SIZE; 79 | 80 | vec2 uv = FRAGCOORD.xy / resolution.xy - 0.5; 81 | uv.x *= resolution.x/resolution.y; //fix aspect ratio 82 | vec2 mouse = (sun_position.xy / resolution.xy) - vec2(0.5, 0.5); 83 | mouse.x *= resolution.x / resolution.y; //fix aspect ratio 84 | 85 | vec4 previousColor = texture(SCREEN_TEXTURE, SCREEN_UV); 86 | 87 | vec3 color = previousColor.rgb; 88 | 89 | color += tint * lensflare(uv, mouse.xy, texResolution); 90 | color -= noise_vec2(FRAGCOORD.xy, texResolution)*.015; 91 | color = cc(color,.5,.1); 92 | COLOR = vec4(color,1.0); 93 | } -------------------------------------------------------------------------------- /addons/post_processing/shaders/analog_monitor.gdshader: -------------------------------------------------------------------------------- 1 | //SHADER ORIGINALY CREADED BY "TimothyLottes" FROM SHADERTOY 2 | //PORTED AND MODIFYED TO GODOT BY AHOPNESS (@ahopness) 3 | //LICENSE : CC0 4 | //COMATIBLE WITH : GLES2, GLES3, WEBGL 5 | //SHADERTOY LINK : https://www.shadertoy.com/view/MsjXzh 6 | 7 | // PUBLIC DOMAIN CRT STYLED SCAN-LINE SHADER 8 | // 9 | // by Timothy Lottes 10 | // 11 | // This is more along the style of a really good CGA arcade monitor. 12 | // With RGB inputs instead of NTSC. 13 | // The shadow mask example has the mask rotated 90 degrees for less chromatic aberration. 14 | // 15 | // Left it unoptimized to show the theory behind the algorithm. 16 | // 17 | // It is an example what I personally would want as a display option for pixel art games. 18 | // Please take and use, change, or whatever. 19 | 20 | shader_type canvas_item; 21 | 22 | // Emulated input resolution. 23 | uniform vec2 res; 24 | 25 | uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap; 26 | 27 | // Mask type 28 | // 0 = Very compressed TV style shadow mask 29 | // 1 = Stretched VGA style shadow mask (same as prior shaders) 30 | // 2 = VGA style shadow mask 31 | uniform int mask_type :hint_range(0, 2) = 0; 32 | 33 | // Bloom Type 34 | // 0 = Normalized exposure 35 | // 1 = Aditive bloom 36 | // 2 = No Bloom 37 | uniform int bloom_type :hint_range(0, 2) = 0; 38 | 39 | // Hardness of scanline. 40 | // -8.0 = soft 41 | // -16.0 = medium 42 | uniform float hardScan :hint_range(-12.0, -1.0) = -8.0; 43 | 44 | // Hardness of pixels in scanline. 45 | // -2.0 = soft 46 | // -4.0 = hard 47 | uniform float hardPix :hint_range(-4.0, 0.0) = -2.0; 48 | 49 | // Hardness of short vertical bloom. 50 | // -1.0 = wide to the point of clipping (bad) 51 | // -1.5 = wide 52 | // -4.0 = not very wide at all 53 | uniform float hardBloomScan :hint_range(-4.0, 0.0) = -2.0; 54 | 55 | // Hardness of short horizontal bloom. 56 | // -0.5 = wide to the point of clipping (bad) 57 | // -1.0 = wide 58 | // -2.0 = not very wide at all 59 | uniform float hardBloomPix :hint_range(-2.0, 0.0) = -1.5; 60 | 61 | // Amount of small bloom effect. 62 | // 1.0/1.0 = only bloom 63 | // 1.0/16.0 = what I think is a good amount of small bloom 64 | // 0.0 = no bloom 65 | uniform float bloomAmount :hint_range(1.0, 16.0) = 16.0; 66 | 67 | // Display warp. 68 | // 0.0 = none 69 | // 1.0/8.0 = extreme 70 | uniform vec2 warp = vec2(64.0, 24.0); 71 | 72 | // Amount of shadow mask. 73 | uniform float maskDark :hint_range(0.0, 1.0) = 0.5; 74 | uniform float maskLight :hint_range(1.0, 2.0) = 1.5; 75 | 76 | //------------------------------------------------------------------------ 77 | 78 | // sRGB to Linear. 79 | // Assuing using sRGB typed textures this should not be needed. 80 | float ToLinear1(float c){ return(c <= 0.04045) ? c / 12.92 : pow((c + 0.055) / 1.055, 2.4); } 81 | vec3 ToLinear(vec3 c){ return vec3(ToLinear1(c.r), ToLinear1(c.g), ToLinear1(c.b)); } 82 | 83 | // Linear to sRGB. 84 | // Assuing using sRGB typed textures this should not be needed. 85 | float ToSrgb1(float c){ return(c < 0.0031308?c * 12.92 : 1.055 * pow(c, 0.41666) - 0.055); } 86 | vec3 ToSrgb(vec3 c){ return vec3(ToSrgb1(c.r), ToSrgb1(c.g), ToSrgb1(c.b)); } 87 | 88 | // Nearest emulated sample given floating point position and texel offset. 89 | // Also zero's off screen. 90 | vec3 Fetch(vec2 pos, vec2 off, sampler2D iChannel0){ 91 | pos = floor(pos * res + off) / res; 92 | 93 | if(max(abs(pos.x - 0.5), abs(pos.y - 0.5)) > 0.5){ 94 | return vec3(0.0, 0.0, 0.0); 95 | } 96 | 97 | return ToLinear(texture(iChannel0 , pos.xy , -16.0).rgb); 98 | } 99 | 100 | // Distance in emulated pixels to nearest texel. 101 | vec2 Dist(vec2 pos){ 102 | pos = pos * res; 103 | return - ((pos - floor(pos)) - vec2(0.5)); 104 | } 105 | 106 | // 1D Gaussian. 107 | float Gaus(float pos, float scale){ return exp2(scale * pos * pos); } 108 | 109 | // 3-tap Gaussian filter along horz line. 110 | vec3 Horz3(vec2 pos, float off, sampler2D iChannel0){ 111 | vec3 b = Fetch(pos, vec2(-1.0, off), iChannel0); 112 | vec3 c = Fetch(pos, vec2( 0.0, off), iChannel0); 113 | vec3 d = Fetch(pos, vec2( 1.0, off), iChannel0); 114 | float dst = Dist(pos).x; 115 | 116 | // Convert distance to weight. 117 | float scale = hardPix; 118 | float wb = Gaus(dst - 1.0, scale); 119 | float wc = Gaus(dst + 0.0, scale); 120 | float wd = Gaus(dst + 1.0, scale); 121 | 122 | // Return filtered sample. 123 | return (b * wb + c * wc + d * wd) / (wb + wc + wd); 124 | } 125 | // 5-tap Gaussian filter along horz line. 126 | vec3 Horz5(vec2 pos, float off, sampler2D iChannel0){ 127 | vec3 a = Fetch(pos, vec2(-2.0, off), iChannel0); 128 | vec3 b = Fetch(pos, vec2(-1.0, off), iChannel0); 129 | vec3 c = Fetch(pos, vec2( 0.0, off), iChannel0); 130 | vec3 d = Fetch(pos, vec2( 1.0, off), iChannel0); 131 | vec3 e = Fetch(pos, vec2( 2.0, off), iChannel0); 132 | float dst = Dist(pos).x; 133 | 134 | // Convert distance to weight. 135 | float scale = hardPix; 136 | float wa = Gaus(dst - 2.0, scale); 137 | float wb = Gaus(dst - 1.0, scale); 138 | float wc = Gaus(dst + 0.0, scale); 139 | float wd = Gaus(dst + 1.0, scale); 140 | float we = Gaus(dst + 2.0, scale); 141 | 142 | // Return filtered sample. 143 | return (a * wa + b * wb + c * wc + d * wd + e * we) / (wa + wb + wc + wd + we); 144 | } 145 | // 7-tap Gaussian filter along horz line. 146 | vec3 Horz7(vec2 pos, float off, sampler2D iChannel0){ 147 | vec3 a = Fetch(pos, vec2(-3.0, off), iChannel0); 148 | vec3 b = Fetch(pos, vec2(-2.0, off), iChannel0); 149 | vec3 c = Fetch(pos, vec2( 1.0, off), iChannel0); 150 | vec3 d = Fetch(pos, vec2( 0.0, off), iChannel0); 151 | vec3 e = Fetch(pos, vec2( 1.0, off), iChannel0); 152 | vec3 f = Fetch(pos, vec2( 2.0, off), iChannel0); 153 | vec3 g = Fetch(pos, vec2( 3.0, off), iChannel0); 154 | float dst = Dist(pos).x; 155 | 156 | // Convert distance to weight. 157 | float scale = hardBloomPix; 158 | float wa = Gaus(dst - 3.0, scale); 159 | float wb = Gaus(dst - 2.0, scale); 160 | float wc = Gaus(dst - 1.0, scale); 161 | float wd = Gaus(dst + 0.0, scale); 162 | float we = Gaus(dst + 1.0, scale); 163 | float wf = Gaus(dst + 2.0, scale); 164 | float wg = Gaus(dst + 3.0, scale); 165 | 166 | // Return filtered sample. 167 | return (a * wa + b * wb + c * wc + d * wd + e * we + f * wf + g * wg) / (wa + wb + wc + wd + we + wf + wg); 168 | } 169 | 170 | // Return scanline weight. 171 | float Scan(vec2 pos, float off){ 172 | float dst = Dist(pos).y; 173 | 174 | return Gaus(dst + off, hardScan); 175 | } 176 | 177 | // Return scanline weight for bloom. 178 | float BloomScan(vec2 pos, float off){ 179 | float dst = Dist(pos).y; 180 | 181 | return Gaus(dst + off, hardBloomScan); 182 | } 183 | 184 | // Allow nearest three lines to effect pixel. 185 | vec3 Tri(vec2 pos, sampler2D iChannel0){ 186 | vec3 a = Horz3(pos,-1.0, iChannel0); 187 | vec3 b = Horz5(pos, 0.0, iChannel0); 188 | vec3 c = Horz3(pos, 1.0, iChannel0); 189 | 190 | float wa = Scan(pos,-1.0); 191 | float wb = Scan(pos, 0.0); 192 | float wc = Scan(pos, 1.0); 193 | 194 | return a * wa + b * wb + c * wc; 195 | } 196 | 197 | // Small bloom. 198 | vec3 Bloom(vec2 pos, sampler2D iChannel0){ 199 | vec3 a = Horz5(pos,-2.0, iChannel0); 200 | vec3 b = Horz7(pos,-1.0, iChannel0); 201 | vec3 c = Horz7(pos, 0.0, iChannel0); 202 | vec3 d = Horz7(pos, 1.0, iChannel0); 203 | vec3 e = Horz5(pos, 2.0, iChannel0); 204 | 205 | float wa = BloomScan(pos,-2.0); 206 | float wb = BloomScan(pos,-1.0); 207 | float wc = BloomScan(pos, 0.0); 208 | float wd = BloomScan(pos, 1.0); 209 | float we = BloomScan(pos, 2.0); 210 | 211 | return a * wa + b * wb + c * wc + d * wd + e * we; 212 | } 213 | 214 | // Distortion of scanlines, and end of screen alpha. 215 | vec2 Warp(vec2 pos){ 216 | pos = pos * 2.0 - 1.0; 217 | pos *= vec2(1.0 + (pos.y * pos.y) * 1.0 / warp.x, 1.0 + (pos.x * pos.x) * 1.0/ warp.y); 218 | 219 | return pos * 0.5+0.5; 220 | } 221 | 222 | vec3 Mask(vec2 pos){ 223 | if (mask_type == 0){ 224 | float line = maskLight; 225 | float odd = 0.0; 226 | 227 | if(fract(pos.x / 6.0) < 0.5) odd = 1.0; 228 | if(fract((pos.y + odd) / 2.0) < 0.5) line = maskDark; 229 | pos.x = fract(pos.x / 3.0); 230 | 231 | vec3 mask = vec3(maskDark, maskDark, maskDark); 232 | if(pos.x < 0.333)mask.r = maskLight; 233 | else if(pos.x < 0.666)mask.g = maskLight; 234 | else mask.b = maskLight; 235 | 236 | mask *= line; 237 | return mask; 238 | }else if (mask_type == 1){ 239 | pos.x += pos.y * 3.0; 240 | 241 | vec3 mask = vec3(maskDark, maskDark, maskDark); 242 | pos.x = fract(pos.x / 6.0); 243 | if(pos.x < 0.333)mask.r = maskLight; 244 | else if(pos.x < 0.666)mask.g = maskLight; 245 | else mask.b = maskLight; 246 | 247 | return mask; 248 | }else if (mask_type == 2){ 249 | pos.xy = floor(pos.xy * vec2(1.0, 0.5)); 250 | pos.x += pos.y * 3.0; 251 | 252 | vec3 mask = vec3(maskDark, maskDark, maskDark); 253 | pos.x = fract(pos.x / 6.0); 254 | if(pos.x < 0.333)mask.r = maskLight; 255 | else if(pos.x < 0.666)mask.g = maskLight; 256 | else mask.b = maskLight; 257 | 258 | return mask; 259 | } 260 | } 261 | 262 | // Draw dividing bars. 263 | float Bar(float pos, float bar){ pos -= bar; return pos * pos < 4.0 ? 0.0 : 1.0; } 264 | 265 | // Entry. 266 | void fragment(){ 267 | vec2 pos = Warp(FRAGCOORD.xy / (1.0 / SCREEN_PIXEL_SIZE).xy); 268 | 269 | COLOR.rgb = Tri(pos, SCREEN_TEXTURE) * Mask(FRAGCOORD.xy); 270 | if (bloom_type == 0){ 271 | COLOR.rgb = mix(COLOR.rgb,Bloom(pos, SCREEN_TEXTURE), 1.0 / bloomAmount); 272 | }else if (bloom_type == 1){ 273 | COLOR.rgb += Bloom(pos, SCREEN_TEXTURE) * 1.0 / bloomAmount; 274 | } 275 | 276 | COLOR.a = 1.0; 277 | COLOR.rgb = ToSrgb(COLOR.rgb); 278 | } -------------------------------------------------------------------------------- /addons/post_processing/shaders/ascii.gdshader: -------------------------------------------------------------------------------- 1 | /* 2 | アスキー文字エフェクトシェーダー by あるる(きのもと 結衣) @arlez80 3 | Ascii Effect Shader by Yui Kinomoto @arlez80 4 | 5 | MIT License 6 | */ 7 | 8 | shader_type canvas_item; 9 | render_mode unshaded; 10 | 11 | uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap; 12 | 13 | const vec3 MONOCHROME_SCALE = vec3( 0.298912, 0.586611, 0.114478 ); 14 | 15 | uniform sampler2D ascii_tex : source_color; 16 | uniform vec2 ascii_size = vec2( 8.0, 16.0 ); 17 | uniform int available_columns = 10; 18 | uniform int max_columns = 16; 19 | 20 | void fragment( ) 21 | { 22 | vec2 screen_uv = floor( SCREEN_UV / SCREEN_PIXEL_SIZE / ascii_size ) * SCREEN_PIXEL_SIZE * ascii_size; 23 | vec2 diff = ascii_size * SCREEN_PIXEL_SIZE; 24 | vec4 color = ( 25 | textureLod( SCREEN_TEXTURE, screen_uv, 0.0 ) 26 | + textureLod( SCREEN_TEXTURE, screen_uv + vec2( 0.0, diff.y ), 0.0 ) 27 | + textureLod( SCREEN_TEXTURE, screen_uv + vec2( diff.x, 0.0 ), 0.0 ) 28 | + textureLod( SCREEN_TEXTURE, screen_uv + diff, 0.0 ) 29 | ) / 4.0; 30 | 31 | vec2 ascii_uv = fract( SCREEN_UV / SCREEN_PIXEL_SIZE / ascii_size ); 32 | ascii_uv.x = ( 1.0 - ascii_uv.x ) / float( max_columns ); 33 | float col = floor( dot( color.rgb, MONOCHROME_SCALE ) * float( available_columns ) ) / float( available_columns ); 34 | 35 | COLOR = texture( ascii_tex, ascii_uv + vec2( col * ( float( available_columns ) / float( max_columns ) ), 0.0 ) ); 36 | } 37 | 38 | -------------------------------------------------------------------------------- /addons/post_processing/shaders/bloom.gdshader: -------------------------------------------------------------------------------- 1 | shader_type canvas_item; 2 | render_mode blend_add; 3 | 4 | #include "CLREDIT.gdshaderinc" 5 | 6 | uniform lowp sampler2D Screen_Sample : hint_screen_texture, filter_linear_mipmap_anisotropic; 7 | uniform lowp sampler2D FlareTex; // Texture for the lens flare 8 | 9 | uniform float BlurAmount; // Adjust blur intensity 10 | uniform float FlareThreshold; // Threshold for brightness to consider flare 11 | uniform int Flares; // Number of lens flares 12 | uniform float FlareSpacing; // Separation between flares 13 | uniform float Intensity; // Overall intensity of the effect 14 | uniform float Saturation_; // Adjust color saturation (optional) 15 | uniform float FalloffStart; // Controls falloff start distance from center (0-1) 16 | uniform float FalloffEnd; // Controls falloff end distance from center (0-1) 17 | 18 | void fragment() { 19 | //UV = SCREEN_UV; 20 | 21 | // Sample the scene color 22 | vec3 SceneColor = texture(Screen_Sample, UV).rgb; 23 | 24 | // Calculate direction vector from screen center (static) 25 | vec2 FlareDir = vec2(0.5) - UV; 26 | 27 | // Accumulate flare color with falloff 28 | vec3 FinalFlare = vec3(0.0); 29 | for (int i = 0; i < Flares; ++i) { 30 | // Offset UV based on flare direction and index 31 | vec2 SampleUV = fract(UV + FlareDir * (BlurAmount + vec2(float(i) * FlareSpacing))); 32 | 33 | // Sample the scene with blur in flare direction 34 | vec3 BlurredScene = texture(Screen_Sample, SampleUV, BlurAmount).rgb; 35 | 36 | // Apply threshold to filter out dark areas 37 | BlurredScene = ApplyThreshold(BlurredScene, FlareThreshold); // Adjust threshold as needed (optional) 38 | 39 | // Calculate distance from center for falloff 40 | float Dist = distance(SampleUV, vec2(0.5)); 41 | float Falloff = smoothstep(FalloffStart, FalloffEnd, Dist); 42 | 43 | // Apply weight and accumulate flare color 44 | FinalFlare += BlurredScene * Falloff; 45 | } 46 | 47 | // Apply lens flare texture 48 | FinalFlare *= texture(FlareTex, UV).rgb; 49 | 50 | // Apply intensity and optional saturation adjustment 51 | COLOR.rgb = FinalFlare * Intensity; 52 | COLOR.rgb = Saturation(COLOR.rgb, Saturation_); // Adjust saturation as needed (optional) 53 | } 54 | -------------------------------------------------------------------------------- /addons/post_processing/shaders/blur.gdshader: -------------------------------------------------------------------------------- 1 | shader_type canvas_item; 2 | 3 | uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap; 4 | 5 | uniform float lod: hint_range(0.0, 5) = 0.0; 6 | 7 | void fragment(){ 8 | vec4 color = texture(SCREEN_TEXTURE, SCREEN_UV, lod); 9 | COLOR = color; 10 | } -------------------------------------------------------------------------------- /addons/post_processing/shaders/chromatic.gdshader: -------------------------------------------------------------------------------- 1 | shader_type canvas_item; 2 | 3 | uniform sampler2D SCREEN_TEXTURE : hint_screen_texture; 4 | 5 | uniform float offset = 1; 6 | 7 | void fragment(){ 8 | vec4 green_channel = texture(SCREEN_TEXTURE, SCREEN_UV); 9 | vec4 red_channel = texture(SCREEN_TEXTURE, vec2(SCREEN_UV.x + (offset * SCREEN_PIXEL_SIZE.x), SCREEN_UV.y)); 10 | vec4 blue_channel = texture(SCREEN_TEXTURE, vec2(SCREEN_UV.x - (offset * SCREEN_PIXEL_SIZE.x), SCREEN_UV.y)); 11 | COLOR = vec4(red_channel.r, green_channel.g, blue_channel.b, 1); 12 | } -------------------------------------------------------------------------------- /addons/post_processing/shaders/circularwaves.gdshader: -------------------------------------------------------------------------------- 1 | shader_type canvas_item; 2 | 3 | // for circles 4 | uniform float amplitude: hint_range(0, 2, 0.01) = 2.0; 5 | uniform float frequency: hint_range(0, 15, 0.01) = 12.69; 6 | uniform float rippleRate : hint_range(0.5, 150.0, 0.1) = 9.2; 7 | 8 | 9 | // for wave 10 | uniform float waveAmplitude = 0.1; 11 | uniform float waveFrequency = 4.0; 12 | uniform float blendingAmount = 0.6; 13 | 14 | 15 | // other 16 | uniform sampler2D noise; 17 | 18 | 19 | 20 | vec2 wave(vec2 uv, float time) { 21 | return vec2( 22 | uv.x + sin(uv.y * waveFrequency * 5.0 + time) * waveAmplitude, 23 | uv.y + sin(uv.x * waveFrequency + time) * waveAmplitude 24 | ); 25 | } 26 | 27 | void fragment() { 28 | vec2 wave_uv = wave(UV, TIME); 29 | vec4 ns = texture(noise, wave_uv); 30 | 31 | vec2 motion = vec2(0.0, 1.0); 32 | float pi = 3.14159265358979323846; 33 | vec2 uv = UV * 2.0 - 1.0; 34 | 35 | float dist = length(uv); 36 | ns *= 1.4142135; 37 | dist += -0.1 * ns.x; 38 | float ripple = sin(dist * -frequency * pi + rippleRate * TIME) * amplitude / (dist + 1.0); 39 | 40 | 41 | vec4 color = vec4(1.0, 1.0, 1.0, 2.0 * ripple); 42 | 43 | float alphaScalar = (1.0 - min(dist, 1.0)) * ns.x * 2.5; 44 | 45 | 46 | color.a *= 1.0 * alphaScalar * (ripple + ns.x * ns.y); 47 | color.a = max(color.a - (ns.y * 0.45), 0.0); 48 | 49 | COLOR = color; 50 | } -------------------------------------------------------------------------------- /addons/post_processing/shaders/color_correction.gdshader: -------------------------------------------------------------------------------- 1 | shader_type canvas_item; 2 | 3 | uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear; 4 | uniform vec4 tint : source_color = vec4(1, 1, 1, 1); 5 | uniform float brightness : hint_range(-1.0, 1.0) = 0; 6 | uniform float saturation : hint_range(-1.0, 1.0) = 0; 7 | 8 | void fragment(){ 9 | vec4 color = texture(SCREEN_TEXTURE, SCREEN_UV); 10 | vec4 final_col = color * tint; 11 | final_col.rgb = final_col.rgb + brightness; 12 | 13 | float avg_col = (final_col.r + final_col.g + final_col.b) / 3.0; 14 | vec3 sat_color = mix(vec3(avg_col), final_col.rgb, 1.0 + saturation); 15 | 16 | final_col.rgb = clamp(sat_color, 0.0, 1.0); 17 | 18 | COLOR = final_col; 19 | } -------------------------------------------------------------------------------- /addons/post_processing/shaders/directional_drift_shader.gdshader: -------------------------------------------------------------------------------- 1 | // DirectionalDriftShader 2 | // Copyright (c) 2025 Lou Bernardi (https://github.com/Loufe) 3 | // A versatile shader for creating directional particle effects like sandstorms, snow, or mist 4 | // using layered noise patterns for natural movement. 5 | 6 | shader_type canvas_item; 7 | 8 | uniform vec4 particle_color: source_color = vec4(0.76, 0.69, 0.5, 0.3); // Base color with alpha 9 | uniform float particle_density: hint_range(0.0, 3.0) = 0.3; // Controls the amount of visible particles 10 | uniform float flow_speed: hint_range(0.0, 5.0) = 1.0; // Base movement speed 11 | uniform float pattern_scale = 30.0; // Controls size and distribution of particles 12 | uniform vec2 normalized_flow_direction = vec2(0.89442719, 0.4472136); // Normalized direction vector (default 1.0, 0.5 normalized) 13 | uniform float layer_velocity_ratio = 1.2; // Speed multiplier for second noise layer 14 | const float SPEED_SCALE = 0.3; // Internal speed scaling factor (30%) 15 | 16 | // Optimized noise generation using combined cellular and gradient noise 17 | // Provides good distribution while maintaining efficiency 18 | vec2 generate_noise_vector(vec2 position) { 19 | vec2 i = floor(position); 20 | vec2 f = fract(position); 21 | 22 | // Generate vectors using simple but effective hash 23 | vec2 hash = fract(sin(vec2( 24 | dot(i, vec2(12.9898, 78.233)), 25 | dot(i, vec2(43.5453, 28.179)) 26 | )) * 43758.5453); 27 | 28 | // Mix in cellular noise characteristics for better particle distribution 29 | return hash + 0.5 * sin(6.2831 * f); 30 | } 31 | 32 | // Smooth noise function for organic particle movement 33 | float create_smooth_noise(vec2 position) { 34 | vec2 integer_pos = floor(position); 35 | vec2 fractional_pos = fract(position); 36 | 37 | // Smooth interpolation curve 38 | fractional_pos = fractional_pos * fractional_pos * (3.0 - 2.0 * fractional_pos); 39 | 40 | // Sample points for bilinear interpolation 41 | float point_a = length(generate_noise_vector(integer_pos)); 42 | float point_b = length(generate_noise_vector(integer_pos + vec2(1.0, 0.0))); 43 | float point_c = length(generate_noise_vector(integer_pos + vec2(0.0, 1.0))); 44 | float point_d = length(generate_noise_vector(integer_pos + vec2(1.0, 1.0))); 45 | 46 | // Bilinear interpolation for smooth noise 47 | return mix( 48 | mix(point_a, point_b, fractional_pos.x), 49 | mix(point_c, point_d, fractional_pos.x), 50 | fractional_pos.y 51 | ); 52 | } 53 | 54 | void fragment() { 55 | // Use pre-normalized direction vector to avoid per-fragment normalization 56 | // Negate the direction to match expected coordinate system 57 | vec2 time_offset = normalized_flow_direction * TIME * flow_speed * SPEED_SCALE; 58 | vec2 primary_offset = UV - time_offset; 59 | vec2 secondary_offset = UV - (time_offset * layer_velocity_ratio); 60 | 61 | // Generate two noise layers with different scales 62 | float primary_noise = create_smooth_noise(primary_offset * pattern_scale); 63 | float secondary_noise = create_smooth_noise(secondary_offset * (pattern_scale * 0.8)); 64 | 65 | // Blend layers with weighted contribution 66 | float composite_noise = (primary_noise * 0.6 + secondary_noise * 0.4); 67 | 68 | // Create stepped appearance for distinct particles 69 | float quantized_noise = floor(composite_noise * 4.0) / 4.0; 70 | 71 | // Apply final color and transparency 72 | COLOR = vec4(particle_color.rgb, quantized_noise * particle_density * particle_color.a); 73 | } -------------------------------------------------------------------------------- /addons/post_processing/shaders/dither.gdshader: -------------------------------------------------------------------------------- 1 | /* 2 | This shader is under MIT license. Feel free to use, improve and 3 | change this shader according to your needs and consider sharing 4 | the modified result to godotshaders.com. 5 | */ 6 | 7 | shader_type canvas_item; 8 | 9 | uniform sampler2D u_dither_tex; 10 | uniform sampler2D u_color_tex; 11 | 12 | uniform int u_bit_depth; 13 | uniform float u_contrast; 14 | uniform float u_offset; 15 | uniform int u_dither_size; 16 | 17 | void fragment() 18 | { 19 | // sample the screen texture at the desired output resolution (according to u_dither_size) 20 | // this will effectively pixelate the resulting output 21 | vec2 screen_size = vec2(textureSize(TEXTURE, 0)) / float(u_dither_size); 22 | vec2 screen_sample_uv = floor(UV * screen_size) / screen_size; 23 | vec3 screen_col = texture(TEXTURE, screen_sample_uv).rgb; 24 | 25 | // calculate pixel luminosity (https://stackoverflow.com/questions/596216/formula-to-determine-brightness-of-rgb-color) 26 | float lum = (screen_col.r * 0.299) + (screen_col.g * 0.587) + (screen_col.b * 0.114); 27 | 28 | // adjust with contrast and offset parameters 29 | float contrast = u_contrast; 30 | lum = (lum - 0.5 + u_offset) * contrast + 0.5; 31 | lum = clamp(lum, 0.0, 1.0); 32 | 33 | // reduce luminosity bit depth to give a more banded visual if desired 34 | float bits = float(u_bit_depth); 35 | lum = floor(lum * bits) / bits; 36 | 37 | // to support multicolour palettes, we want to dither between the two colours on the palette 38 | // which are adjacent to the current pixel luminosity. 39 | // to do this, we need to determine which 'band' lum falls into, calculate the upper and lower 40 | // bound of that band, then later we will use the dither texture to pick either the upper or 41 | // lower colour. 42 | 43 | // get the palette texture size mapped so it is 1px high (so the x value however many colour bands there are) 44 | ivec2 col_size = textureSize(u_color_tex, 0); 45 | col_size /= col_size.y; 46 | 47 | float col_x = float(col_size.x) - 1.0; // colour boundaries is 1 less than the number of colour bands 48 | float col_texel_size = 1.0 / col_x; // the size of one colour boundary 49 | 50 | lum = max(lum - 0.00001, 0.0); // makes sure our floor calculation below behaves when lum == 1.0 51 | float lum_lower = floor(lum * col_x) * col_texel_size; 52 | float lum_upper = (floor(lum * col_x) + 1.0) * col_texel_size; 53 | float lum_scaled = lum * col_x - floor(lum * col_x); // calculates where lum lies between the upper and lower bound 54 | 55 | // map the dither texture onto the screen. there are better ways of doing this that makes the dither pattern 'stick' 56 | // with objects in the 3D world, instead of being mapped onto the screen. see lucas pope's details posts on how he 57 | // achieved this in Obra Dinn: https://forums.tigsource.com/index.php?topic=40832.msg1363742#msg1363742 58 | ivec2 noise_size = textureSize(u_dither_tex, 0); 59 | vec2 inv_noise_size = vec2(1.0 / float(noise_size.x), 1.0 / float(noise_size.y)); 60 | vec2 noise_uv = UV * inv_noise_size * vec2(float(screen_size.x), float(screen_size.y)); 61 | float threshold = texture(u_dither_tex, noise_uv).r; 62 | 63 | // adjust the dither slightly so min and max aren't quite at 0.0 and 1.0 64 | // otherwise we wouldn't get fullly dark and fully light dither patterns at lum 0.0 and 1.0 65 | threshold = threshold * 0.99 + 0.005; 66 | 67 | // the lower lum_scaled is, the fewer pixels will be below the dither threshold, and thus will use the lower bound colour, 68 | // and vice-versa 69 | float ramp_val = lum_scaled < threshold ? 0.0f : 1.0f; 70 | // sample at the lower bound colour if ramp_val is 0.0, upper bound colour if 1.0 71 | float col_sample = mix(lum_lower, lum_upper, ramp_val); 72 | vec3 final_col = texture(u_color_tex, vec2(col_sample, 0.5)).rgb; 73 | 74 | // return the final colour! 75 | COLOR.rgb = final_col; 76 | } -------------------------------------------------------------------------------- /addons/post_processing/shaders/fish_eye.gdshader: -------------------------------------------------------------------------------- 1 | ///////////////////////////////// 2 | // 2D Radial Distortion Shader // 3 | ///////////////////////////////// 4 | 5 | // Screen space shader for Godot, based on: https://gist.github.com/aggregate1166877/a889083801d67917c26c12a98e7f57a7 6 | 7 | shader_type canvas_item; 8 | 9 | uniform float aspect = 1.0; 10 | uniform float distortion = 1.0; 11 | uniform float radius = 1.0; 12 | uniform float alpha = 1.0; 13 | uniform float crop = 1.0; 14 | uniform vec4 crop_color : source_color = vec4(0,0,0,1); 15 | uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap; 16 | 17 | vec2 distort(vec2 p) 18 | { 19 | float d = length(p); 20 | float z = sqrt(distortion + d * d * -distortion); 21 | float r = atan(d, z) / 3.1415926535; 22 | float phi = atan(p.y, p.x); 23 | return vec2(r * cos(phi) * (1.0 / aspect) + 0.5, r * sin(phi) + 0.5); 24 | } 25 | 26 | void fragment() 27 | { 28 | vec2 xy = (SCREEN_UV * 2.0 - 1.0); // move origin of UV coordinates to center of screen 29 | 30 | xy = vec2(xy.x * aspect, xy.y); // adjust aspect ratio 31 | 32 | float d = length(xy); // distance from center 33 | 34 | vec4 tex; 35 | 36 | if (d < radius) 37 | { 38 | xy = distort(xy); 39 | tex = texture(SCREEN_TEXTURE, xy); 40 | COLOR = tex; 41 | COLOR.a = alpha; 42 | } 43 | 44 | // radial crop 45 | if (d > crop) 46 | { 47 | COLOR = crop_color; 48 | } 49 | } -------------------------------------------------------------------------------- /addons/post_processing/shaders/glitch.gdshader: -------------------------------------------------------------------------------- 1 | shader_type canvas_item; 2 | 3 | uniform float range : hint_range(0.0, 0.1, 0.005)= 0.05; 4 | uniform float noiseQuality : hint_range(0.0, 300.0, 0.1)= 250.0; 5 | uniform float noiseIntensity : hint_range(-0.6, 0.6, 0.0010)= 0.0088; 6 | uniform float offsetIntensity : hint_range(-0.1, 0.1, 0.001) = 0.03; 7 | uniform float colorOffsetIntensity : hint_range(0.0, 5.0, 0.001) = 1.3; 8 | uniform sampler2D SCREEN_TEXTURE : hint_screen_texture; 9 | float rand(vec2 co) 10 | { 11 | return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); 12 | } 13 | 14 | float verticalBar(float pos, float UVY, float offset) 15 | { 16 | float edge0 = (pos - range); 17 | float edge1 = (pos + range); 18 | 19 | float x = smoothstep(edge0, pos, UVY) * offset; 20 | x -= smoothstep(pos, edge1, UVY) * offset; 21 | return x; 22 | } 23 | const float saturation = 0.2; 24 | void fragment() 25 | { 26 | vec2 uv = SCREEN_UV; 27 | for (float i = 0.0; i < 0.71; i += 0.1313) 28 | { 29 | float d = mod(TIME * i, 1.7); 30 | float o = sin(1.0 - tan(TIME * 0.24 * i)); 31 | o *= offsetIntensity; 32 | uv.x += verticalBar(d, UV.y, o); 33 | } 34 | 35 | float UVY = uv.y; 36 | UVY *= noiseQuality; 37 | UVY = float(int(UVY)) * (1.0 / noiseQuality); 38 | float noise = rand(vec2(TIME * 0.00001, UVY)); 39 | uv.x += noise * noiseIntensity; 40 | 41 | vec2 offsetR = vec2(0.009 * sin(TIME), 0.0) * colorOffsetIntensity; 42 | vec2 offsetG = vec2(0.0073 * (cos(TIME * 0.97)), 0.0) * colorOffsetIntensity; 43 | 44 | float r = texture(SCREEN_TEXTURE, uv + offsetR).r; 45 | float g = texture(SCREEN_TEXTURE, uv + offsetG).g; 46 | float b = texture(SCREEN_TEXTURE, uv).b; 47 | vec4 tex = vec4(r, g, b, 1.0); 48 | COLOR = tex; 49 | } -------------------------------------------------------------------------------- /addons/post_processing/shaders/grain.gdshader: -------------------------------------------------------------------------------- 1 | shader_type canvas_item; 2 | // set max strength to your liking here=20.0, step_size=0.1 3 | uniform float strength:hint_range(0, 159.0, 0.1)=75; 4 | 5 | void fragment() { 6 | 7 | // Screen Color 8 | vec4 screen = texture(TEXTURE, SCREEN_UV); 9 | vec2 iResolution = 1.0 / SCREEN_PIXEL_SIZE; 10 | vec2 uv = FRAGCOORD.xy / iResolution.xy; 11 | 12 | // Random noise 13 | float x = (uv.x + 4.0 ) * (uv.y + 4.0 ) * (TIME * 10.0); 14 | // Add grain to Screen 15 | screen = screen+vec4(mod((mod(x, 13.0) ) * (mod(x, 123.0) ), 0.01)-0.005) * strength; 16 | 17 | screen = 1.0 - screen; 18 | COLOR = screen; 19 | 20 | } -------------------------------------------------------------------------------- /addons/post_processing/shaders/painted.gdshader: -------------------------------------------------------------------------------- 1 | shader_type canvas_item; 2 | 3 | uniform sampler2D flowMap; //Displacement map 4 | uniform float strength; //Force of the effect 5 | uniform float speed; //Speed of the effect 6 | uniform int frames : hint_range(1, 10); //Frames of the effect 7 | uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear; 8 | 9 | //Returns a value between 0 and 1 depending of the frames -> exemple: frames = 4, frame 1 = 0.25 10 | float clock(float time){ 11 | float fframes = float(frames); 12 | return floor(mod(time * speed, fframes)) / fframes; 13 | } 14 | 15 | void fragment(){ 16 | float c = clock(TIME); //Get clock frame 17 | vec4 offset = texture(flowMap, vec2(SCREEN_UV.x + c, SCREEN_UV.y + c)) * strength; //Get offset 18 | //COLOR = texture(TEXTURE, vec2(UV.x,UV.y) + normal.xy); //Apply offset 19 | COLOR = texture(SCREEN_TEXTURE, vec2(SCREEN_UV.x,SCREEN_UV.y) + offset.xy - vec2(0.5,0.5)*strength); //We need to remove the displacement 20 | } -------------------------------------------------------------------------------- /addons/post_processing/shaders/palette_limiter.gdshader: -------------------------------------------------------------------------------- 1 | // Godot 4 Adapt To Palette Shader 2 | shader_type canvas_item; 3 | 4 | uniform sampler2D palette: filter_nearest; 5 | uniform sampler2D screen_texture: hint_screen_texture, filter_nearest; 6 | 7 | void fragment() { 8 | float best_diff = 4.00; 9 | ivec2 pal_size = textureSize(palette, 0); 10 | 11 | // Palette row scan 12 | for (int y = 0; y < pal_size.y; y += 1) 13 | { 14 | // Palette column scan 15 | for (int x = 0; x < pal_size.x; x += 1) 16 | { 17 | vec3 scr_pix = texture(screen_texture, SCREEN_UV).rgb; 18 | vec3 pal_pix = texelFetch(palette, ivec2(x, y), 0).rgb; 19 | 20 | // Slightly faster than distance() 21 | float this_diff = ( 22 | abs(scr_pix.r - pal_pix.r) + 23 | abs(scr_pix.g - pal_pix.g) + 24 | abs(scr_pix.b - pal_pix.b)); 25 | 26 | if (this_diff < best_diff) 27 | { 28 | best_diff = this_diff; 29 | COLOR.rgb = pal_pix.rgb; 30 | } 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /addons/post_processing/shaders/particle_storm.gdshader: -------------------------------------------------------------------------------- 1 | // ParticleStormShader 2 | // Copyright (c) 2025 Lou Bernardi (https://github.com/Loufe) 3 | // A dynamic particle system shader designed to simulate natural phenomena like dust storms, 4 | // snow flurries, or ash clouds with controllable wind direction and turbulence patterns. 5 | // Features customizable particle density, color, and chaotic movement behaviors. 6 | 7 | /* 8 | Parameters: 9 | - particle_color: Base color of the particles (includes alpha) 10 | - wind_direction: 2D vector for flow direction 11 | - wind_speed: Overall movement speed 12 | - intensity: Global particle visibility 13 | - chaos: Amount of turbulent motion 14 | - scale: Size of the particle system 15 | - density: Base particle count multiplier 16 | */ 17 | 18 | shader_type canvas_item; 19 | 20 | // Uniform parameters that can be modified from outside the shader 21 | uniform vec4 particle_color : source_color = vec4(0.87, 0.78, 0.60, 1.0); // Defaults to a sandy color 22 | uniform vec2 wind_direction = vec2(1.0, 0.2); // Default wind blows right and slightly up 23 | uniform float wind_speed = 1.0; // Base movement speed 24 | uniform float intensity = 0.5; // Overall particle visibility 25 | uniform float chaos = 1.0; // Amount of swirl/turbulence 26 | uniform float scale = 1.0; // Overall size of the effect 27 | uniform float density = 1.0; // Number of particles to render 28 | 29 | // Core constants for the particle system 30 | const float TWO_PI = 6.28318530718; // Optimization: pre-calculated 2*PI 31 | const float INVERSE_QUANTIZE = 0.166666667; // Optimization: pre-calculated 1.0/6.0 32 | const vec3 HASH_SCALE = vec3(443.897, 441.423, 437.195); // Prime numbers for pseudo-random generation 33 | const float MIN_PARTICLE_RATIO = 0.25; // Minimum particles at edge of effect 34 | const float BASE_PARTICLE_SIZE = 0.04; // Base size of each particle 35 | const float PARTICLE_INDEX_OFFSET = 123.456; // Offset for particle position variation 36 | const float HASH_OFFSET = 123.456; // Offset for hash calculation 37 | const float SWIRL_SCALE = 0.1; // Base scale of swirling motion 38 | 39 | // Varying variables passed from vertex to fragment shader 40 | varying float particle_size; // Calculated size of particles based on scale 41 | varying float base_particles; // Number of particles to generate 42 | varying float velocity_base; // Base velocity calculation 43 | varying float velocity_range; // Range of velocity variation 44 | varying float swirl_factor; // Optimization: pre-calculated swirl scale * chaos 45 | 46 | // Vertex shader: pre-calculate values that are constant for all fragments 47 | void vertex() { 48 | particle_size = BASE_PARTICLE_SIZE / scale; 49 | base_particles = floor(4.0 + density * 12.0); 50 | velocity_base = wind_speed * 0.7; // Base speed component 51 | velocity_range = wind_speed * 0.6; // Variable speed component 52 | swirl_factor = SWIRL_SCALE * chaos; // Pre-calculate swirl intensity 53 | } 54 | 55 | // Generate a pseudo-random 2D vector from a 2D position 56 | // Uses a combination of dot products and hash functions for stable randomization 57 | vec2 hash22(vec2 seed_position) { 58 | vec3 hash_input = fract(vec3(seed_position.xyx) * HASH_SCALE); 59 | hash_input += dot(hash_input, hash_input.yzx + 19.19); 60 | return fract((hash_input.xx + hash_input.yz) * hash_input.zy); 61 | } 62 | 63 | // Calculate how many particles to render for a given grid cell 64 | // Reduces particle count for cells further from center 65 | float get_cell_particle_count(vec2 offset) { 66 | float dist_squared = dot(offset, offset); 67 | float falloff = 1.0 - smoothstep(1.0, 2.0, dist_squared); 68 | return base_particles * max(MIN_PARTICLE_RATIO, falloff); 69 | } 70 | 71 | // Calculate the position of a specific particle 72 | vec2 get_particle_pos(vec2 cell_position, float particle_index, float time_factor) { 73 | // Generate unique seed for this particle 74 | vec2 seed_offset = cell_position + particle_index * PARTICLE_INDEX_OFFSET; 75 | vec2 initial_position = hash22(seed_offset); 76 | vec2 particle_characteristics = hash22(initial_position * HASH_OFFSET); 77 | 78 | // Calculate particle-specific properties 79 | float velocity = velocity_base + particle_characteristics.x * velocity_range; 80 | float time_phase = time_factor * (0.5 + particle_characteristics.y * 0.5); 81 | float pos_phase_x = initial_position.x * TWO_PI; 82 | float pos_phase_y = initial_position.y * TWO_PI; 83 | 84 | // Combine wind and swirl movements 85 | vec2 wind_offset = wind_direction * time_factor * velocity; 86 | vec2 swirl_offset = vec2( 87 | sin(time_phase + pos_phase_y), 88 | cos(time_phase + pos_phase_x) 89 | ) * swirl_factor; 90 | 91 | return fract(initial_position + wind_offset + swirl_offset); 92 | } 93 | 94 | // Calculate the intensity of a pixel based on distance from particle center 95 | float get_pixel(vec2 distance_to_center) { 96 | float square_distance = max(distance_to_center.x, distance_to_center.y); 97 | float size_factor = particle_size * 0.8; 98 | return 1.0 - smoothstep(size_factor, particle_size, square_distance); 99 | } 100 | 101 | // Fragment shader: calculate the color of each pixel 102 | void fragment() { 103 | // Calculate basic UV coordinates and time 104 | vec2 scaled_uv = UV * scale; 105 | vec2 current_cell = floor(scaled_uv); 106 | vec2 cell_local_uv = fract(scaled_uv); 107 | float current_time = TIME * wind_speed; 108 | 109 | float total_sand_density = 0.0; 110 | 111 | // Process a 3x3 grid of cells around current position 112 | for (float x = -1.0; x <= 1.0; x++) { 113 | for (float y = -1.0; y <= 1.0; y++) { 114 | vec2 offset = vec2(x, y); 115 | vec2 neighbor_cell = current_cell + offset; 116 | 117 | // Get number of particles for this cell 118 | float local_particle_count = get_cell_particle_count(offset); 119 | 120 | // Process each particle in the cell 121 | for (float particle_idx = 0.0; particle_idx < local_particle_count; particle_idx++) { 122 | vec2 particle_pos = get_particle_pos(neighbor_cell, particle_idx, current_time); 123 | vec2 distance_to_center = abs(cell_local_uv - (particle_pos + offset)); 124 | total_sand_density += get_pixel(distance_to_center) * 0.25; 125 | } 126 | } 127 | } 128 | 129 | // Apply intensity and quantization for final output 130 | total_sand_density = clamp(total_sand_density * intensity, 0.0, 1.0); 131 | total_sand_density = (floor(total_sand_density * 6.0 + 0.5)) * INVERSE_QUANTIZE; 132 | 133 | // Set final color with calculated alpha 134 | COLOR = vec4(particle_color.rgb, total_sand_density * particle_color.a); 135 | } -------------------------------------------------------------------------------- /addons/post_processing/shaders/pixelate.gdshader: -------------------------------------------------------------------------------- 1 | shader_type canvas_item; 2 | 3 | uniform int pixelSize = 4; 4 | uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear; 5 | 6 | void fragment() 7 | { 8 | 9 | ivec2 size = textureSize(SCREEN_TEXTURE, 0); 10 | 11 | int xRes = size.x; 12 | int yRes = size.y; 13 | 14 | float xFactor = float(xRes) / float(pixelSize); 15 | float yFactor = float(yRes) / float(pixelSize); 16 | 17 | float grid_uv_x = round(SCREEN_UV.x * xFactor) / xFactor; 18 | float grid_uv_y = round(SCREEN_UV.y * yFactor) / yFactor; 19 | 20 | vec4 text = texture(SCREEN_TEXTURE, vec2(grid_uv_x, grid_uv_y)); 21 | 22 | COLOR = text; 23 | } -------------------------------------------------------------------------------- /addons/post_processing/shaders/post_process.svg: -------------------------------------------------------------------------------- 1 | 2 | Projekt bez nazwy (2) 3 | 4 | 5 | 6 | 8 | 9 | -------------------------------------------------------------------------------- /addons/post_processing/shaders/post_process.svg.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://b6ml16b2jkbl2" 6 | path="res://.godot/imported/post_process.svg-b065ed97f6998946e1ca98a22c2e2b81.ctex" 7 | metadata={ 8 | "vram_texture": false 9 | } 10 | 11 | [deps] 12 | 13 | source_file="res://addons/post_processing/shaders/post_process.svg" 14 | dest_files=["res://.godot/imported/post_process.svg-b065ed97f6998946e1ca98a22c2e2b81.ctex"] 15 | 16 | [params] 17 | 18 | compress/mode=0 19 | compress/high_quality=false 20 | compress/lossy_quality=0.7 21 | compress/hdr_compression=1 22 | compress/normal_map=0 23 | compress/channel_pack=0 24 | mipmaps/generate=false 25 | mipmaps/limit=-1 26 | roughness/mode=0 27 | roughness/src_normal="" 28 | process/fix_alpha_border=true 29 | process/premult_alpha=false 30 | process/normal_map_invert_y=false 31 | process/hdr_as_srgb=false 32 | process/hdr_clamp_exposure=false 33 | process/size_limit=0 34 | detect_3d/compress_to=1 35 | svg/scale=1.0 36 | editor/scale_with_editor_scale=false 37 | editor/convert_colors_with_editor_theme=false 38 | -------------------------------------------------------------------------------- /addons/post_processing/shaders/screen_shake.gdshader: -------------------------------------------------------------------------------- 1 | /* 2 | Camera Shake Effect Shader by @Near 3 | 4 | MIT License 5 | */ 6 | 7 | shader_type canvas_item; 8 | uniform float ShakeStrength = 0; 9 | uniform vec2 FactorA = vec2(100.0,100.0); 10 | uniform vec2 FactorB = vec2(1.0,1.0); 11 | uniform vec2 magnitude = vec2(0.01,0.01); 12 | uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap; 13 | 14 | void fragment() { 15 | vec2 uv = SCREEN_UV; 16 | uv -= 0.5; 17 | uv *= 1.0 - 2.0 * magnitude.x; 18 | uv += 0.5; 19 | vec2 dt = vec2(0.0, 0.0); 20 | dt.x = sin(TIME * FactorA.x+FactorB.x) * magnitude.x; 21 | dt.y = cos(TIME *FactorA.y+ FactorB.y) * magnitude.y; 22 | COLOR = texture(SCREEN_TEXTURE,uv + (dt*ShakeStrength)); 23 | } 24 | 25 | -------------------------------------------------------------------------------- /addons/post_processing/shaders/speed_lines.gdshader: -------------------------------------------------------------------------------- 1 | shader_type canvas_item; 2 | 3 | 4 | uniform sampler2D noise: repeat_enable; 5 | uniform vec4 line_color: source_color; 6 | uniform float line_count: hint_range(0.0, 2.0, 0.05) = 2; 7 | uniform float line_density: hint_range(0.0, 1.0) = 0.56; 8 | uniform float line_faloff: hint_range(0.0, 1.0) = 0; 9 | uniform float mask_size: hint_range(0.0, 1.0) = 0.333; 10 | uniform float mask_edge: hint_range(0.0, 1.0) = 0.372; 11 | uniform float animation_speed: hint_range(1.0, 20.0) = 20; 12 | 13 | 14 | 15 | 16 | float inv_lerp(float from, float to, float value){ 17 | return (value - from) / (to - from); 18 | } 19 | 20 | 21 | 22 | 23 | vec2 polar_coordinates(vec2 uv, vec2 center, float zoom, float repeat) 24 | { 25 | vec2 dir = uv - center; 26 | float radius = length(dir) * 2.0; 27 | float angle = atan(dir.y, dir.x) * 1.0/(PI * 2.0); 28 | return mod(vec2(radius * zoom, angle * repeat), 1.0); 29 | } 30 | 31 | 32 | 33 | 34 | vec2 rotate_uv(vec2 uv, vec2 pivot, float rotation) { 35 | float cosa = cos(rotation); 36 | float sina = sin(rotation); 37 | uv -= pivot; 38 | return vec2( 39 | cosa * uv.x - sina * uv.y, 40 | cosa * uv.y + sina * uv.x 41 | ) + pivot; 42 | } 43 | 44 | 45 | 46 | 47 | void fragment(){ 48 | vec2 polar_uv = polar_coordinates(rotate_uv(UV, vec2(0.5), floor(fract(TIME) * animation_speed) ) , vec2(0.5), 0.01, line_count); 49 | vec3 lines = texture(noise, polar_uv).rgb; 50 | 51 | float mask_value = length(UV - vec2(0.5)); 52 | float mask = inv_lerp(mask_size, mask_edge, mask_value); 53 | float result = 1.0 - (mask * line_density); 54 | 55 | result = smoothstep(result, result + line_faloff, lines.r); 56 | 57 | COLOR.rgb = vec3(line_color.rgb); 58 | COLOR.a = min(line_color.a, result); 59 | } -------------------------------------------------------------------------------- /addons/post_processing/shaders/vignette.gdshader: -------------------------------------------------------------------------------- 1 | shader_type canvas_item; 2 | 3 | uniform float vignette_intensity = 0.4; 4 | uniform float vignette_opacity : hint_range(0.0, 1.0) = 0.5; 5 | uniform vec4 vignette_rgb : source_color = vec4(0.0, 0.0, 0.0, 1.0); 6 | 7 | uniform sampler2D screen_vec : hint_screen_texture; 8 | 9 | float vignette(vec2 uv){ 10 | uv *= 1.0 - uv.xy; 11 | float vignette = uv.x * uv.y * 15.0; 12 | return pow(vignette, vignette_intensity * vignette_opacity); 13 | } 14 | 15 | void fragment(){ 16 | vec4 color = texture(screen_vec, SCREEN_UV); 17 | vec4 text = texture(TEXTURE, UV); 18 | 19 | text.rgba *= (vignette_rgb.rgba); 20 | text.rgba *= (1.0 - vignette(UV)); 21 | 22 | COLOR = vec4((text.rgb)*color.rgb,text.a); 23 | } -------------------------------------------------------------------------------- /addons/post_processing/shaders/water.gdshader: -------------------------------------------------------------------------------- 1 | shader_type canvas_item; 2 | 3 | uniform float first_stage : hint_range(0.0, 1.0) = 0.5; 4 | uniform float first_smooth : hint_range(0.0, 1.0) = 0.0; // Lengthens the color transition 5 | uniform float second_stage : hint_range(0.0, 1.0) = 0.0; // If left at 0, only level 1 is used. 6 | uniform float second_smooth : hint_range(0.0, 1.0) = 0.0; 7 | uniform float min_light : hint_range(0.0, 1.0) = 0.0; 8 | uniform float mid_light : hint_range(0.0, 1.0) = 0.0; 9 | uniform float max_light : hint_range(0.0, 1.0) = 1.0; 10 | uniform float obj_light_add : hint_range(0.0, 1.0) = 0.0; 11 | 12 | float light_calc(float light_strength, float would_be_strength) { 13 | float target_strength = light_strength + would_be_strength * obj_light_add; 14 | if (target_strength == 0.0) {target_strength = 0.000001;} 15 | if (would_be_strength == 0.0) {would_be_strength = 1.0;} 16 | return(target_strength / would_be_strength); 17 | } 18 | 19 | void light() { 20 | float level_1 = first_stage; 21 | float level_1_smooth = first_smooth; 22 | float level_2 = second_stage; 23 | float level_2_smooth = second_smooth; 24 | 25 | float mid_range_light = mid_light; 26 | if (mid_light == 0.0) { mid_range_light = max_light * 0.5; } 27 | vec3 light_normal = normalize(vec3(LIGHT_VEC, -LIGHT_HEIGHT)); 28 | float would_be_strength = max(dot(-light_normal, NORMAL), 0.0); 29 | if (would_be_strength > level_1 && level_2 == 0.0 ) { 30 | float diff = smoothstep(level_1, (level_1 + level_1_smooth), would_be_strength) + min_light; 31 | if (diff >= max_light) {diff = max_light;} 32 | LIGHT *= light_calc(diff, would_be_strength); 33 | } else if (would_be_strength > level_1 && would_be_strength < level_2 && level_2 != 0.0 ) { 34 | float diff = smoothstep(level_1, (level_1 + level_1_smooth), would_be_strength) + min_light; 35 | if (diff >= mid_range_light ) {diff = mid_range_light;} 36 | LIGHT *= light_calc(diff, would_be_strength); 37 | } else if (would_be_strength >= level_2 && level_2 != 0.0 ) { 38 | float diff = smoothstep(level_2, (level_2 + level_2_smooth), would_be_strength) + mid_range_light; 39 | if (diff < mid_range_light ) {diff = mid_range_light;} 40 | if (diff >= max_light) {diff = max_light;} 41 | LIGHT *= light_calc(diff, would_be_strength); 42 | } else { 43 | if (min_light != 0.0) { 44 | LIGHT_VEC = -NORMAL.xy*length(LIGHT_VEC); 45 | } 46 | LIGHT *= min_light; 47 | } 48 | } --------------------------------------------------------------------------------