forked from team-sg/hero-mark-2
allow changing fps of noise shader
This commit is contained in:
parent
04f1e8ed44
commit
f3758b26d2
1 changed files with 3 additions and 1 deletions
|
@ -2,6 +2,7 @@ shader_type canvas_item;
|
||||||
|
|
||||||
uniform bool animate_noise = false;
|
uniform bool animate_noise = false;
|
||||||
uniform float noise_intensity = 1.0;
|
uniform float noise_intensity = 1.0;
|
||||||
|
uniform float fps = 60.0;
|
||||||
|
|
||||||
float random (vec2 uv) {
|
float random (vec2 uv) {
|
||||||
return fract(sin(dot(uv.xy,
|
return fract(sin(dot(uv.xy,
|
||||||
|
@ -9,7 +10,8 @@ float random (vec2 uv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void fragment() {
|
void fragment() {
|
||||||
vec2 noise_uv = SCREEN_UV + fract(TIME) * float(animate_noise);
|
float time = floor(fract(TIME) * fps);
|
||||||
|
vec2 noise_uv = SCREEN_UV + time * float(animate_noise);
|
||||||
float noise = random(noise_uv);
|
float noise = random(noise_uv);
|
||||||
noise = mix(1.0 - noise_intensity, 1.0, noise);
|
noise = mix(1.0 - noise_intensity, 1.0, noise);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue