53 lines
1.5 KiB
Plaintext
53 lines
1.5 KiB
Plaintext
[gd_resource type="ShaderMaterial" load_steps=3 format=3 uid="uid://c88aptbv2lgbu"]
|
|
|
|
[ext_resource type="Texture2D" uid="uid://bsxod2wcjw5ik" path="res://visuals/textures/new_noise_texture_2d.tres" id="1_seqd6"]
|
|
|
|
[sub_resource type="Shader" id="Shader_ytjmb"]
|
|
resource_local_to_scene = true
|
|
code = "shader_type canvas_item;
|
|
|
|
uniform sampler2D noise;
|
|
varying vec4 modulate;
|
|
uniform float threshold : hint_range(0,0.5)= .5;
|
|
uniform float strength : hint_range(-0.5,0.5) = 0;
|
|
float random (vec2 uv) {
|
|
return fract(sin(dot(uv.xy,
|
|
vec2(12.9898,78.233))) * 43758.5453123);
|
|
}
|
|
|
|
void vertex() {
|
|
// Called for every vertex the material is visible on.
|
|
modulate = COLOR;
|
|
}
|
|
|
|
void fragment() {
|
|
// Called for every pixel the material is visible on.
|
|
vec2 uv = UV;
|
|
vec2 rv = vec2(mod(TIME / 3.5, 1.0), uv.y);
|
|
vec4 val = texture(noise, rv);
|
|
|
|
uv.x += .002 * (val.x - 0.5) * 2.0;
|
|
float extrema = abs(val.x - 0.5);
|
|
//if(extrema > threshold){
|
|
//uv.x += sign(val.x - 0.5) * mix(0,strength, (extrema) / (.5 - threshold));
|
|
//}
|
|
if(extrema > threshold){
|
|
uv.x -= strength * (val.x - 0.5) * 2.0;
|
|
}
|
|
vec4 col = texture(TEXTURE, uv) * modulate;
|
|
COLOR = col; //* COLOR;
|
|
//COLOR = val;
|
|
}
|
|
|
|
//void light() {
|
|
// // Called for every pixel for every light affecting the CanvasItem.
|
|
// // Uncomment to replace the default light processing function with this one.
|
|
//}
|
|
"
|
|
|
|
[resource]
|
|
shader = SubResource("Shader_ytjmb")
|
|
shader_parameter/noise = ExtResource("1_seqd6")
|
|
shader_parameter/threshold = 0.1150000054625
|
|
shader_parameter/strength = 0.09000002802499996
|