rename uTime/uResolution -> u_time/u_resolution

This commit is contained in:
Emile Clark-Boman 2026-01-31 12:33:28 +10:00
parent daa51a24fd
commit 9902dce1b7

View file

@ -4,12 +4,15 @@
* View this shader on shadertoy: https://www.shadertoy.com/view/t3tSRj#
*/
#ifdef GL_ES
precision highp float;
// is highp wasteful for this shader?
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
uniform float uTime;
uniform vec2 uResolution;
uniform float u_time;
uniform vec2 u_resolution;
/* ==== Text Colouring ==== */
#define PHOSPHOR_COL vec4(1, 1., 1., 1.)
@ -151,9 +154,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 (uResolution.y < 320.) // attempt to get rid of aliasing on small resolution
if (u_resolution.y < 320.) // attempt to get rid of aliasing on small resolution
return smoothstep(1.0, 0.9, f);
else if (uResolution.y < 720.)
else if (u_resolution.y < 720.)
return smoothstep(0.75, 0.5, f);
else
return smoothstep(1., 0., f);
@ -301,7 +304,7 @@ float vt220Font(vec2 p, float c) {
// https://www.shadertoy.com/view/MsdGWn
//
float textLines(vec2 uvG) {
float wt = 5. * (uTime + 0.5*sin(uTime*1.4) + 0.2*sin(uTime*2.9)); // wobbly time
float wt = 5. * (u_time + 0.5*sin(u_time*1.4) + 0.2*sin(u_time*2.9)); // wobbly time
vec2 uvGt = uvG + vec2(0., floor(wt));
float ll = rand(vec2(uvGt.y, - 1.)) * ROWCOLS.x; // line length
@ -346,33 +349,22 @@ float smokeNoise(vec3 v) {
return fbm5(v) / 2. + 0.5;
}
// ===================================================================
// Graphical Styling / Effects
//
float bloom(vec2 uv2) {
// TODO
c += (textureLod(iChannel0, uvC, 3.) +
textureLod(iChannel0, uvC, 4.) +
textureLod(iChannel0, uvC, 5.))
* smoothstep(0., -SMOOTH*20., stdRS(uvC, -0.02)) * 0.5;
}
void main() {
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;
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 uvNoise = uvC;
vec2 uvNoise = gl_FragCoord.xy / u_resolution.xy;
uvNoise = ceil(uvNoise * ROWCOLS) / ROWCOLS;
float val;
if (uTime < 2.0)
if (u_time < 2.0)
val = textLines(uvG);
else if (uTime < 2.3)
val = rand(uvG * uTime) * 17.;
else if (u_time < 2.3)
val = rand(uvG * u_time) * 17.;
else {
float noise = smokeNoise(vec3(uvNoise * noiseScale, uTime * noiseTimeScale));
float noise = smokeNoise(vec3(uvNoise * noiseScale, u_time * 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;