forked from axiomgraph/enve-plugins
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main'
- Loading branch information
Showing
12 changed files
with
986 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
/* Adapted from https://www.shadertoy.com/view/3tGyWm Author : dtsmio | ||
Adapted for enve/friction by axiomgraph | ||
Opengl version 3.3*/ | ||
#version 330 core | ||
#define PI 3.1415926535 | ||
layout(location = 0) out vec4 fragColor; | ||
layout(pixel_center_integer) in vec4 gl_FragCoord; | ||
|
||
uniform sampler2D texture; | ||
uniform vec2 resolution; | ||
in vec2 texCoord; | ||
|
||
uniform float shape; | ||
uniform float size; | ||
float noi( in vec2 p ) | ||
{ | ||
return 0.5*(cos(6.2831*p.x) + cos(6.2831*p.y)); | ||
} | ||
|
||
//3D simplex noise from: https://www.shadertoy.com/view/XsX3zB | ||
const float F3 = 0.3333333; | ||
const float G3 = 0.1666667; | ||
|
||
vec3 random3(vec3 c) { | ||
float j = 4096.0*sin(dot(c,vec3(17.0, 59.4, 15.0))); | ||
vec3 r; | ||
r.z = fract(512.0*j); | ||
j *= .125; | ||
r.x = fract(512.0*j); | ||
j *= .125; | ||
r.y = fract(512.0*j); | ||
return r-0.5; | ||
} | ||
|
||
float simplex3d(vec3 p) { | ||
vec3 s = floor(p + dot(p, vec3(F3))); | ||
vec3 x = p - s + dot(s, vec3(G3)); | ||
|
||
vec3 e = step(vec3(0.0), x - x.yzx); | ||
vec3 i1 = e*(1.0 - e.zxy); | ||
vec3 i2 = 1.0 - e.zxy*(1.0 - e); | ||
|
||
vec3 x1 = x - i1 + G3; | ||
vec3 x2 = x - i2 + 2.0*G3; | ||
vec3 x3 = x - 1.0 + 3.0*G3; | ||
|
||
vec4 w, d; | ||
|
||
w.x = dot(x, x); | ||
w.y = dot(x1, x1); | ||
w.z = dot(x2, x2); | ||
w.w = dot(x3, x3); | ||
|
||
w = max(0.6 - w, 0.0); | ||
|
||
d.x = dot(random3(s), x); | ||
d.y = dot(random3(s + i1), x1); | ||
d.z = dot(random3(s + i2), x2); | ||
d.w = dot(random3(s + 1.0), x3); | ||
|
||
w *= w; | ||
w *= w; | ||
d *= w; | ||
|
||
return dot(d, vec4(52.0)); | ||
} | ||
|
||
float fbm(vec3 p) | ||
{ | ||
float f = 0.0; | ||
float frequency = 1.0; | ||
float amplitude = 0.5; | ||
for (int i = 0; i < 5; i++) | ||
{ | ||
f += simplex3d(p * frequency) * amplitude; | ||
amplitude *= 0.5; | ||
frequency *= 2.0 + float(i) / 100.0; | ||
} | ||
return abs(min(f, 1.0)); | ||
} | ||
|
||
|
||
float nsin(float a) // a = (-0.5:0.5) | ||
{ | ||
return sin(a * PI * 2.) * 0.5 + 0.5; | ||
} | ||
|
||
float ink(vec2 uv, float time, float prog) | ||
{ | ||
float a = atan(uv.y, uv.x) / PI / 2.; | ||
|
||
float f1 = fbm(vec3(nsin(a) * 0.5, 0., time)); | ||
f1 += fbm(vec3(nsin(a + 0.4) * 2.5, 1., time)) * 0.5; | ||
|
||
float f2 = fbm(vec3(nsin(a) * 25.5, 2., time)); | ||
f2 += fbm(vec3(nsin(a + 0.4) * 15.5, 3., time)) * 0.5; | ||
|
||
float mn = prog + f1 * 6. * prog; | ||
float mx = mn + (0.1 + f2 * 1.) * prog; | ||
|
||
return 1. - smoothstep(mn, mx, length(uv)); | ||
} | ||
|
||
void main(void) | ||
{ | ||
vec2 uv = (gl_FragCoord.xy - 0.5 * resolution.xy) / resolution.y; | ||
// vec2 uv1 = gl_FragCoord.xy/resolution.xy; | ||
|
||
vec3 col = vec3(0.0); | ||
|
||
|
||
uv *= 5.; | ||
uv.x += fbm(vec3(uv.x, uv.y, shape * 20.)) * 0.5; | ||
|
||
|
||
float ink1 =ink(uv + vec2(0.0, 0.) * vec2(sin(1.0 * 1264.), cos(1.0 * 12645.)), shape, size) ; | ||
|
||
col = mix(vec3(0.0),texture2D(texture,texCoord).rgb,ink1); | ||
|
||
fragColor = vec4(col,texture2D(texture,texCoord).a*ink1); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Adapted from https://www.shadertoy.com/view/3tGyWm Author : dtsmio | ||
Adapted for enve/friction by axiomgraph--> | ||
<ShaderEffect name="Ink Drop 2" menuPath="Transitions"> | ||
<Properties> | ||
<Property name="shape" nameUI="Shape" type="float" min="0.0" max="1000.0" ini="1.0" step ="0.01" glValue="true"/> | ||
<Property name="size" nameUI="Size" type="float" min="0.0" max="1000.0" ini="0.5" step ="0.01" glValue="true"/> | ||
</Properties> | ||
<glValues> | ||
<glValue name="resolution" type="vec2" value="[_eRect[2], _eRect[3]]"/> | ||
</glValues> | ||
</ShaderEffect> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/* Adapted from https://godotshaders.com/shader/god-rays/ Author : pend00 | ||
Adapted for enve/friction by axiomgraph | ||
Opengl version 3.3*/ | ||
#version 330 core | ||
#define PI 3.1415926535 | ||
layout(location = 0) out vec4 fragColor; | ||
layout(pixel_center_integer) in vec4 gl_FragCoord; | ||
|
||
uniform sampler2D texture; | ||
in vec2 texCoord; | ||
|
||
uniform float time; | ||
uniform float angle; | ||
uniform float position; | ||
uniform float spread; | ||
uniform float cutoff; | ||
uniform float falloff; | ||
uniform float edge_fade; | ||
|
||
uniform float speed; | ||
uniform float ray1_density; | ||
uniform float ray2_density; | ||
uniform float ray2_intensity; | ||
|
||
uniform vec4 color; | ||
|
||
uniform int hdr; // boolean value | ||
uniform float seed; | ||
|
||
// Random and noise functions from Book of Shader's chapter on Noise. | ||
float random(vec2 _uv) { | ||
return fract(sin(dot(_uv.xy, | ||
vec2(12.9898, 78.233))) * | ||
43758.5453123); | ||
} | ||
|
||
float noise (in vec2 uv) { | ||
vec2 i = floor(uv); | ||
vec2 f = fract(uv); | ||
|
||
// Four corners in 2D of a tile | ||
float a = random(i); | ||
float b = random(i + vec2(1.0, 0.0)); | ||
float c = random(i + vec2(0.0, 1.0)); | ||
float d = random(i + vec2(1.0, 1.0)); | ||
|
||
|
||
// Smooth Interpolation | ||
|
||
// Cubic Hermine Curve. Same as SmoothStep() | ||
vec2 u = f * f * (3.0-2.0 * f); | ||
|
||
// Mix 4 coorners percentages | ||
return mix(a, b, u.x) + | ||
(c - a)* u.y * (1.0 - u.x) + | ||
(d - b) * u.x * u.y; | ||
} | ||
|
||
mat2 rotate(float _angle){ | ||
return mat2(vec2(cos(_angle), -sin(_angle)), | ||
vec2(sin(_angle), cos(_angle))); | ||
} | ||
|
||
|
||
void main(void) | ||
{ | ||
|
||
// Rotate, skew and move the UVs | ||
vec2 transformed_uv = ( rotate(angle) * (texCoord - position) ) / ( (texCoord.y + spread) - (texCoord.y * spread) ); | ||
|
||
// Animate the ray according the the new transformed UVs | ||
vec2 ray1 = vec2(transformed_uv.x * ray1_density + sin(time * 0.1 * speed) * (ray1_density * 0.2) + seed, 1.0); | ||
vec2 ray2 = vec2(transformed_uv.x * ray2_density + sin(time * 0.2 * speed) * (ray1_density * 0.2) + seed, 1.0); | ||
|
||
// Cut off the ray's edges | ||
float cut = step(cutoff, transformed_uv.x) * step(cutoff, 1.0 - transformed_uv.x); | ||
ray1 *= cut; | ||
ray2 *= cut; | ||
|
||
// Apply the noise pattern (i.e. create the rays) | ||
float rays; | ||
|
||
if (bool(hdr)){ | ||
// This is not really HDR, but check this to not clamp the two merged rays making | ||
// their values go over 1.0. Can make for some nice effect | ||
rays = noise(ray1) + (noise(ray2) * ray2_intensity); | ||
} | ||
else{ | ||
rays = clamp(noise(ray1) + (noise(ray2) * ray2_intensity), 0., 1.); | ||
} | ||
|
||
// Fade out edges | ||
rays *= smoothstep(0.0, falloff, (1.0 - texCoord.y)); // Bottom | ||
rays *= smoothstep(0.0 + cutoff, edge_fade + cutoff, transformed_uv.x); // Left | ||
rays *= smoothstep(0.0 + cutoff, edge_fade + cutoff, 1.0 - transformed_uv.x); // Right | ||
|
||
// Color to the rays | ||
vec3 shine = vec3(rays) * color.rgb; | ||
|
||
|
||
fragColor = vec4(shine, rays * texture2D(texture, texCoord).a); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!-- Adapted from https://godotshaders.com/shader/god-rays/ Author : pend00 | ||
Adapted for enve/friction by axiomgraph--> | ||
<ShaderEffect name="God Rays" menuPath="Light And Shadow"> | ||
<Properties> | ||
<Property name="time" nameUI="Time" type="float" min="-1000.0" max="1000.0" ini="1.0" step ="1.0" glValue="true"/> | ||
<Property name="angle" nameUI="Angle" type="float" min="-1000.0" max="1000.0" ini="-0.3" step ="0.01" glValue="true"/> | ||
<Property name="position" nameUI="Position" type="float" min="-1000.0" max="1000.0" ini="-0.2" step ="0.01" glValue="true"/> | ||
<Property name="spread" nameUI="Spread" type="float" min="0.0" max="1.0" ini="0.5" step ="0.01" glValue="true"/> | ||
|
||
<Property name="cutoff" nameUI="Cutoff" type="float" min="-1.0" max="10.0" ini="0.1" step ="0.01" glValue="true"/> | ||
<Property name="falloff" nameUI="Falloff" type="float" min="0.0" max="10.0" ini="0.2" step ="0.01" glValue="true"/> | ||
<Property name="edge_fade" nameUI="Edge Fade" type="float" min="0.0" max="1.0" ini="0.15" step ="0.01" glValue="true"/> | ||
<Property name="speed" nameUI="Speed" type="float" min="0.0" max="100.0" ini="1.0" step ="0.1" glValue="true"/> | ||
|
||
<Property name="ray1_density" nameUI="Ray 1 Density" type="float" min="0.0" max="1000.0" ini="8.0" step ="0.01" glValue="true"/> | ||
<Property name="ray2_density" nameUI="Ray 2 Density" type="float" min="0.0" max="1000.0" ini="30.0" step ="0.1" glValue="true"/> | ||
<Property name="ray2_intensity" nameUI="Ray 2 Intensity" type="float" min="0.0" max="1.0" ini="0.3" step ="0.01" glValue="true"/> | ||
|
||
<Property name="color" nameUI="Color" type="color" ini="[1.0, 0.9, 0.65, 0.8]" glValue="true"/> | ||
|
||
<Property name="hdr" nameUI="HDR" type="int" min="0" max="1" ini="0" step ="1" glValue="true"/> | ||
<Property name="seed" nameUI="Seed" type="float" min="0.0" max="1000.0" ini="5.0" step ="1.0" glValue="true"/> | ||
</Properties> | ||
</ShaderEffect> |
Oops, something went wrong.