rename uniforms
This commit is contained in:
parent
1683d2bbe9
commit
53a62f639e
5 changed files with 59 additions and 37 deletions
|
|
@ -11,8 +11,8 @@
|
|||
precision mediump float;
|
||||
#endif
|
||||
|
||||
uniform float u_time;
|
||||
uniform vec2 u_resolution;
|
||||
uniform float uTime;
|
||||
uniform vec2 uResolution;
|
||||
|
||||
/* ==== Text Colouring ==== */
|
||||
#define PHOSPHOR_COL vec4(196./255., 167./255., 231./255., 1.)
|
||||
|
|
@ -155,9 +155,9 @@ float roundLine(vec2 p, vec2 a, vec2 b) {
|
|||
b -= a + vec2(1.0,0.);
|
||||
p -= a;
|
||||
float f = length(p-clamp(dot(p,b)/dot(b,b),0.0,1.0)*b);
|
||||
if (u_resolution.y < 320.) // attempt to get rid of aliasing on small resolution
|
||||
if (uResolution.y < 320.) // attempt to get rid of aliasing on small resolution
|
||||
return smoothstep(1.0, 0.9, f);
|
||||
else if (u_resolution.y < 720.)
|
||||
else if (uResolution.y < 720.)
|
||||
return smoothstep(0.75, 0.5, f);
|
||||
else
|
||||
return smoothstep(1., 0., f);
|
||||
|
|
@ -305,7 +305,7 @@ float vt220Font(vec2 p, float c) {
|
|||
// https://www.shadertoy.com/view/MsdGWn
|
||||
//
|
||||
float textLines(vec2 uvG) {
|
||||
float wt = 5. * (u_time + 0.5*sin(u_time*1.4) + 0.2*sin(u_time*2.9)); // wobbly time
|
||||
float wt = 5. * (uTime + 0.5*sin(uTime*1.4) + 0.2*sin(uTime*2.9)); // wobbly time
|
||||
vec2 uvGt = uvG + vec2(0., floor(wt));
|
||||
float ll = rand(vec2(uvGt.y, - 1.)) * ROWCOLS.x; // line length
|
||||
|
||||
|
|
@ -351,21 +351,21 @@ float smokeNoise(vec3 v) {
|
|||
}
|
||||
|
||||
void main() {
|
||||
vec2 uv = vec2(gl_FragCoord.x, u_resolution.y - gl_FragCoord.y);
|
||||
vec2 uvT = ROWCOLS * FONT_SIZE * uv / u_resolution.xy;
|
||||
vec2 uvG = floor(ROWCOLS * uv / u_resolution.xy);
|
||||
vec2 uvC = gl_FragCoord.xy / u_resolution.xy;
|
||||
vec2 uv = vec2(gl_FragCoord.x, uResolution.y - gl_FragCoord.y);
|
||||
vec2 uvT = ROWCOLS * FONT_SIZE * uv / uResolution.xy;
|
||||
vec2 uvG = floor(ROWCOLS * uv / uResolution.xy);
|
||||
vec2 uvC = gl_FragCoord.xy / uResolution.xy;
|
||||
|
||||
vec2 uvNoise = gl_FragCoord.xy / u_resolution.xy;
|
||||
vec2 uvNoise = gl_FragCoord.xy / uResolution.xy;
|
||||
uvNoise = ceil(uvNoise * ROWCOLS) / ROWCOLS;
|
||||
|
||||
float val;
|
||||
if (u_time < 2.0)
|
||||
if (uTime < 2.0)
|
||||
val = textLines(uvG);
|
||||
else if (u_time < 2.3)
|
||||
val = rand(uvG * u_time) * 17.;
|
||||
else if (uTime < 2.3)
|
||||
val = rand(uvG * uTime) * 17.;
|
||||
else {
|
||||
float noise = smokeNoise(vec3(uvNoise * noiseScale, u_time * noiseTimeScale));
|
||||
float noise = smokeNoise(vec3(uvNoise * noiseScale, uTime * noiseTimeScale));
|
||||
// Noise is fed through a sigmoid function, then quantised to integer range 0-17
|
||||
val = (exp(noise) / 2.71828); // increase contrast (normalised 0.0 - 1.0)
|
||||
val = 1.0 / val;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue