A sky roads like game with interesting shaders
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 

53 lines
1.5 KiB

varying lowp vec2 texCoordVarying;
varying highp vec4 positionVarying;
uniform sampler2D tex;
uniform highp float time;
const highp float threshold = 1.0;
const highp float width = 0.5;
const highp float smoothness = 0.2;
const highp float exposure = 0.8;
const highp float mix = 2.0;
void main( void ) {
lowp vec4 orig = texture2D(tex, texCoordVarying);
if(length(orig.xyz) <= 0.01){
gl_FragColor.b = positionVarying.y*0.5+0.5;
gl_FragColor.g = 0.5 * gl_FragColor.b * (0.1 * cos(positionVarying.x*3.0) + 1.0);
gl_FragColor.r = 0.2 * abs(sin(-positionVarying.y*positionVarying.x*(10.0 + sin(time*0.51337)) + time*time*0.2337))
+ 0.2 * abs(sin(-(positionVarying.y-0.7)*positionVarying.x*(8.0 + sin(time*0.41337)) - time*time*0.1337 + 1.0));;
} else {
gl_FragColor = exposure*(mix*orig + (1.0 - mix)*normalize(orig));
}
if(true) { // shine
lowp vec2 offset = vec2(0.01, 0.0)*width;
lowp vec4 a = texture2D(tex, texCoordVarying - offset);
lowp vec4 b = texture2D(tex, texCoordVarying + offset);
gl_FragColor -= smoothness*(orig - a);
gl_FragColor -= smoothness*(orig - b);
if(length(a-b) > threshold)
gl_FragColor = vec4(0.0);
}
if(true) { // shine
lowp vec2 offset = vec2(0.0, 0.01)*width;
lowp vec4 a = texture2D(tex, texCoordVarying - offset);
lowp vec4 b = texture2D(tex, texCoordVarying + offset);
gl_FragColor -= smoothness*(orig - a);
gl_FragColor -= smoothness*(orig - b);
if(length(a-b) > threshold)
gl_FragColor = vec4(0.0);
}
gl_FragColor.a = 1.0;
}