Improved under water effect

This commit is contained in:
Marinho Brandao 2023-12-18 19:03:51 +01:00
parent 07b6381aa1
commit cc32f177c9
2 changed files with 8 additions and 7 deletions

View File

@ -8,10 +8,10 @@
[ext_resource type="PackedScene" uid="uid://dv3o1u4hc11vn" path="res://camera-effects/sepia.tscn" id="10_rqewe"]
[ext_resource type="PackedScene" uid="uid://cf1adbox8xy7e" path="res://camera-effects/grain_noise.tscn" id="11_3qobw"]
[ext_resource type="PackedScene" uid="uid://dfy4v47aijqqp" path="res://camera-effects/under_water.tscn" id="12_76kh0"]
[ext_resource type="PackedScene" path="res://camera-effects/hexagon_mosaic.tscn" id="12_uvrob"]
[ext_resource type="PackedScene" path="res://camera-effects/mirage.tscn" id="13_rc6we"]
[ext_resource type="PackedScene" path="res://camera-effects/color_correction.tscn" id="14_71y06"]
[ext_resource type="PackedScene" path="res://camera-effects/camera_shake.tscn" id="14_qhoe5"]
[ext_resource type="PackedScene" uid="uid://dwppksddt4t0x" path="res://camera-effects/hexagon_mosaic.tscn" id="12_uvrob"]
[ext_resource type="PackedScene" uid="uid://0ef8k2idbr15" path="res://camera-effects/mirage.tscn" id="13_rc6we"]
[ext_resource type="PackedScene" uid="uid://b3uydqubrgd0g" path="res://camera-effects/color_correction.tscn" id="14_71y06"]
[ext_resource type="PackedScene" uid="uid://dxnm4sgbeu22g" path="res://camera-effects/camera_shake.tscn" id="14_qhoe5"]
[ext_resource type="Texture2D" uid="uid://etnwfy334jt" path="res://addons/kenney_particle_pack/window_03.png" id="14_ydbvf"]
[ext_resource type="PackedScene" uid="uid://0f6ab8y0i26l" path="res://camera-effects/monocolor.tscn" id="15_e7wly"]
[ext_resource type="PackedScene" uid="uid://kli822acdl5m" path="res://camera-effects/blur.tscn" id="15_kmr3r"]

View File

@ -5,6 +5,7 @@ uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap;
uniform float speed : hint_range(0.0, 5.0) = .5;
uniform float strength : hint_range(0.0, 1.0) = .5;
uniform float intensity : hint_range(0.0, 1.0) = .5;
uniform float distortionStrength : hint_range(0.0, 20.0) = 5.0;
uniform int maximumIterations : hint_range(0, 10) = 5;
uniform bool showTiling = false;
uniform bool showYellowLine = false;
@ -38,8 +39,8 @@ void fragment() {
}
c /= float(maximumIterations);
c = 1.17-pow(c, 1.4);
vec3 colour = vec3(pow(abs(c), 8.0));
colour = clamp(colour + vec3(0.0, 0.35, 0.5), 0.0, 1.0);
vec3 colorBase = vec3(pow(abs(c), 8.0));
vec3 colour = clamp(colorBase + vec3(0.0, 0.35, 0.5), 0.0, 1.0);
if (showTiling) {
// Flash tile borders...
@ -53,7 +54,7 @@ void fragment() {
colour = mix(colour, vec3(1.0, 1.0, 0.0), (uv.x + uv.y) * first.x * first.y); // Yellow line
}
vec4 pixelColor = texture(SCREEN_TEXTURE, UV);
vec4 pixelColor = textureLod(SCREEN_TEXTURE, UV, colorBase.r * distortionStrength);
vec3 appliedColor = mix(pixelColor.rgb, colour, strength);
COLOR = vec4(appliedColor, 1.0);