text scroller
This commit is contained in:
84
shader.glsl
84
shader.glsl
@ -51,7 +51,7 @@ float map(in vec3 p) {
|
||||
vec3 raymarch(in vec3 ro, vec3 rd, vec2 tminmax) {
|
||||
float t = tminmax.x;
|
||||
float dt = .02;
|
||||
//float dt = .2 - .195*cos(iTime*.05);//animated
|
||||
//float dt = .2 - .195*cos(time*.05);//animated
|
||||
vec3 col = vec3(0.);
|
||||
float c = 0.;
|
||||
for(int i = 0; i < 64; i++) {
|
||||
@ -187,19 +187,71 @@ void mainImage2(out vec4 fragColor, in vec2 fragCoord) {
|
||||
fragColor = vec4(col, 1.0 - t * (0.02 + 0.02 * sin(time)));
|
||||
}
|
||||
|
||||
void main(void) {
|
||||
if (getBar() <= 8)
|
||||
CoolSphere(gl_FragColor, gl_FragCoord.xy);
|
||||
else
|
||||
mainImage2(gl_FragColor, gl_FragCoord.xy);
|
||||
|
||||
|
||||
vec3 l;
|
||||
vec2 texttop = vec2(0., -.35), pt = (gl_FragCoord.xy / resolution) - texttop;
|
||||
if(pt.y > 0.) {
|
||||
l = gl_FragColor + texture2D(texts, pt);
|
||||
}
|
||||
|
||||
gl_FragColor = vec4(l * (1.0), 1.0);
|
||||
|
||||
vec3 palette(float t) {
|
||||
vec3 a = vec3(0.5, 0.5, 0.5);
|
||||
vec3 b = vec3(1.0, 1.0, 1.0);
|
||||
vec3 c = vec3(1.0, 1.0, 1.0);
|
||||
vec3 d = vec3(0.0, 0.6666, 0.3333);
|
||||
return a + b * cos(6.28318 * (c*t+d));
|
||||
}
|
||||
|
||||
float rand(vec2 co) {
|
||||
float a = 12.9898;
|
||||
float b = 78.233;
|
||||
float c = 43758.5453;
|
||||
float dt= dot(co.xy ,vec2(a,b));
|
||||
float sn= mod(dt,3.14);
|
||||
return fract(sin(sn) * c);
|
||||
}
|
||||
|
||||
vec3 random(vec2 coord) {
|
||||
float rng = rand(vec2(coord.x+time, coord.y));
|
||||
return vec3(0.05, 0.05, 0.05) * rng;
|
||||
|
||||
}
|
||||
|
||||
|
||||
vec3 wave(vec2 uv, float phase, float _offset, float height, float waveLenght, float color) {
|
||||
float val = -(sin(phase+uv.x*waveLenght+time) + (uv.y*6.+height)+_offset)*0.055;
|
||||
val *= 1. + sin(phase + uv.x*waveLenght+time) + (uv.y*6.-height+_offset);
|
||||
// return smoothstep(0.0, 32.0, val) * palette(color/360.);
|
||||
return clamp(val, 0., 1.) * palette(color/360.);
|
||||
}
|
||||
|
||||
vec2 waveTexture(vec2 uv) {
|
||||
uv.y = clamp(sin(uv.x*7. + time)/10. + uv.y, 0., 1.)+0.4;
|
||||
uv.x += sin(time);
|
||||
return uv;
|
||||
}
|
||||
|
||||
|
||||
void TextScroller(out vec4 fragColor, in vec2 fragCoord )
|
||||
{
|
||||
// Normalized pixel coordinates (from -1 to 1, origo at 0,0)
|
||||
vec2 uv = (fragCoord*2. - resolution) / resolution;
|
||||
vec2 uv2 = (fragCoord / resolution);
|
||||
vec3 col = vec3(0., 0.3, 0.6);
|
||||
col += texture2D(texts, waveTexture(uv2));
|
||||
col += wave(uv, 0., 1., 3., 1., sin(time+0.3)*360.);
|
||||
col += wave(uv, sin(time), 0., 3., -1., sin(time-1.2)*120.);
|
||||
col += wave(uv, -3., 0., 3., 1., sin(time+0.5)*90.);
|
||||
col += random(uv*2.);
|
||||
// Output to screen
|
||||
fragColor = vec4(col, 1.);
|
||||
}
|
||||
|
||||
void main(void) {
|
||||
if (getBar() <= 32)
|
||||
TextScroller(gl_FragColor, gl_FragCoord.xy);
|
||||
else
|
||||
{
|
||||
mainImage2(gl_FragColor, gl_FragCoord.xy);
|
||||
vec3 l;
|
||||
vec2 texttop = vec2(0., -.35), pt = (gl_FragCoord.xy / resolution) - texttop;
|
||||
if(pt.y > 0.) {
|
||||
l = gl_FragColor + texture2D(texts, pt);
|
||||
}
|
||||
|
||||
gl_FragColor = vec4(l * (1.0), 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user