port from perforce
This commit is contained in:
7
hgplus/ShaderMinifier/tests/real/extatique/blit.fs
Normal file
7
hgplus/ShaderMinifier/tests/real/extatique/blit.fs
Normal file
@@ -0,0 +1,7 @@
|
||||
uniform sampler2D tex;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 p = gl_TexCoord[0].xy;
|
||||
gl_FragColor = gl_Color * texture2D(tex, p);
|
||||
}
|
||||
6
hgplus/ShaderMinifier/tests/real/extatique/blit.vs
Normal file
6
hgplus/ShaderMinifier/tests/real/extatique/blit.vs
Normal file
@@ -0,0 +1,6 @@
|
||||
void main()
|
||||
{
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
gl_FrontColor = gl_Color;
|
||||
gl_Position = ftransform();
|
||||
}
|
||||
12
hgplus/ShaderMinifier/tests/real/extatique/blit2.fs
Normal file
12
hgplus/ShaderMinifier/tests/real/extatique/blit2.fs
Normal file
@@ -0,0 +1,12 @@
|
||||
uniform sampler2D tex1;
|
||||
uniform sampler2D tex2;
|
||||
|
||||
uniform float tex1Amount;
|
||||
uniform float tex2Amount;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 p = gl_TexCoord[0].xy;
|
||||
|
||||
gl_FragColor = vec4(tex1Amount) * texture2D(tex1, p) + vec4(tex2Amount) * texture2D(tex2, p);
|
||||
}
|
||||
5
hgplus/ShaderMinifier/tests/real/extatique/blit2.vs
Normal file
5
hgplus/ShaderMinifier/tests/real/extatique/blit2.vs
Normal file
@@ -0,0 +1,5 @@
|
||||
void main()
|
||||
{
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
gl_Position = ftransform();
|
||||
}
|
||||
13
hgplus/ShaderMinifier/tests/real/extatique/blitcorner.fs
Normal file
13
hgplus/ShaderMinifier/tests/real/extatique/blitcorner.fs
Normal file
@@ -0,0 +1,13 @@
|
||||
uniform sampler2D tex;
|
||||
uniform float ratio;
|
||||
uniform float factor;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 p = gl_TexCoord[0].xy;
|
||||
|
||||
vec2 dist = (p - vec2(0.5, 0.5)) * vec2(1.0,ratio);
|
||||
vec4 darkF = vec4(max(0.0, 1.0 - factor * dot(dist,dist)));
|
||||
|
||||
gl_FragColor = gl_Color * darkF * texture2D(tex, p);
|
||||
}
|
||||
6
hgplus/ShaderMinifier/tests/real/extatique/blitcorner.vs
Normal file
6
hgplus/ShaderMinifier/tests/real/extatique/blitcorner.vs
Normal file
@@ -0,0 +1,6 @@
|
||||
void main()
|
||||
{
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
gl_FrontColor = gl_Color;
|
||||
gl_Position = ftransform();
|
||||
}
|
||||
26
hgplus/ShaderMinifier/tests/real/extatique/blitgirl.fs
Normal file
26
hgplus/ShaderMinifier/tests/real/extatique/blitgirl.fs
Normal file
@@ -0,0 +1,26 @@
|
||||
uniform sampler2D tex;
|
||||
uniform sampler2D noise;
|
||||
uniform vec2 size;
|
||||
uniform float border;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 p = gl_TexCoord[0].xy;
|
||||
|
||||
vec2 realP = p * size;
|
||||
|
||||
float alphaX = smoothstep(0.0, border, realP.x) - smoothstep(size.x - border, size.x, realP.x);
|
||||
float alphaY = smoothstep(0.0, border, realP.y) - smoothstep(size.y - border, size.y, realP.y);
|
||||
|
||||
float border2 = border * 3.0;
|
||||
float alphaX2 = smoothstep(0.0, border2, realP.x) - smoothstep(size.x - border2, size.x, realP.x);
|
||||
float alphaY2 = smoothstep(0.0, border2, realP.y) - smoothstep(size.y - border2, size.y, realP.y);
|
||||
|
||||
|
||||
float noise = texture2D(noise, realP).r;
|
||||
|
||||
float alpha = max(0.0, alphaX * alphaY - (noise * (1.0 - alphaX2 * alphaY2)));
|
||||
|
||||
gl_FragColor = vec4(gl_Color.rgb, alpha) * texture2D(tex, p);
|
||||
}
|
||||
6
hgplus/ShaderMinifier/tests/real/extatique/blitgirl.vs
Normal file
6
hgplus/ShaderMinifier/tests/real/extatique/blitgirl.vs
Normal file
@@ -0,0 +1,6 @@
|
||||
void main()
|
||||
{
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
gl_FrontColor = gl_Color;
|
||||
gl_Position = ftransform();
|
||||
}
|
||||
18
hgplus/ShaderMinifier/tests/real/extatique/blitsquare.fs
Normal file
18
hgplus/ShaderMinifier/tests/real/extatique/blitsquare.fs
Normal file
@@ -0,0 +1,18 @@
|
||||
uniform sampler2D tex;
|
||||
uniform vec2 size;
|
||||
uniform float border;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 p = gl_TexCoord[0].xy;
|
||||
|
||||
vec2 realP = p * size;
|
||||
|
||||
float alphaX = smoothstep(0.0, border, realP.x) - smoothstep(size.x - border, size.x, realP.x);
|
||||
float alphaY = smoothstep(0.0, border, realP.y) - smoothstep(size.y - border, size.y, realP.y);
|
||||
|
||||
float alpha = alphaX * alphaY;
|
||||
|
||||
gl_FragColor = vec4(gl_Color.rgb, alpha) * texture2D(tex, p);
|
||||
}
|
||||
6
hgplus/ShaderMinifier/tests/real/extatique/blitsquare.vs
Normal file
6
hgplus/ShaderMinifier/tests/real/extatique/blitsquare.vs
Normal file
@@ -0,0 +1,6 @@
|
||||
void main()
|
||||
{
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
gl_FrontColor = gl_Color;
|
||||
gl_Position = ftransform();
|
||||
}
|
||||
23
hgplus/ShaderMinifier/tests/real/extatique/distort.fs
Normal file
23
hgplus/ShaderMinifier/tests/real/extatique/distort.fs
Normal file
@@ -0,0 +1,23 @@
|
||||
uniform sampler2D tex;
|
||||
uniform float amount;
|
||||
uniform float colorSep;
|
||||
uniform vec4 glow;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 p = (gl_TexCoord[0].xy - vec2(0.5,0.5));
|
||||
vec2 p2 = p + vec2(colorSep, 0.0);
|
||||
vec2 p3 = p - vec2(colorSep, 0.0);
|
||||
|
||||
float distortion = amount / (1.0 + length(p * 5.0));
|
||||
|
||||
float cosd = cos(distortion);
|
||||
float sind = sin(distortion);
|
||||
|
||||
mat2 tranfo = mat2(cosd, -sind, sind, cosd);
|
||||
|
||||
vec4 color1 = vec4(1.0,0.5,0.0,0.5) * texture2D(tex, (vec2(0.5) + tranfo * p2));
|
||||
vec4 color2 = vec4(0.0,0.5,1.0,0.5) * texture2D(tex, (vec2(0.5) + tranfo * p3));
|
||||
gl_FragColor = gl_Color * (color1 + color2) + glow;
|
||||
}
|
||||
6
hgplus/ShaderMinifier/tests/real/extatique/distort.vs
Normal file
6
hgplus/ShaderMinifier/tests/real/extatique/distort.vs
Normal file
@@ -0,0 +1,6 @@
|
||||
void main()
|
||||
{
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
gl_FrontColor = gl_Color;
|
||||
gl_Position = ftransform();
|
||||
}
|
||||
33
hgplus/ShaderMinifier/tests/real/extatique/final.fs
Normal file
33
hgplus/ShaderMinifier/tests/real/extatique/final.fs
Normal file
@@ -0,0 +1,33 @@
|
||||
uniform sampler2D tex;
|
||||
uniform sampler3D gammaRamp;
|
||||
|
||||
uniform float blurType;
|
||||
uniform float blurAmount;
|
||||
uniform float invHeight;
|
||||
uniform float invWidth;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 p = gl_TexCoord[0].xy;
|
||||
|
||||
vec4 blur = ( texture2DLod(tex, p, 7.0)
|
||||
+ texture2DLod(tex, p, 6.0)
|
||||
+ texture2DLod(tex, p, 5.0)
|
||||
+ texture2DLod(tex, p, 4.0)
|
||||
+ texture2DLod(tex, p, 3.0)
|
||||
+ texture2DLod(tex, p, 2.0)
|
||||
+ texture2DLod(tex, p, 1.0)) * vec4(0.142857); /* 1/7 */
|
||||
|
||||
vec4 center = texture2D(tex, p);
|
||||
|
||||
|
||||
vec4 blurred = (vec4(1.0) - (vec4(1.0) - blur) * (vec4(1.0) - center));
|
||||
vec4 blurred2 = blurred * mix( blurred, vec4(1.0), blurType);
|
||||
|
||||
vec4 uncorrected = mix(center, blurred2, blurAmount);
|
||||
|
||||
/* gamma correction */
|
||||
|
||||
gl_FragColor = texture3D(gammaRamp, uncorrected.xyz);
|
||||
}
|
||||
5
hgplus/ShaderMinifier/tests/real/extatique/final.vs
Normal file
5
hgplus/ShaderMinifier/tests/real/extatique/final.vs
Normal file
@@ -0,0 +1,5 @@
|
||||
void main()
|
||||
{
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
gl_Position = gl_Vertex;
|
||||
}
|
||||
11
hgplus/ShaderMinifier/tests/real/extatique/font.fs
Normal file
11
hgplus/ShaderMinifier/tests/real/extatique/font.fs
Normal file
@@ -0,0 +1,11 @@
|
||||
uniform sampler2D tex;
|
||||
uniform sampler2D fill;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 p = gl_TexCoord[0].xy;
|
||||
vec4 letter = texture2D(tex, p);
|
||||
vec4 fillColor = texture2D(fill, p * 3.0);
|
||||
|
||||
gl_FragColor = letter * fillColor * gl_Color;
|
||||
}
|
||||
7
hgplus/ShaderMinifier/tests/real/extatique/font.vs
Normal file
7
hgplus/ShaderMinifier/tests/real/extatique/font.vs
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
gl_Position = ftransform();
|
||||
gl_FrontColor = gl_Color;
|
||||
}
|
||||
9
hgplus/ShaderMinifier/tests/real/extatique/glow.fs
Normal file
9
hgplus/ShaderMinifier/tests/real/extatique/glow.fs
Normal file
@@ -0,0 +1,9 @@
|
||||
uniform sampler1D tex;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 p = gl_TexCoord[0].xy;
|
||||
float a = length(p) / 2.04;
|
||||
gl_FragColor = gl_Color * vec4(1.0,1.0,1.0, texture1D(tex, a));
|
||||
}
|
||||
8
hgplus/ShaderMinifier/tests/real/extatique/glow.vs
Normal file
8
hgplus/ShaderMinifier/tests/real/extatique/glow.vs
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FrontColor = gl_Color;
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
|
||||
gl_Position = ftransform();
|
||||
}
|
||||
110
hgplus/ShaderMinifier/tests/real/extatique/graindo12.fs
Normal file
110
hgplus/ShaderMinifier/tests/real/extatique/graindo12.fs
Normal file
@@ -0,0 +1,110 @@
|
||||
uniform float time;
|
||||
uniform float param1;
|
||||
|
||||
|
||||
uniform sampler1D distRamp;
|
||||
uniform vec3 matColor;
|
||||
uniform vec3 ambientColor;
|
||||
|
||||
|
||||
|
||||
float gausa( float a )
|
||||
{
|
||||
return texture1D(distRamp, abs(a) * 0.125 ).r; /* pow(0.5f, abs(a)); */
|
||||
}
|
||||
|
||||
float gausb( float a )
|
||||
{
|
||||
return pow(0.5, abs(a));
|
||||
}
|
||||
|
||||
mat3 rotationMatrix( float a , float b , float c )
|
||||
{
|
||||
float xvs = sin(a);
|
||||
float yvs = sin(b);
|
||||
float zvs = sin(c);
|
||||
|
||||
float xvc = cos(a);
|
||||
float yvc = cos(b);
|
||||
float zvc = cos(c);
|
||||
|
||||
float Ox1 = yvc * zvc;
|
||||
float Ox2 = xvc * yvs * zvc + xvs * zvs;
|
||||
float Ox3 = xvc * zvs - xvs * yvs * zvc;
|
||||
|
||||
float Oy1 = xvc * zvc + xvs * yvs * zvs;
|
||||
float Oy2 = xvs * zvc - xvc * yvs * zvs;
|
||||
float Oy3 = -yvc * zvs;
|
||||
|
||||
float Oz1 = xvc * yvc;
|
||||
float Oz2 = -xvs * yvc;
|
||||
float Oz3 = -yvs;
|
||||
|
||||
return mat3( Ox1 , Ox3 , Ox2 ,
|
||||
Oy3 , Oy1 , Oy2 ,
|
||||
Oz3 , Oz2 , Oz1 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
vec3 objet(vec3 c , vec3 v , float t )
|
||||
{
|
||||
vec3 vt = vec3(8.0,2.0,2.0);
|
||||
|
||||
float ti = cos(t * 3.0);
|
||||
float to = cos(t * 0.2) * 0.02 + 0.5;
|
||||
|
||||
vec3 co = vec3(0.0);
|
||||
|
||||
|
||||
mat3 disto = rotationMatrix( v.z , v.x , -v.y );
|
||||
|
||||
vec3 vi = v * disto;
|
||||
float lvi = length(vi);
|
||||
|
||||
float gg = gausa((lvi - 12.0 * to))
|
||||
* gausa((8.485 - 12.0 * to))
|
||||
* gausa((lvi - 8.485));
|
||||
|
||||
vec3 col = c * vec3(1.0 - gg);
|
||||
|
||||
vt.x = vi.x + 3.0;
|
||||
|
||||
|
||||
float size = param1;
|
||||
float gg2 = gausa(size * (lvi - 6.0 * to))
|
||||
* gausa(size * (lvi - length(vt)));
|
||||
|
||||
vec3 material = matColor;
|
||||
|
||||
return mix(col, material , gg2 * param1);
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
float t = time;
|
||||
|
||||
vec2 xy = gl_TexCoord[0].xy;
|
||||
|
||||
|
||||
vec3 coll = vec3(0.0);
|
||||
|
||||
const int iter = 3;
|
||||
|
||||
mat3 rotation = rotationMatrix( t, t, -t);
|
||||
|
||||
vec3 d = rotation * vec3(xy, float(iter));
|
||||
vec3 a = rotation * vec3(xy * vec2(2.0), -float(iter));
|
||||
|
||||
|
||||
for (int z = 0; z <= iter; ++z)
|
||||
{
|
||||
float fr = float(z) / float(iter);
|
||||
vec3 posi = mix(d, a, fr);
|
||||
coll = objet(coll, posi, t);
|
||||
|
||||
}
|
||||
gl_FragColor = vec4 (coll, 1.0);
|
||||
}
|
||||
6
hgplus/ShaderMinifier/tests/real/extatique/graindo12.vs
Normal file
6
hgplus/ShaderMinifier/tests/real/extatique/graindo12.vs
Normal file
@@ -0,0 +1,6 @@
|
||||
void main()
|
||||
{
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
gl_FrontColor = gl_Color;
|
||||
gl_Position = ftransform();
|
||||
}
|
||||
93
hgplus/ShaderMinifier/tests/real/extatique/lambert.fs
Normal file
93
hgplus/ShaderMinifier/tests/real/extatique/lambert.fs
Normal file
@@ -0,0 +1,93 @@
|
||||
varying vec3 N;
|
||||
varying vec3 pos;
|
||||
varying vec3 wpos;
|
||||
|
||||
varying vec3 l1_pos;
|
||||
varying vec3 l2_pos;
|
||||
varying vec3 l3_pos;
|
||||
|
||||
uniform vec3 light1Color;
|
||||
uniform vec3 light2Color;
|
||||
uniform vec3 light3Color;
|
||||
uniform vec3 ambientColor;
|
||||
|
||||
|
||||
uniform float light1Specular;
|
||||
uniform float light2Specular;
|
||||
uniform float light3Specular;
|
||||
uniform float light1Diffuse;
|
||||
uniform float light2Diffuse;
|
||||
uniform float light3Diffuse;
|
||||
uniform float thresholdZ;
|
||||
|
||||
const float linAtt = 0.20;
|
||||
const float quadAtt = 0.1;
|
||||
const float fogNear = 1.0;
|
||||
const float fogFar = 10.0;
|
||||
|
||||
uniform sampler2D noise;
|
||||
|
||||
|
||||
float AO(vec3 p)
|
||||
{
|
||||
return 1.0 / (1.0 + 0.012 * dot(p,p));
|
||||
}
|
||||
|
||||
vec3 desaturate(vec3 c, float s)
|
||||
{
|
||||
return mix( c, vec3(dot(vec3(0.3), c)), s);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
vec2 p = gl_TexCoord[0].xy;
|
||||
|
||||
vec3 perturb = vec3(texture2D(noise, p + vec2(0.13,0.46)).x, texture2D(noise, p).x, texture2D(noise, p + vec2(-0.33,0.14)).x);
|
||||
|
||||
perturb = (perturb - vec3(0.5)) * 5.0;
|
||||
|
||||
vec3 nml = normalize(N + perturb);
|
||||
|
||||
if (nml.z < thresholdZ) discard;
|
||||
|
||||
vec3 l1dist = l1_pos - pos;
|
||||
vec3 l2dist = l2_pos - pos;
|
||||
vec3 l3dist = l3_pos - pos;
|
||||
|
||||
float dist1 = length(l1dist);
|
||||
float dist2 = length(l2dist);
|
||||
float dist3 = length(l3dist);
|
||||
|
||||
vec3 lv1 = l1dist / dist1;
|
||||
vec3 lv2 = l2dist / dist2;
|
||||
vec3 lv3 = l3dist / dist3;
|
||||
|
||||
vec3 eye = normalize(-pos);
|
||||
|
||||
vec3 re1 = reflect(lv1, N);
|
||||
vec3 re2 = reflect(lv2, N);
|
||||
vec3 re3 = reflect(lv3, N);
|
||||
|
||||
float diffl1 = max(0.0, dot(nml,lv1) );
|
||||
float diffl2 = max(0.0, dot(nml,lv2) );
|
||||
float diffl3 = max(0.0, dot(nml,lv3) );
|
||||
|
||||
float specl1 = light1Specular * pow(max(0.0, dot(eye, re1)), 10.0);
|
||||
float specl2 = light2Specular * pow(max(0.0, dot(eye, re2)), 10.0);
|
||||
float specl3 = light3Specular * pow(max(0.0, dot(eye, re3)), 10.0);
|
||||
|
||||
|
||||
float ql1 = (diffl1 + specl1) / (1.0 + dist1 * (linAtt + quadAtt * dist1));
|
||||
float ql2 = (diffl2 + specl2) / (1.0 + dist2 * (linAtt + quadAtt * dist2));
|
||||
float ql3 = (diffl3 + specl3) / (1.0 + dist3 * (linAtt + quadAtt * dist3));
|
||||
|
||||
vec3 light = ambientColor + light1Color * vec3(ql1) + light2Color * vec3(ql2) + light3Color * vec3(ql3);
|
||||
|
||||
|
||||
float fogAmount = clamp( (pos.z - fogNear) / (fogFar - fogNear) , 0.0, 1.0);
|
||||
vec3 lightAO = desaturate(light * vec3(AO(wpos)), fogAmount);
|
||||
|
||||
|
||||
gl_FragColor = gl_Color * vec4(lightAO, 1.0);
|
||||
}
|
||||
27
hgplus/ShaderMinifier/tests/real/extatique/lambert.vs
Normal file
27
hgplus/ShaderMinifier/tests/real/extatique/lambert.vs
Normal file
@@ -0,0 +1,27 @@
|
||||
uniform vec3 light1Pos;
|
||||
uniform vec3 light2Pos;
|
||||
uniform vec3 light3Pos;
|
||||
uniform mat4 invCamMat;
|
||||
|
||||
varying vec3 N;
|
||||
varying vec3 pos;
|
||||
varying vec3 wpos;
|
||||
varying vec3 l1_pos;
|
||||
varying vec3 l2_pos;
|
||||
varying vec3 l3_pos;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
N = gl_NormalMatrix * gl_Normal;
|
||||
vec4 epos = gl_ModelViewMatrix * gl_Vertex;
|
||||
wpos = (invCamMat * epos).xyz;
|
||||
pos = epos.xyz;
|
||||
l1_pos = (gl_ModelViewMatrix * vec4(light1Pos,1.0)).xyz;
|
||||
l2_pos = (gl_ModelViewMatrix * vec4(light2Pos,1.0)).xyz;
|
||||
l3_pos = (gl_ModelViewMatrix * vec4(light3Pos,1.0)).xyz;
|
||||
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
gl_FrontColor = gl_Color;
|
||||
gl_Position = ftransform();
|
||||
}
|
||||
91
hgplus/ShaderMinifier/tests/real/extatique/lambert2.fs
Normal file
91
hgplus/ShaderMinifier/tests/real/extatique/lambert2.fs
Normal file
@@ -0,0 +1,91 @@
|
||||
varying vec3 N;
|
||||
varying vec3 pos;
|
||||
|
||||
|
||||
varying vec3 l1_pos;
|
||||
varying vec3 l2_pos;
|
||||
varying vec3 l3_pos;
|
||||
|
||||
uniform vec3 light1Color;
|
||||
uniform vec3 light2Color;
|
||||
uniform vec3 light3Color;
|
||||
uniform vec3 ambientColor;
|
||||
|
||||
|
||||
uniform float light1Specular;
|
||||
uniform float light2Specular;
|
||||
uniform float light3Specular;
|
||||
uniform float light1Diffuse;
|
||||
uniform float light2Diffuse;
|
||||
uniform float light3Diffuse;
|
||||
|
||||
const float linAtt = 0.30;
|
||||
const float quadAtt = 0.2;
|
||||
const float fogNear = 1.0;
|
||||
const float fogFar = 5.0;
|
||||
|
||||
uniform sampler2D noise;
|
||||
uniform sampler2D tex;
|
||||
|
||||
|
||||
|
||||
vec3 desaturate(vec3 c, float s)
|
||||
{
|
||||
return mix( c, vec3(dot(vec3(0.3), c)), s);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
vec2 p = gl_TexCoord[0].xy;
|
||||
|
||||
vec3 perturb = vec3(texture2D(noise, p + vec2(0.13,0.46)).x, texture2D(noise, p).x, texture2D(noise, p + vec2(-0.33,0.14)).x);
|
||||
|
||||
vec4 texColor = texture2D(tex,p);
|
||||
|
||||
perturb = (perturb - vec3(0.5)) * 10.0;
|
||||
|
||||
vec3 nml = normalize(N + perturb);
|
||||
|
||||
|
||||
|
||||
vec3 l1dist = l1_pos - pos;
|
||||
vec3 l2dist = l2_pos - pos;
|
||||
vec3 l3dist = l3_pos - pos;
|
||||
|
||||
float dist1 = length(l1dist);
|
||||
float dist2 = length(l2dist);
|
||||
float dist3 = length(l3dist);
|
||||
|
||||
vec3 lv1 = l1dist / dist1;
|
||||
vec3 lv2 = l2dist / dist2;
|
||||
vec3 lv3 = l3dist / dist3;
|
||||
|
||||
vec3 eye = normalize(-pos);
|
||||
|
||||
vec3 re1 = reflect(lv1, N);
|
||||
vec3 re2 = reflect(lv2, N);
|
||||
vec3 re3 = reflect(lv3, N);
|
||||
|
||||
float diffl1 = max(0.0, dot(nml,lv1) );
|
||||
float diffl2 = max(0.0, dot(nml,lv2) );
|
||||
float diffl3 = max(0.0, dot(nml,lv3) );
|
||||
|
||||
float specl1 = light1Specular * pow(max(0.0, dot(eye, re1)), 10.0);
|
||||
float specl2 = light2Specular * pow(max(0.0, dot(eye, re2)), 10.0);
|
||||
float specl3 = light3Specular * pow(max(0.0, dot(eye, re3)), 10.0);
|
||||
|
||||
|
||||
float ql1 = (diffl1 + specl1) / (1.0 + dist1 * (linAtt + quadAtt * dist1));
|
||||
float ql2 = (diffl2 + specl2) / (1.0 + dist2 * (linAtt + quadAtt * dist2));
|
||||
float ql3 = (diffl3 + specl3) / (1.0 + dist3 * (linAtt + quadAtt * dist3));
|
||||
|
||||
vec3 light = ambientColor + light1Color * vec3(ql1) + light2Color * vec3(ql2) + light3Color * vec3(ql3);
|
||||
|
||||
|
||||
float fogAmount = clamp( (pos.z - fogNear) / (fogFar - fogNear) , 0.0, 1.0);
|
||||
vec3 lightAO = desaturate(light , fogAmount);
|
||||
|
||||
|
||||
gl_FragColor = texColor * gl_Color * vec4(lightAO, 1.0);
|
||||
}
|
||||
27
hgplus/ShaderMinifier/tests/real/extatique/lambert2.vs
Normal file
27
hgplus/ShaderMinifier/tests/real/extatique/lambert2.vs
Normal file
@@ -0,0 +1,27 @@
|
||||
uniform vec3 light1Pos;
|
||||
uniform vec3 light2Pos;
|
||||
uniform vec3 light3Pos;
|
||||
uniform mat4 invCamMat;
|
||||
|
||||
varying vec3 N;
|
||||
varying vec3 pos;
|
||||
|
||||
varying vec3 l1_pos;
|
||||
varying vec3 l2_pos;
|
||||
varying vec3 l3_pos;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
N = gl_NormalMatrix * gl_Normal;
|
||||
vec4 epos = gl_ModelViewMatrix * gl_Vertex;
|
||||
|
||||
pos = epos.xyz;
|
||||
l1_pos = (gl_ModelViewMatrix * vec4(light1Pos,1.0)).xyz;
|
||||
l2_pos = (gl_ModelViewMatrix * vec4(light2Pos,1.0)).xyz;
|
||||
l3_pos = (gl_ModelViewMatrix * vec4(light3Pos,1.0)).xyz;
|
||||
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
gl_FrontColor = gl_Color;
|
||||
gl_Position = ftransform();
|
||||
}
|
||||
31
hgplus/ShaderMinifier/tests/real/extatique/loading.fs
Normal file
31
hgplus/ShaderMinifier/tests/real/extatique/loading.fs
Normal file
@@ -0,0 +1,31 @@
|
||||
uniform sampler2D tex;
|
||||
uniform sampler3D gammaRamp;
|
||||
|
||||
uniform float blurType;
|
||||
uniform float blurAmount;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 p = gl_TexCoord[0].xy;
|
||||
|
||||
vec4 blur = ( texture2DLod(tex, p, 7.0)
|
||||
+ texture2DLod(tex, p, 6.0)
|
||||
+ texture2DLod(tex, p, 5.0)
|
||||
+ texture2DLod(tex, p, 4.0)
|
||||
+ texture2DLod(tex, p, 3.0)
|
||||
+ texture2DLod(tex, p, 2.0)
|
||||
+ texture2DLod(tex, p, 1.0)) * vec4(0.142857); /* 1/7 */
|
||||
|
||||
vec4 center = texture2D(tex, p);
|
||||
|
||||
|
||||
vec4 blurred = (vec4(1.0) - (vec4(1.0) - blur) * (vec4(1.0) - center));
|
||||
vec4 blurred2 = blurred * mix( blurred, vec4(1.0), blurType);
|
||||
|
||||
vec4 uncorrected = mix(center, blurred2, blurAmount);
|
||||
|
||||
/* gamma correction */
|
||||
|
||||
gl_FragColor = texture3D(gammaRamp, uncorrected.xyz);
|
||||
}
|
||||
5
hgplus/ShaderMinifier/tests/real/extatique/loading.vs
Normal file
5
hgplus/ShaderMinifier/tests/real/extatique/loading.vs
Normal file
@@ -0,0 +1,5 @@
|
||||
void main()
|
||||
{
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
gl_Position = gl_Vertex;
|
||||
}
|
||||
20
hgplus/ShaderMinifier/tests/real/extatique/log.fs
Normal file
20
hgplus/ShaderMinifier/tests/real/extatique/log.fs
Normal file
@@ -0,0 +1,20 @@
|
||||
uniform sampler2D tex;
|
||||
uniform float invGamma;
|
||||
|
||||
const vec3 LUMINANCECONV = vec3(0.11,0.6,0.29);
|
||||
void main()
|
||||
{
|
||||
vec2 p = gl_TexCoord[0].xy;
|
||||
|
||||
|
||||
|
||||
vec3 sample = texture2D(tex, p).xyz;
|
||||
|
||||
|
||||
sample = log2(sample + vec3(1.0));
|
||||
float luminance = dot(LUMINANCECONV, sample);
|
||||
|
||||
vec3 sampleC = sample * vec3(pow(luminance,invGamma));
|
||||
|
||||
gl_FragColor = gl_Color * vec4(sampleC,1.0);
|
||||
}
|
||||
6
hgplus/ShaderMinifier/tests/real/extatique/log.vs
Normal file
6
hgplus/ShaderMinifier/tests/real/extatique/log.vs
Normal file
@@ -0,0 +1,6 @@
|
||||
void main()
|
||||
{
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
gl_FrontColor = gl_Color;
|
||||
gl_Position = ftransform();
|
||||
}
|
||||
8
hgplus/ShaderMinifier/tests/real/extatique/particle.fs
Normal file
8
hgplus/ShaderMinifier/tests/real/extatique/particle.fs
Normal file
@@ -0,0 +1,8 @@
|
||||
uniform sampler2D tex;
|
||||
uniform float intensity;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 p = gl_TexCoord[0].xy;
|
||||
gl_FragColor = vec4(vec3(intensity), 1.0) * gl_Color * texture2D(tex, p);
|
||||
}
|
||||
17
hgplus/ShaderMinifier/tests/real/extatique/particle.vs
Normal file
17
hgplus/ShaderMinifier/tests/real/extatique/particle.vs
Normal file
@@ -0,0 +1,17 @@
|
||||
uniform float minDist;
|
||||
uniform float maxDist;
|
||||
uniform float minSize;
|
||||
uniform float maxSize;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
|
||||
vec4 pos = ftransform();
|
||||
gl_Position = pos;
|
||||
|
||||
float f = (pos.z - minDist) / (maxDist - minDist);
|
||||
|
||||
gl_FrontColor = gl_Color * vec4(vec3(1), f);
|
||||
gl_PointSize = minSize + maxSize * f;
|
||||
}
|
||||
58
hgplus/ShaderMinifier/tests/real/extatique/progress.fs
Normal file
58
hgplus/ShaderMinifier/tests/real/extatique/progress.fs
Normal file
@@ -0,0 +1,58 @@
|
||||
uniform sampler2D tex;
|
||||
uniform float progression;
|
||||
|
||||
vec3 desaturate(vec3 c, float s)
|
||||
{
|
||||
return mix( c, vec3(dot(vec3(0.33), c)), s);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
float A = 3.1415 * 0.5;
|
||||
float TOUR = 13.0;
|
||||
|
||||
float t = gl_TexCoord[0].y;
|
||||
float s = gl_TexCoord[0].x + 0.15 * sin(t * 2.0 * 3.1415);
|
||||
|
||||
float v = smoothstep(0.0,0.1,t) - smoothstep(0.9,1.0,t);
|
||||
|
||||
float center1 = 0.5 + 0.5 * sin(TOUR * t);
|
||||
float distu1 = abs(center1 - s);
|
||||
float value1 = sqrt(max(0.0, 2.5 - (9.0 - 3.0 * abs(cos(TOUR * t))) * distu1));
|
||||
float alpha1 = value1 *max(0.0,-cos(TOUR * t));
|
||||
|
||||
float center2 = 0.5 + 0.5 * sin(TOUR * t + A);
|
||||
float distu2 = abs(center2 - s);
|
||||
float value2 = sqrt(max(0.0, 2.5 - (9.0 - 3.0 * abs(cos(TOUR * t + A))) * distu2));
|
||||
float alpha2 = value2 *max(0.0,-cos(TOUR * t + A));
|
||||
|
||||
float center3 = 0.5 + 0.5 * sin(TOUR * t + A * 2.0);
|
||||
float distu3 = abs(center3 - s);
|
||||
float value3 = sqrt(max(0.0, 2.5 - (9.0 - 3.0 * abs(cos(TOUR * t + A * 2.0))) * distu3));
|
||||
float alpha3 = value3 *max(0.0,-cos(TOUR * t + A * 2.0));
|
||||
|
||||
float center4 = 0.5 + 0.5 * sin(TOUR * t + A * 3.0);
|
||||
float distu4 = abs(center4 - s);
|
||||
float value4 = sqrt(max(0.0, 2.5 - (9.0 - 3.0 * abs(cos(TOUR * t + A * 3.0))) * distu4));
|
||||
float alpha4 = value4 * max(0.0, -cos(TOUR * t + A * 3.0));
|
||||
|
||||
const float desat = 0.3;
|
||||
float refs1 = (gl_TexCoord[0].x + 0.51) / 2.0;
|
||||
float refs2 = (gl_TexCoord[0].x + 0.44) / 2.0;
|
||||
float refs3 = (gl_TexCoord[0].x + 0.55) / 2.0;
|
||||
float refs4 = (gl_TexCoord[0].x + 0.48) / 2.0;
|
||||
vec3 c1 = (refs1 < progression) ? desaturate(vec3(1.0, 0.59, 1.0), desat) : vec3(0.3,0.3,0.3);
|
||||
vec3 c2 = (refs2 < progression) ? desaturate(vec3(0.6,0.18,0.19), desat) : vec3(0.4,0.4,0.4);
|
||||
vec3 c3 = (refs3 < progression) ? desaturate(vec3(0.97,0.62,118.0/255.0), desat) : vec3(0.6,0.6,0.6);
|
||||
vec3 c4 = (refs4 < progression) ? desaturate(vec3(254.0/255.0,79.0/255.0,138.0/255.0), desat) : vec3(0.5,0.5,0.5);
|
||||
|
||||
vec4 final_color = vec4(alpha1 * c1
|
||||
+ alpha2 * c2
|
||||
+ alpha3 * c3
|
||||
+ alpha4 * c4, v * (alpha1 + alpha2 + alpha3 + alpha4));
|
||||
|
||||
vec2 p = gl_TexCoord[0].xy;
|
||||
gl_FragColor = gl_Color * final_color * mix(texture2D(tex, p * vec2(1.5, 4.5)), vec4(1.0,1.0,1.0,1.0), 0.5);
|
||||
}
|
||||
|
||||
|
||||
6
hgplus/ShaderMinifier/tests/real/extatique/progress.vs
Normal file
6
hgplus/ShaderMinifier/tests/real/extatique/progress.vs
Normal file
@@ -0,0 +1,6 @@
|
||||
void main()
|
||||
{
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
gl_FrontColor = gl_Color;
|
||||
gl_Position = ftransform();
|
||||
}
|
||||
4
hgplus/ShaderMinifier/tests/real/extatique/put.fs
Normal file
4
hgplus/ShaderMinifier/tests/real/extatique/put.fs
Normal file
@@ -0,0 +1,4 @@
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = gl_Color;
|
||||
}
|
||||
5
hgplus/ShaderMinifier/tests/real/extatique/put.vs
Normal file
5
hgplus/ShaderMinifier/tests/real/extatique/put.vs
Normal file
@@ -0,0 +1,5 @@
|
||||
void main()
|
||||
{
|
||||
gl_FrontColor = gl_Color;
|
||||
gl_Position = ftransform();
|
||||
}
|
||||
59
hgplus/ShaderMinifier/tests/real/extatique/raymarch.fs
Normal file
59
hgplus/ShaderMinifier/tests/real/extatique/raymarch.fs
Normal file
@@ -0,0 +1,59 @@
|
||||
varying vec3 dir;
|
||||
|
||||
|
||||
float flr(vec3 p, float f)
|
||||
{
|
||||
return abs(f - p.y);
|
||||
}
|
||||
|
||||
float sph(vec3 p, vec4 spr)
|
||||
{
|
||||
return length(spr.xyz - p) - spr.w;
|
||||
}
|
||||
|
||||
float iso_tore(vec3 p, vec3 center, float r1, float r2)
|
||||
{
|
||||
p -= center;
|
||||
float xx = sqrt(p.x * p.x + p.z * p.z) - r1;
|
||||
float dist = sqrt(xx * xx + p.y * p.y) - r2;
|
||||
return mix(dist, dist, 0.9);
|
||||
}
|
||||
|
||||
float scene(vec3 p)
|
||||
{
|
||||
float d = iso_tore(p, vec3(0,0,15), 2.0, 0.5);
|
||||
return d;
|
||||
}
|
||||
|
||||
vec3 getN(vec3 p)
|
||||
{
|
||||
float eps = 0.01;
|
||||
return normalize(vec3(
|
||||
scene(p+vec3(eps,0,0))-scene(p-vec3(eps,0,0)),
|
||||
scene(p+vec3(0,eps,0))-scene(p-vec3(0,eps,0)),
|
||||
scene(p+vec3(0,0,eps))-scene(p-vec3(0,0,eps))
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
float g,d = 0.0;
|
||||
vec3 p = vec3(0);
|
||||
vec3 ndir = normalize(dir);
|
||||
|
||||
for(int i = 0; i < 64; i++)
|
||||
{
|
||||
d = scene(p);
|
||||
p = p + d * ndir;
|
||||
}
|
||||
if(d > 1.0)
|
||||
{
|
||||
gl_FragColor = vec4(1.0,0.0,0.0,1.0);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
vec3 n = getN(p);
|
||||
gl_FragColor = vec4(n, 1.0);
|
||||
}
|
||||
9
hgplus/ShaderMinifier/tests/real/extatique/raymarch.vs
Normal file
9
hgplus/ShaderMinifier/tests/real/extatique/raymarch.vs
Normal file
@@ -0,0 +1,9 @@
|
||||
varying vec3 dir;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 pos = ftransform();
|
||||
gl_Position = pos;
|
||||
dir = pos.xyz;
|
||||
|
||||
}
|
||||
41
hgplus/ShaderMinifier/tests/real/extatique/scene30.fs
Normal file
41
hgplus/ShaderMinifier/tests/real/extatique/scene30.fs
Normal file
@@ -0,0 +1,41 @@
|
||||
uniform sampler2D tex;
|
||||
uniform float angle;
|
||||
uniform float time;
|
||||
varying vec3 pos;
|
||||
varying vec3 N;
|
||||
|
||||
|
||||
vec4 getEnvColor(vec3 p)
|
||||
{
|
||||
float az = atan(p.x, p.y + 0.01);
|
||||
float ax = -pos.z;
|
||||
|
||||
vec4 sample = vec4(0.0);
|
||||
|
||||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
float fi = float(i);
|
||||
float s = ax * 2.0 / (1.0 + fi) + time * 0.01 * (2.0 + fi);
|
||||
float t = angle + (2.5) * az / 3.14159;
|
||||
|
||||
sample += texture2D(tex, vec2(s,t)) / (1.0 + 0.3 * fi);
|
||||
}
|
||||
return sample;
|
||||
}
|
||||
|
||||
vec3 diffuseLighting(vec3 pos, vec3 nml)
|
||||
{
|
||||
float df1 = 0.8 * max(0.0, dot(nml, vec3(1.0,0.2, 0.0)));
|
||||
float df2 = 0.2 * max(0.0, dot(nml, vec3(-1.0,-0.1, 0.0)));
|
||||
vec3 diffuse = vec3(df1) * vec3(0.8,0.7,0.6) + vec3(df2) * vec3(0.6,0.7,0.8);
|
||||
return diffuse;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 nml = normalize(N);
|
||||
vec3 R = reflect(-pos, normalize(nml));
|
||||
vec3 envColor = getEnvColor(R).xyz * mix(vec3(1.0), gl_Color.xyz, 0.4);
|
||||
vec3 diffuseColor = getEnvColor(pos).xyz * gl_Color.xyz;
|
||||
gl_FragColor = vec4( diffuseColor + envColor, 1.0);
|
||||
}
|
||||
11
hgplus/ShaderMinifier/tests/real/extatique/scene30.vs
Normal file
11
hgplus/ShaderMinifier/tests/real/extatique/scene30.vs
Normal file
@@ -0,0 +1,11 @@
|
||||
varying vec3 pos;
|
||||
varying vec3 N;
|
||||
|
||||
void main()
|
||||
{
|
||||
pos = (gl_ModelViewMatrix * gl_Vertex).xyz;
|
||||
gl_Position = ftransform();
|
||||
gl_FrontColor = gl_Color;
|
||||
N = gl_NormalMatrix * gl_Normal;
|
||||
|
||||
}
|
||||
177
hgplus/ShaderMinifier/tests/real/extatique/scene40.fs
Normal file
177
hgplus/ShaderMinifier/tests/real/extatique/scene40.fs
Normal file
@@ -0,0 +1,177 @@
|
||||
uniform sampler2D tex;
|
||||
varying vec3 wpos;
|
||||
varying vec3 N;
|
||||
uniform vec3 eyePos;
|
||||
uniform float radius;
|
||||
uniform float medium;
|
||||
uniform vec3 center;
|
||||
uniform vec3 light1;
|
||||
uniform vec3 light2;
|
||||
uniform vec3 light3;
|
||||
uniform vec3 light4;
|
||||
|
||||
|
||||
vec3 getEnvColor(vec3 pos, vec2 coord)
|
||||
{
|
||||
vec3 color = texture2D(tex, coord * 0.05).xyz;
|
||||
|
||||
vec3 light1_dist = pos * 0.1 - vec3(-0.5,-0.5,-0.5);
|
||||
vec3 light2_dist = pos * 0.1 - vec3(+0.5,+0.5,-0.5);
|
||||
vec3 light3_dist = pos * 0.1 - vec3(-0.5,+0.5,+0.5);
|
||||
vec3 light4_dist = pos * 0.1 - vec3(+0.5,-0.5,+0.5);
|
||||
|
||||
vec3 clight1 = light1 * vec3(max(0.0, 1.25 - 1.0 * dot(light1_dist, light1_dist)));
|
||||
vec3 clight2 = light2 * vec3(max(0.0, 1.25 - 1.0 * dot(light2_dist, light2_dist)));
|
||||
vec3 clight3 = light3 * vec3(max(0.0, 1.25 - 1.0 * dot(light3_dist, light3_dist)));
|
||||
vec3 clight4 = light4 * vec3(max(0.0, 1.25 - 1.0 * dot(light4_dist, light4_dist)));
|
||||
|
||||
|
||||
return color + clight1 + clight2 + clight3 + clight4;
|
||||
}
|
||||
|
||||
float exp3(float x)
|
||||
{
|
||||
float y = max(-1.15365, x);
|
||||
return 1.0 + y * (1.0 + y * (0.5 + y * 0.33333333));
|
||||
}
|
||||
|
||||
vec3 rayColor(vec3 startPos, vec3 startDir)
|
||||
{
|
||||
vec3 total = vec3(0.0);
|
||||
vec3 p = startPos;
|
||||
vec3 dir = startDir;
|
||||
vec3 blend = vec3(0.5);
|
||||
vec3 dpos;
|
||||
vec3 color = vec3(0.0);
|
||||
|
||||
vec3 ray;
|
||||
vec3 nml;
|
||||
vec2 coord;
|
||||
vec3 newdir;
|
||||
vec3 sample;
|
||||
|
||||
for (int i = 0; i < 1; ++i)
|
||||
{
|
||||
ray = 40.0 * dir;
|
||||
nml = vec3(0.0);
|
||||
coord = vec2(0.0);
|
||||
dpos = p + ray;
|
||||
|
||||
if (abs(dpos.x) > 10.0)
|
||||
{
|
||||
if (dpos.x > 10.0)
|
||||
{
|
||||
ray *= ((9.99 - p.x) / ray.x);
|
||||
nml = vec3(-1.0,0.0,0.0);
|
||||
dpos = ray + p;
|
||||
coord = dpos.yz;
|
||||
color = getEnvColor(dpos, coord);
|
||||
}
|
||||
else
|
||||
{
|
||||
ray *= ((-9.99 - p.x) / ray.x);
|
||||
nml = vec3(1.0,0.0,0.0);
|
||||
|
||||
|
||||
dpos = ray + p;
|
||||
coord = dpos.yz * vec2(-1.0,1.0);
|
||||
color = getEnvColor(dpos, coord);
|
||||
}
|
||||
}
|
||||
|
||||
if (abs(dpos.y) > 10.0)
|
||||
{
|
||||
if (dpos.y > 10.0)
|
||||
{
|
||||
ray *= ((9.99 - p.y) / ray.y);
|
||||
nml = vec3(0.0,-1.0,0.0);
|
||||
|
||||
|
||||
dpos = ray + p;
|
||||
coord = dpos.xz * vec2(-1.0,1.0);
|
||||
color = getEnvColor(dpos, coord);
|
||||
}
|
||||
else
|
||||
{
|
||||
ray *= ((-9.99 - p.y) / ray.y);
|
||||
nml = vec3(0.0,1.0,0.0);
|
||||
|
||||
dpos = ray + p;
|
||||
coord = dpos.xz;
|
||||
color = getEnvColor(dpos, coord);
|
||||
}
|
||||
}
|
||||
|
||||
if (abs(dpos.z) > 10.0)
|
||||
{
|
||||
if (dpos.z > 10.0)
|
||||
{
|
||||
ray *= ((9.99 - p.z) / ray.z);
|
||||
nml = vec3(0.0,0.0,-1.0);
|
||||
dpos = ray + p;
|
||||
coord = dpos.xy * vec2(-1.0,1.0);
|
||||
color = getEnvColor(dpos, coord);
|
||||
}
|
||||
else
|
||||
{
|
||||
ray *= ((-9.99 - p.z) / ray.z);
|
||||
nml = vec3(0.0,0.0,1.0);
|
||||
dpos = ray + p;
|
||||
coord = dpos.xy;
|
||||
color = getEnvColor(dpos, coord);
|
||||
}
|
||||
}
|
||||
|
||||
sample = color * vec3(exp3(-length(ray) * 0.04));
|
||||
|
||||
total += sample * blend;
|
||||
blend *= sample;
|
||||
|
||||
newdir = reflect(dir, nml);
|
||||
|
||||
p = dpos;
|
||||
dir = newdir;
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void snell(vec3 dir, vec3 normal, float n1, float n2, out vec3 reflectionDir, out vec3 refractionDir, out float cost2)
|
||||
{
|
||||
float n1n2 = n1 / n2;
|
||||
float cost1 = dot(-dir, normal);
|
||||
cost2 = sqrt(1.0 - n1n2 * n1n2 * (1.0 - cost1 * cost1));
|
||||
|
||||
reflectionDir = dir + normal * (2.0 * cost1);
|
||||
refractionDir = dir * n1n2 + normal * (cost2 + n1n2 * cost1);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 nml = normalize(N);
|
||||
vec3 dir = normalize(wpos - eyePos);
|
||||
|
||||
|
||||
vec3 R;
|
||||
vec3 RE;
|
||||
float cost2, fdummy;
|
||||
|
||||
|
||||
snell(dir, nml, 1.0, medium + 0.1, R, RE, cost2);
|
||||
|
||||
float dist = 2.0 * cost2 * radius;
|
||||
vec3 p2 = wpos + RE * vec3(dist);
|
||||
vec3 nml2 = -(p2 - center) / radius;
|
||||
vec3 Rdummy, Rout;
|
||||
snell(RE, nml2, medium + 0.3, 1.0, Rdummy, Rout, fdummy);
|
||||
float fact = 2.0 * exp3(-dot(dist,dist) * 0.2);
|
||||
vec3 diffracted = rayColor(p2, Rout) * vec3(fact);
|
||||
|
||||
|
||||
vec3 specular = rayColor(wpos, R) * gl_Color.xyz;
|
||||
|
||||
|
||||
|
||||
gl_FragColor = gl_Color * vec4( specular + diffracted, 1.0);
|
||||
}
|
||||
13
hgplus/ShaderMinifier/tests/real/extatique/scene40.vs
Normal file
13
hgplus/ShaderMinifier/tests/real/extatique/scene40.vs
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
varying vec3 wpos;
|
||||
varying vec3 N;
|
||||
uniform vec3 eyePos;
|
||||
|
||||
void main()
|
||||
{
|
||||
wpos = gl_Vertex.xyz;
|
||||
gl_Position = ftransform();
|
||||
gl_FrontColor = gl_Color;
|
||||
N = gl_Normal;
|
||||
|
||||
}
|
||||
14
hgplus/ShaderMinifier/tests/real/extatique/scene45.fs
Normal file
14
hgplus/ShaderMinifier/tests/real/extatique/scene45.fs
Normal file
@@ -0,0 +1,14 @@
|
||||
uniform sampler2D tex;
|
||||
uniform float time;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 p = gl_TexCoord[0].xy;
|
||||
float u = atan(p.y, p.x + 0.0001) * 1.0 / 3.1415926;
|
||||
float v = 0.002 / (0.01 + length(p)) - time * 0.1;
|
||||
vec4 space = texture2D(tex, vec2(u,v))
|
||||
+ vec4(0.5) * texture2D(tex, vec2(u,v * 4.0))
|
||||
+ vec4(0.25) * texture2D(tex, vec2(u,v * 16.0));
|
||||
gl_FragColor = gl_Color * space;
|
||||
}
|
||||
6
hgplus/ShaderMinifier/tests/real/extatique/scene45.vs
Normal file
6
hgplus/ShaderMinifier/tests/real/extatique/scene45.vs
Normal file
@@ -0,0 +1,6 @@
|
||||
void main()
|
||||
{
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
gl_FrontColor = gl_Color;
|
||||
gl_Position = ftransform();
|
||||
}
|
||||
32
hgplus/ShaderMinifier/tests/real/extatique/skybox.fs
Normal file
32
hgplus/ShaderMinifier/tests/real/extatique/skybox.fs
Normal file
@@ -0,0 +1,32 @@
|
||||
uniform sampler2D tex;
|
||||
uniform float angle;
|
||||
uniform float time;
|
||||
varying vec3 pos;
|
||||
|
||||
|
||||
|
||||
vec4 getEnvColor(vec3 p)
|
||||
{
|
||||
float az = atan(p.x, p.y + 0.01);
|
||||
float ax = -pos.z;
|
||||
|
||||
vec4 sample = vec4(0.0);
|
||||
|
||||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
float fi = float(i);
|
||||
float s = ax * 1.0 / (1.0 + fi) + time * 0.01 * (2.0 + fi);
|
||||
float t = angle + (2.5) * az / 3.14159;
|
||||
|
||||
sample += texture2D(tex, vec2(s,t)) / (1.0 + 0.3 * fi);
|
||||
}
|
||||
return sample;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 env = getEnvColor(pos);
|
||||
gl_FragColor = vec4(env.xyz, 1.0);
|
||||
}
|
||||
7
hgplus/ShaderMinifier/tests/real/extatique/skybox.vs
Normal file
7
hgplus/ShaderMinifier/tests/real/extatique/skybox.vs
Normal file
@@ -0,0 +1,7 @@
|
||||
varying vec3 pos;
|
||||
|
||||
void main()
|
||||
{
|
||||
pos = (gl_ModelViewMatrix * gl_Vertex).xyz;
|
||||
gl_Position = ftransform();
|
||||
}
|
||||
142
hgplus/ShaderMinifier/tests/real/extatique/skybox2.fs
Normal file
142
hgplus/ShaderMinifier/tests/real/extatique/skybox2.fs
Normal file
@@ -0,0 +1,142 @@
|
||||
varying vec3 wpos;
|
||||
|
||||
uniform vec3 eyePos;
|
||||
|
||||
uniform sampler2D tex;
|
||||
uniform vec3 light1;
|
||||
uniform vec3 light2;
|
||||
uniform vec3 light3;
|
||||
uniform vec3 light4;
|
||||
|
||||
|
||||
vec3 getEnvColor(vec3 pos, vec2 coord)
|
||||
{
|
||||
vec3 color = texture2D(tex, coord * 0.05).xyz;
|
||||
|
||||
vec3 light1_dist = pos * 0.1 - vec3(-0.5,-0.5,-0.5);
|
||||
vec3 light2_dist = pos * 0.1 - vec3(+0.5,+0.5,-0.5);
|
||||
vec3 light3_dist = pos * 0.1 - vec3(-0.5,+0.5,+0.5);
|
||||
vec3 light4_dist = pos * 0.1 - vec3(+0.5,-0.5,+0.5);
|
||||
|
||||
vec3 clight1 = light1 * vec3(max(0.0, 1.25 - 1.0 * dot(light1_dist, light1_dist)));
|
||||
vec3 clight2 = light2 * vec3(max(0.0, 1.25 - 1.0 * dot(light2_dist, light2_dist)));
|
||||
vec3 clight3 = light3 * vec3(max(0.0, 1.25 - 1.0 * dot(light3_dist, light3_dist)));
|
||||
vec3 clight4 = light4 * vec3(max(0.0, 1.25 - 1.0 * dot(light4_dist, light4_dist)));
|
||||
|
||||
|
||||
return color + clight1 + clight2 + clight3 + clight4;
|
||||
}
|
||||
|
||||
float exp3(float x)
|
||||
{
|
||||
float y = max(-1.15365, x);
|
||||
return 1.0 + y * (1.0 + y * (0.5 + y * 0.33333333));
|
||||
}
|
||||
|
||||
vec3 rayColor(vec3 startPos, vec3 startDir)
|
||||
{
|
||||
vec3 total = vec3(0.0);
|
||||
vec3 p = startPos;
|
||||
vec3 dir = startDir;
|
||||
vec3 blend = vec3(0.5);
|
||||
vec3 dpos;
|
||||
vec3 color = vec3(0.0);
|
||||
|
||||
vec3 ray;
|
||||
vec3 nml;
|
||||
vec2 coord;
|
||||
vec3 newdir;
|
||||
vec3 sample;
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
ray = 50.0 * dir;
|
||||
nml = vec3(0.0);
|
||||
coord = vec2(0.0);
|
||||
dpos = p + ray;
|
||||
|
||||
if (abs(dpos.x) > 10.0)
|
||||
{
|
||||
if (dpos.x > 10.0)
|
||||
{
|
||||
ray *= ((9.99 - p.x) / ray.x);
|
||||
nml = vec3(-1.0,0.0,0.0);
|
||||
dpos = ray + p;
|
||||
coord = dpos.yz;
|
||||
color = getEnvColor(dpos, coord);
|
||||
}
|
||||
else
|
||||
{
|
||||
ray *= ((-9.99 - p.x) / ray.x);
|
||||
nml = vec3(1.0,0.0,0.0);
|
||||
|
||||
|
||||
dpos = ray + p;
|
||||
coord = dpos.yz * vec2(-1.0,1.0);
|
||||
color = getEnvColor(dpos, coord);
|
||||
}
|
||||
}
|
||||
|
||||
if (abs(dpos.y) > 10.0)
|
||||
{
|
||||
if (dpos.y > 10.0)
|
||||
{
|
||||
ray *= ((9.99 - p.y) / ray.y);
|
||||
nml = vec3(0.0,-1.0,0.0);
|
||||
|
||||
|
||||
dpos = ray + p;
|
||||
coord = dpos.xz * vec2(-1.0,1.0);
|
||||
color = getEnvColor(dpos, coord);
|
||||
}
|
||||
else
|
||||
{
|
||||
ray *= ((-9.99 - p.y) / ray.y);
|
||||
nml = vec3(0.0,1.0,0.0);
|
||||
|
||||
dpos = ray + p;
|
||||
coord = dpos.xz;
|
||||
color = getEnvColor(dpos, coord);
|
||||
}
|
||||
}
|
||||
|
||||
if (abs(dpos.z) > 10.0)
|
||||
{
|
||||
if (dpos.z > 10.0)
|
||||
{
|
||||
ray *= ((9.99 - p.z) / ray.z);
|
||||
nml = vec3(0.0,0.0,-1.0);
|
||||
dpos = ray + p;
|
||||
coord = dpos.xy * vec2(-1.0,1.0);
|
||||
color = getEnvColor(dpos, coord);
|
||||
}
|
||||
else
|
||||
{
|
||||
ray *= ((-9.99 - p.z) / ray.z);
|
||||
nml = vec3(0.0,0.0,1.0);
|
||||
dpos = ray + p;
|
||||
coord = dpos.xy;
|
||||
color = getEnvColor(dpos, coord);
|
||||
}
|
||||
}
|
||||
|
||||
sample = color * vec3(exp3(-length(ray) * 0.04));
|
||||
|
||||
total += sample * blend;
|
||||
blend *= sample;
|
||||
|
||||
newdir = reflect(dir, nml);
|
||||
|
||||
p = dpos;
|
||||
dir = newdir;
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 env = rayColor(eyePos, normalize(wpos - eyePos));
|
||||
|
||||
gl_FragColor = gl_Color * vec4(env, 1.0);
|
||||
}
|
||||
13
hgplus/ShaderMinifier/tests/real/extatique/skybox2.vs
Normal file
13
hgplus/ShaderMinifier/tests/real/extatique/skybox2.vs
Normal file
@@ -0,0 +1,13 @@
|
||||
varying vec3 wpos;
|
||||
|
||||
uniform vec3 eyePos;
|
||||
|
||||
void main()
|
||||
{
|
||||
wpos = gl_Vertex.xyz;
|
||||
/* pos = (gl_ModelViewMatrix * gl_Vertex).xyz; */
|
||||
gl_FrontColor = gl_Color;
|
||||
/* gl_TexCoord[0] = gl_MultiTexCoord0; */
|
||||
|
||||
gl_Position = ftransform();
|
||||
}
|
||||
18
hgplus/ShaderMinifier/tests/real/extatique/snake.fs
Normal file
18
hgplus/ShaderMinifier/tests/real/extatique/snake.fs
Normal file
@@ -0,0 +1,18 @@
|
||||
varying vec3 normal;
|
||||
varying float profondeur;
|
||||
|
||||
vec4 desaturate(vec4 color, float t)
|
||||
{
|
||||
vec3 grey = vec3(dot(vec3(0.33), color.rgb));
|
||||
return vec4(mix(color.rgb, grey, t), color.a);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 N = normal;
|
||||
|
||||
vec3 e = vec3(0.0,0.0,-1.0);
|
||||
float diffuse = max(0.0, dot(N, e));
|
||||
vec4 C = gl_Color * vec4(0.1 + 0.9 * vec3(diffuse), diffuse);
|
||||
gl_FragColor = C * exp( -profondeur * 0.1 );
|
||||
}
|
||||
12
hgplus/ShaderMinifier/tests/real/extatique/snake.vs
Normal file
12
hgplus/ShaderMinifier/tests/real/extatique/snake.vs
Normal file
@@ -0,0 +1,12 @@
|
||||
varying vec3 normal;
|
||||
varying float profondeur;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FrontColor = gl_Color;
|
||||
|
||||
normal = normalize(gl_Normal);
|
||||
gl_Position = ftransform();
|
||||
|
||||
profondeur = gl_Position.z;
|
||||
}
|
||||
84
hgplus/ShaderMinifier/tests/real/extatique/water.fs
Normal file
84
hgplus/ShaderMinifier/tests/real/extatique/water.fs
Normal file
@@ -0,0 +1,84 @@
|
||||
uniform sampler2D tex;
|
||||
uniform sampler2D texu;
|
||||
uniform sampler2D texv;
|
||||
uniform float spacing;
|
||||
uniform float ratio;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 p0 = gl_TexCoord[0].xy;
|
||||
|
||||
vec4 total = texture2D(tex, p0 * 2.5);
|
||||
vec2 v0 = vec2(spacing) * (vec2(texture2D(texu, p0).x, texture2D(texv, p0).x));
|
||||
|
||||
vec2 p1 = p0 - v0;
|
||||
total = texture2D(tex, p1) * 0.9755297;
|
||||
vec2 v1 = vec2(spacing) *(vec2(texture2D(texu, p1).x, texture2D(texv, p1).x));
|
||||
|
||||
vec2 p2 = p1 - v1;
|
||||
total += texture2D(tex, p2) * 0.9045139;
|
||||
vec2 v2 = vec2(spacing) *(vec2(texture2D(texu, p2).x, texture2D(texv, p2).x));
|
||||
|
||||
vec2 p3 = p2 - v2;
|
||||
total += texture2D(tex, p1) * 0.7939039;
|
||||
vec2 v3 = vec2(spacing) *(vec2(texture2D(texu, p3).x, texture2D(texv, p3).x));
|
||||
|
||||
vec2 p4 = p3 - v3;
|
||||
total += texture2D(tex, p2) * 0.6545261;
|
||||
vec2 v4 = vec2(spacing) *(vec2(texture2D(texu, p4).x, texture2D(texv, p4).x));
|
||||
|
||||
vec2 p5 = p4 - v4;
|
||||
total += texture2D(tex, p1) * 0.5000232;
|
||||
vec2 v5 = vec2(spacing) *(vec2(texture2D(texu, p5).x, texture2D(texv, p5).x));
|
||||
|
||||
vec2 p6 = p5 - v5;
|
||||
total += texture2D(tex, p2) * 0.3455179;
|
||||
vec2 v6 = vec2(spacing) *(vec2(texture2D(texu, p6).x, texture2D(texv, p6).x));
|
||||
|
||||
vec2 p7 = p6 - v6;
|
||||
total += texture2D(tex, p1) * 0.2061336;
|
||||
vec2 v7 = vec2(spacing) *(vec2(texture2D(texu, p7).x, texture2D(texv, p7).x));
|
||||
|
||||
vec2 p8 = p7 - v7;
|
||||
total += texture2D(tex, p2) * 0.0955133;
|
||||
|
||||
|
||||
|
||||
vec2 p12 = p0 + v0;
|
||||
total += texture2D(tex, p12) * 0.9755297;
|
||||
vec2 v12 = vec2(spacing) *(vec2(texture2D(texu, p12).x, texture2D(texv, p12).x));
|
||||
|
||||
vec2 p22 = p12 + v12;
|
||||
total += texture2D(tex, p22) * 0.9045139;
|
||||
vec2 v22 = vec2(spacing) *(vec2(texture2D(texu, p22).x, texture2D(texv, p22).x));
|
||||
|
||||
vec2 p32 = p22 + v22;
|
||||
total += texture2D(tex, p12) * 0.7939039;
|
||||
vec2 v32 = vec2(spacing) *(vec2(texture2D(texu, p32).x, texture2D(texv, p32).x));
|
||||
|
||||
vec2 p42 = p32 + v32;
|
||||
total += texture2D(tex, p22) * 0.6545261;
|
||||
vec2 v42 = vec2(spacing) *(vec2(texture2D(texu, p42).x, texture2D(texv, p42).x));
|
||||
|
||||
vec2 p52 = p42 + v42;
|
||||
total += texture2D(tex, p12) * 0.5000232;
|
||||
vec2 v52 = vec2(spacing) *(vec2(texture2D(texu, p52).x, texture2D(texv, p52).x));
|
||||
|
||||
vec2 p62 = p52 + v52;
|
||||
total += texture2D(tex, p22) * 0.3455179;
|
||||
vec2 v62 = vec2(spacing) *(vec2(texture2D(texu, p62).x, texture2D(texv, p62).x));
|
||||
|
||||
vec2 p72 = p62 + v62;
|
||||
total += texture2D(tex, p12) * 0.2061336;
|
||||
vec2 v72 = vec2(spacing) *(vec2(texture2D(texu, p72).x, texture2D(texv, p72).x));
|
||||
|
||||
vec2 p82 = p72 + v72;
|
||||
total += texture2D(tex, p22) * 0.0955133;
|
||||
|
||||
vec2 dist = (p0 - vec2(0.5, 0.5)) * vec2(1.0,ratio);
|
||||
vec4 darkF = vec4(max(0.0, 1.0 - 2.5 * dot(dist,dist)));
|
||||
|
||||
vec4 finalColor = gl_Color * total * vec4(0.1) * darkF;
|
||||
|
||||
gl_FragColor = finalColor;
|
||||
}
|
||||
6
hgplus/ShaderMinifier/tests/real/extatique/water.vs
Normal file
6
hgplus/ShaderMinifier/tests/real/extatique/water.vs
Normal file
@@ -0,0 +1,6 @@
|
||||
void main()
|
||||
{
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
gl_FrontColor = gl_Color;
|
||||
gl_Position = ftransform();
|
||||
}
|
||||
Reference in New Issue
Block a user