Cloud

Riccardo Bazzoni
Schermata 2017 05 18 alle 17.37.08

 Shader #1

#define hypot(x, y) sqrt(x*x+y*y)
#define xor(x, y)	((!(x&&y))&&(x||y))
#define sinh(x)		(0.5*(exp(x) - exp(-x)))
#define cosh(x)		(0.5*(exp(x) + exp(-x)))
#define tanh(x)		((sinh(x))/(cosh(x)))
#define asinh(x)	(log(x) + sqrt(x*x+1.))
#define acosh(x)	(log(x) + sqrt(x*x-1.))
#define atanh(x)	(0.5*log((1.+x)/(1.-x)))

vec2 jit_wrap1(vec2 v) {
	return mod(v, 1.);
}

vec2 jit_clamp1(vec2 v) {
	return clamp(v, 0., 1.);
}

vec2 jit_mirror1(vec2 v) {
	return 1.-abs((mod(v, 2.)-1.));
}


uniform float fb;
uniform float y;
uniform float ampsorting;
uniform float x;
uniform float effect;
uniform samplerJit0 tin1;
uniform samplerJit1 tin2;
uniform samplerJit2 tin3;
uniform samplerJit3 tin4;

varying vec2 texcoord1;
varying vec2 texcoord2;
varying vec2 texcoord3;
varying vec2 texcoord4;
varying vec2 flip1;
varying vec2 flip1_offset;
varying vec2 flip2;
varying vec2 flip2_offset;
varying vec2 flip3;
varying vec2 flip3_offset;
varying vec2 flip4;
varying vec2 flip4_offset;
varying vec2 texdim1;
varying vec2 texdim2;
varying vec2 texdim3;
varying vec2 texdim4;
varying vec2 texcoord;


vec4 sample_clamp_unit1(samplerJit1 tex, vec2 tc);
vec4 sample_clamp_unit0(samplerJit0 tex, vec2 tc);
vec4 sample_clamp_unit1(samplerJit1 tex, vec2 tc) { return textureJit1(tex, (flip2_offset+jit_clamp1(tc)*flip2)*texdim2); }
vec4 sample_clamp_unit0(samplerJit0 tex, vec2 tc) { return textureJit0(tex, (flip1_offset+jit_clamp1(tc)*flip1)*texdim1); } void main() { vec4 in1 = textureJit0(tin1, texcoord1); vec4 in2 = textureJit1(tin2, texcoord2); vec4 in3 = textureJit2(tin3, texcoord3); vec4 in4 = textureJit3(tin4, texcoord4); vec2 norm = texcoord; vec4 mul_21 = (in4 * 0.3); vec4 mul_23 = (in1 * 0.0); vec2 vec_17 = (vec2(x, y)); vec2 add_31 = (norm + vec_17); vec4 mul_29 = (in3 * effect); vec4 add_30 = (vec4(add_31, 0.0, 0.0) + mul_29); vec4 sample_33 = ((sample_clamp_unit1(tin2, vec2(add_30)))); vec4 mul_38 = (sample_33 * fb); vec4 mul_35 = (mul_38 * 0.99); vec4 mul_27 = (mul_38 * 0.0); vec4 mul_28 = (mul_38 * 0.1); vec2 vec_34 = (vec2(float(mul_27), float(mul_28))); vec2 mul_26 = (vec_34 * ampsorting); vec2 add_25 = (mul_26 + 0.0); vec2 add_36 = (norm + add_25); vec4 sample_41 = ((sample_clamp_unit0(tin1, add_36))); vec4 mul_37 = (sample_41 * 0.05); vec4 add_39 = (mul_37 + mul_35); vec4 mul_24 = (add_39 * 0.99); vec4 mul_22 = ((mul_24 + mul_23) * 0.7); vec4 mul_20 = ((mul_22 + mul_21) * 1.0); vec4 mul_18 = (mul_20 * 0.95); gl_FragData[0] = mul_18; }

 Shader #2

varying vec2 texcoord1;
varying vec2 texcoord2;
varying vec2 texcoord3;
varying vec2 texcoord4;
varying vec2 flip1;
varying vec2 flip1_offset;
varying vec2 flip2;
varying vec2 flip2_offset;
varying vec2 flip3;
varying vec2 flip3_offset;
varying vec2 flip4;
varying vec2 flip4_offset;
varying vec2 texdim1;
varying vec2 texdim2;
varying vec2 texdim3;
varying vec2 texdim4;
varying vec2 texcoord;
void main() {
texcoord = vec2(gl_MultiTexCoord0.x, 1.-gl_MultiTexCoord0.y); texcoord1 = vec2(gl_TextureMatrix[0]*gl_MultiTexCoord0); texcoord2 = vec2(gl_TextureMatrix[1]*gl_MultiTexCoord1); texcoord3 = vec2(gl_TextureMatrix[2]*gl_MultiTexCoord2); texcoord4 = vec2(gl_TextureMatrix[3]*gl_MultiTexCoord3); texdim1 = vec2(gl_TextureMatrix[0][0][0],gl_TextureMatrix[0][1][1]); texdim2 = vec2(gl_TextureMatrix[1][0][0],gl_TextureMatrix[1][1][1]); texdim3 = vec2(gl_TextureMatrix[2][0][0],gl_TextureMatrix[2][1][1]); texdim4 = vec2(gl_TextureMatrix[3][0][0],gl_TextureMatrix[3][1][1]); flip1 = texdim1/abs(texdim1); flip1.y *= -1.; flip1_offset = vec2(0., abs(min(flip1.y, 0.))); flip2 = texdim2/abs(texdim2); flip2.y *= -1.; flip2_offset = vec2(0., abs(min(flip2.y, 0.))); flip3 = texdim3/abs(texdim3); flip3.y *= -1.; flip3_offset = vec2(0., abs(min(flip3.y, 0.))); flip4 = texdim4/abs(texdim4); flip4.y *= -1.; flip4_offset = vec2(0., abs(min(flip4.y, 0.))); texdim1 = abs(texdim1); texdim2 = abs(texdim2); texdim3 = abs(texdim3); texdim4 = abs(texdim4); gl_Position = ftransform(); }