summaryrefslogtreecommitdiff
path: root/data/glsl.cfg
diff options
context:
space:
mode:
authorxolatile2025-08-05 10:40:01 +0200
committerxolatile2025-08-05 10:40:01 +0200
commita2a16b85572b1d28b0cd4901ea7348750732a740 (patch)
tree6287cdf8331e821f9fe1e0adadc664a59634a812 /data/glsl.cfg
parent6762e292d02e37a69a807e01493d4e14319cca33 (diff)
downloadxolatile-badassbug-a2a16b85572b1d28b0cd4901ea7348750732a740.tar.xz
xolatile-badassbug-a2a16b85572b1d28b0cd4901ea7348750732a740.tar.zst
Few more changes, please do not compile...
Diffstat (limited to 'data/glsl.cfg')
-rw-r--r--data/glsl.cfg1368
1 files changed, 50 insertions, 1318 deletions
diff --git a/data/glsl.cfg b/data/glsl.cfg
index 5726392..d2495eb 100644
--- a/data/glsl.cfg
+++ b/data/glsl.cfg
@@ -11,11 +11,11 @@ lmcoordscale = (divf 1 32767)
shader 0 "null" [
attribute vec4 vvertex;
void main(void)
- {
+ {
gl_Position = vvertex;
}
] [
- void main(void)
+ void main(void)
{
gl_FragColor = vec4(1.0, 0.0, 1.0, 1.0);
}
@@ -164,69 +164,6 @@ shader 0 "cubemap" [
//////////////////////////////////////////////////////////////////////
//
-// fogged variants of default shaders
-//
-//////////////////////////////////////////////////////////////////////
-
-shader 0 "fogged" [
- //:fog
- attribute vec4 vvertex, vcolor;
- attribute vec2 vtexcoord0;
- uniform mat4 camprojmatrix;
- varying vec2 texcoord0;
- varying vec4 color;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- texcoord0 = vtexcoord0;
- color = vcolor;
- }
-] [
- varying vec2 texcoord0;
- varying vec4 color;
- uniform sampler2D tex0;
- void main(void)
- {
- gl_FragColor = color * texture2D(tex0, texcoord0);
- }
-]
-
-shader 0 "foggednotexture" [
- //:fog
- attribute vec4 vvertex, vcolor;
- uniform mat4 camprojmatrix;
- varying vec4 color;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- color = vcolor;
- }
-] [
- varying vec4 color;
- void main(void)
- {
- gl_FragColor = color;
- }
-]
-
-shader 0 "fogoverlay" [
- attribute vec4 vvertex, vcolor;
- varying vec4 color;
- void main(void)
- {
- gl_Position = vvertex;
- color = vcolor;
- }
-] [
- varying vec4 color;
- void main(void)
- {
- gl_FragColor = color;
- }
-]
-
-//////////////////////////////////////////////////////////////////////
-//
// for filling the z-buffer only (i.e. multi-pass rendering, OQ)
//
//////////////////////////////////////////////////////////////////////
@@ -234,7 +171,7 @@ shader 0 "fogoverlay" [
shader 0 "nocolor" [
attribute vec4 vvertex;
uniform mat4 camprojmatrix;
- void main() { gl_Position = camprojmatrix * vvertex; }
+ void main() { gl_Position = camprojmatrix * vvertex; }
] [
void main() {}
]
@@ -291,7 +228,7 @@ worldshader = [
diffuse.rgb *= diffuse.a;
//:fog fogcolor * diffuse.a
] [
- vec4 diffuse = vec4(texture2D(diffusemap, texcoord0).rgb, 1.0);
+ vec4 diffuse = vec4(texture2D(diffusemap, texcoord0).rgb, 1.0);
])
vec4 lm = texture2D(lightmap, texcoord1);
@@ -306,36 +243,6 @@ worldshader = [
]
]
-glareworldshader = [
- variantshader (if (< (strstr $arg1 "env") 0) 4 6) $arg1 4 [
- //:fog
- @(if (>= $numargs 4) [result $arg4])
- attribute vec4 vvertex;
- attribute vec3 vnormal;
- attribute vec2 vtexcoord0, vtexcoord1;
- uniform mat4 camprojmatrix;
- uniform vec2 texgenscroll;
- varying vec2 texcoord0, texcoord1;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- texcoord0 = vtexcoord0 + texgenscroll;
- texcoord1 = vtexcoord1 * @lmcoordscale;
-
- @arg2
- }
- ] [
- @(if (>= $numargs 4) [result $arg4])
- @(if (>= $numargs 5) [result $arg5])
- uniform vec4 colorparams;
- varying vec2 texcoord0, texcoord1;
- void main(void)
- {
- @arg3
- }
- ]
-]
-
worldshader "stdworld" [] []
worldshader "alphaworld" [] []
@@ -357,14 +264,14 @@ glowshader = [
glareworldshader @arg1 [] [
vec3 glow = texture2D(glowmap, texcoord0).rgb;
glow *= glowcolor.rgb;
- float k = max(glow.r, max(glow.g, glow.b));
+ float k = max(glow.r, max(glow.g, glow.b));
gl_FragColor.rgb = min(k*k*32.0, 1.0) * glow;
- gl_FragColor.a =
+ gl_FragColor.a =
//:variantoverride texture2D(lightmap, texcoord1).a
colorparams.a
;
] [] [
- uniform sampler2D glowmap;
+ uniform sampler2D glowmap;
//:variant uniform sampler2D lightmap;
]
]
@@ -375,9 +282,9 @@ glowshader "glowalphaworld"
defershader 0 "pulseworld" [
defuniformparam "pulsespeed" 1 // pulse frequency (Hz)
worldshader "pulseworld" [
- pulse = abs(fract(millis * pulsespeed.x)*2.0 - 1.0);
+ pulse = abs(fract(millis * pulsespeed.x)*2.0 - 1.0);
] [
- vec3 diffuse2 = texture2D(decal, texcoord0).rgb;
+ vec3 diffuse2 = texture2D(decal, texcoord0).rgb;
diffuse.rgb = mix(diffuse.rgb, diffuse2, pulse);
] [] [uniform float millis; varying float pulse;] [uniform sampler2D decal;]
]
@@ -398,14 +305,14 @@ pulseglowshader = [
] [
vec3 glow = texture2D(glowmap, texcoord0).rgb;
glow *= pulse;
- float k = max(glow.r, max(glow.g, glow.b));
+ float k = max(glow.r, max(glow.g, glow.b));
gl_FragColor.rgb = min(k*k*32.0, 1.0) * glow;
- gl_FragColor.a =
+ gl_FragColor.a =
//:variantoverride texture2D(lightmap, texcoord1).a
colorparams.a
;
] [uniform float millis; varying vec3 pulse;] [
- uniform sampler2D glowmap;
+ uniform sampler2D glowmap;
//:variant uniform sampler2D lightmap;
]
]
@@ -413,22 +320,6 @@ pulseglowshader = [
pulseglowshader "pulseglowworld"
pulseglowshader "pulseglowalphaworld"
-shader 0 "fogworld" [
- //:water
- attribute vec4 vvertex;
- uniform mat4 camprojmatrix;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- }
-] [
- uniform vec3 fogcolor;
- void main(void)
- {
- gl_FragColor = vec4(fogcolor, 1.0);
- }
-]
-
shader 0 "noglareworld" [
attribute vec4 vvertex;
uniform mat4 camprojmatrix;
@@ -479,39 +370,6 @@ shader 0 "noglarealphaworld" [
gl_FragColor.a = colorparams.a;
}
]
-
-defershader 2 "envworld" [
- defuniformparam "envscale" 0.2 0.2 0.2 // reflectivity
- worldshader "envworld" [
- normal = vnormal;
- camvec = camera - vvertex.xyz;
- ] [
- vec3 reflect = textureCube(envmap, 2.0*normal*dot(camvec, normal) - camvec).rgb;
- ] [
- diffuse *= lm;
- gl_FragColor.rgb = mix(diffuse.rgb, reflect, envscale.rgb);
- gl_FragColor.a = diffuse.a;
- ] [uniform vec3 camera; varying vec3 normal, camvec;] [uniform samplerCube envmap;]
-
- defuniformparam "envscale" 0.2 0.2 0.2 // reflectivity
- worldshader "envworldfast" [
- vec3 camvec = camera - vvertex.xyz;
- rvec = 2.0*vnormal*dot(camvec, vnormal) - camvec;
- ] [
- vec3 reflect = textureCube(envmap, rvec).rgb;
- ] [
- diffuse *= lm;
- gl_FragColor.rgb = mix(diffuse.rgb, reflect, envscale.rgb);
- gl_FragColor.a = diffuse.a;
- ] [uniform vec3 camera; varying vec3 rvec;] [uniform samplerCube envmap;]
-
- defuniformparam "envscale" 0.2 0.2 0.2 // reflectivity
- worldshader "envworldalt" [] []
-
- altshader envworld envworldalt
- fastshader envworld envworldfast 2
- fastshader envworld envworldalt 1
-]
shader 0 "depthfxworld" [
attribute vec4 vvertex;
@@ -552,18 +410,13 @@ shader 0 depthfxsplitworld [
]
// bumptype:
-// e -> reserve envmap texture slot
// o -> orthonormalize
// t -> tangent space cam
-// r -> envmap reflection
-// R -> modulate envmap reflection with spec map
// s -> spec
// S -> spec map
// p -> parallax
-// P -> steep parallax (7 steps)
// g -> glow
// G -> pulse glow
-// i -> glare intensity
// a -> alpha map
btopt = [ >= (strstr $bumptype $arg1) 0 ]
@@ -590,7 +443,7 @@ bumpvariantshader = [
if (btopt "R") [
defuniformparam "envscale" 1 1 1 // reflectivity map multiplier
] [if (btopt "r") [
- defuniformparam "envscale" 0.2 0.2 0.2 // reflectivity
+ defuniformparam "envscale" 0.2 0.2 0.2 // reflectivity
]]
] [
if (btopt "s") [stype = (+ $stype 8)]
@@ -606,7 +459,7 @@ bumpvariantshader = [
varying vec2 texcoord0, texcoord1;
@(if (|| (btopt "t") (btopt "r")) [result [uniform vec3 camera; varying vec3 camvec;]])
@(if (btopt "G") [result [uniform float millis; varying float pulse;]])
- @(if (btopt "r") [result [varying mat3 world;]])
+ @(if (btopt "r") [result [varying mat3 world;]])
void main(void)
{
gl_Position = camprojmatrix * vvertex;
@@ -627,8 +480,8 @@ bumpvariantshader = [
// calculate tangent -> world transform
world = mat3(vtangent.xyz, bitangent, vnormal);
]])
- ]])
-
+ ]])
+
@(if (btopt "G") [result [
pulse = abs(fract(millis*pulseglowspeed.x)*2.0 - 1.0);
]])
@@ -673,7 +526,7 @@ bumpvariantshader = [
height = texture2D(normalmap, htc.xy);
]])
#define dtc htc.xy
- #define bump height.xyz
+ #define bump height.xyz
]])
@(if (|| (btopt "p") (btopt "P")) [] [result [#define dtc texcoord0]])
@@ -691,7 +544,7 @@ bumpvariantshader = [
if (&& (btopt "a") (btopt "S")) [result [
vec4 normal = texture2D(normalmap, dtc);
#define alpha normal.a
- #define bump normal.rgb
+ #define bump normal.rgb
]] [result [
vec3 bump = texture2D(normalmap, dtc).rgb;
]]
@@ -702,7 +555,7 @@ bumpvariantshader = [
@(if (btopt "s") [result [
vec3 halfangle = normalize(camdir + lmlv);
float spec = pow(clamp(dot(halfangle, bump), 0.0, 1.0), @(? (btopt "i") "128.0" "32.0"));
- @(if (btopt "i") [result [spec = min(spec*64.0, 1.0);]])
+ @(if (btopt "i") [result [spec = min(spec*64.0, 1.0);]])
@(if (btopt "S") [result [spec *= diffuse.a;]])
@(if (btopt "i") [result [
@(? (btopt "S") "diffuse.rgb" "vec3 diffuse") = specscale.xyz*spec;
@@ -724,7 +577,7 @@ bumpvariantshader = [
@(? (|| (btopt "g") (btopt "r")) "diffuse.rgb" "gl_FragColor.rgb") = diffuse.rgb * lmc.rgb;
]])
]])
-
+
@(if (btopt "r") [result [
vec3 rvec;
@(if (btopt "t") [result [
@@ -746,7 +599,7 @@ bumpvariantshader = [
@(if (btopt "a") [result [
@(? (btopt "g") "diffuse.rgb" "gl_FragColor.rgb") *= alpha;
]])
-
+
@(if (btopt "g") [result [
vec3 glow = texture2D(glowmap, dtc).rgb;
@@(if (btopt "G") [result [
@@ -760,7 +613,7 @@ bumpvariantshader = [
gl_FragColor.rgb = glow*k + diffuse.rgb;
]] [result [
gl_FragColor.rgb = glow*k;
- gl_FragColor.a =
+ gl_FragColor.a =
//:variantoverride texture2D(lmcolor, texcoord1).a
colorparams.a
;
@@ -931,8 +784,6 @@ altshader bumpenvspecmapparallaxpulseglowworld bumpenvparallaxpulseglowworldalt
fastshader bumpenvspecmapparallaxpulseglowworld bumpenvparallaxpulseglowworldalt 2
fastshader bumpenvspecmapparallaxpulseglowworld bumpenvpulseglowworldalt 1
-//bumpshader "steepworld" "Pot"
-
////////////////////////////////////////////////
//
// model shaders
@@ -956,7 +807,7 @@ qtangentdecode = [
skelanimdefs = [
skelanimlength = (min (- $maxvsuniforms (+ $reservevpparams 10)) $maxskelanimdata)
result [
- attribute vec4 vboneweight;
+ attribute vec4 vboneweight;
attribute vec4 vboneindex;
//:uniform animdata
uniform vec4 animdata[@@skelanimlength];
@@ -1040,7 +891,7 @@ shader 0 "shadowmapreceiver" [
void main(void)
{
gl_Position = shadowmatrix * vvertex;
- shadowmapvals = vec4(0.0, 0.0, shadowmapbias.y - gl_Position.z, 0.0);
+ shadowmapvals = vec4(0.0, 0.0, shadowmapbias.y - gl_Position.z, 0.0);
}
] [
varying vec4 shadowmapvals;
@@ -1082,14 +933,12 @@ loop i 4 [
]
// mdltype:
-// e -> envmap
// n -> normalmap
// s -> spec
// m -> masks
// b -> dual-quat skeletal animation
// a -> alpha-tested
// q -> qtangents
-// i -> glare intensity
mdlopt = [ >= (strstr $modeltype $arg1) 0 ]
@@ -1105,7 +954,7 @@ modelvertexshader = [
]] [result [
attribute vec3 vnormal;
]])
- uniform mat4 modelmatrix;
+ uniform mat4 modelmatrix;
uniform vec3 modelcamera, lightdir, lightscale;
uniform vec2 texscroll;
varying vec2 texcoord0;
@@ -1136,7 +985,7 @@ modelvertexshader = [
]] [result [
#define mpos vvertex
@(if (mdlopt "q") [result [
- #define mquat vtangent
+ #define mquat vtangent
@(qtangentdecode (mdlopt "n"))
]] [result [
#define mnormal vnormal
@@ -1149,7 +998,7 @@ modelvertexshader = [
color = vcolor;
]])
texcoord0 = vtexcoord0 + texscroll;
-
+
@(if (|| (mdlopt "e") (mdlopt "s")) [result [
vec3 camdir = normalize(modelcamera - mpos.xyz);
]])
@@ -1167,13 +1016,13 @@ modelvertexshader = [
vec3 mbitangent = cross(mnormal, mtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0);
lightvec = vec3(dot(lightdir, mtangent), dot(lightdir, mbitangent), dot(lightdir, mnormal));
@(if (mdlopt "s") [result [
- vec3 halfdir = lightdir + camdir;
+ vec3 halfdir = lightdir + camdir;
halfangle = vec3(dot(halfdir, mtangent), dot(halfdir, mbitangent), dot(halfdir, mnormal));
]])
]]
] [result [
@(if (mdlopt "s") [result [
- nvec = mnormal;
+ nvec = mnormal;
halfangle = lightdir + camdir;
]] [if (! (mdlopt "i")) [result [
float intensity = dot(mnormal, lightdir);
@@ -1182,11 +1031,11 @@ modelvertexshader = [
@(if (mdlopt "e") [result [
float invfresnel = dot(camdir, mnormal);
rvec = modelworld * (2.0*invfresnel*mnormal - camdir);
- rmod = envmapscale.x*max(invfresnel, 0.0) + envmapscale.y;
+ rmod = envmapscale.x*max(invfresnel, 0.0) + envmapscale.y;
]])
]])
}
- ]
+ ]
]
modelfragmentshader = [
@@ -1366,7 +1215,7 @@ blurshader = [
texcoordp@(+ $i 2) = tcp;
texcoordn@(+ $i 2) = tcn;
]])
- }
+ }
] [
uniform float weights[8];
uniform float offsets[8];
@@ -1407,133 +1256,8 @@ loop i 7 [
]
]
-////////////////////////////////////////////////
-//
-// full screen shaders:
-//
-////////////////////////////////////////////////
-
-fsvs = [result [
- attribute vec4 vvertex;
- @(screentexcoord 0)
- uniform vec2 postfxscale;
- varying vec2 texcoord0;
- @arg2
- void main(void)
- {
- gl_Position = vvertex; // woohoo, no mvp :)
- texcoord0 = vtexcoord0;
- @arg1
- }
-]]
-
-fsps = [result [
- uniform sampler2D tex0;
- varying vec2 texcoord0;
- @arg2
- void main(void)
- {
- vec4 color = texture2D(tex0, texcoord0);
- @arg1
- }
-]]
-
-fsvs4 = [
- fsvs [
- texcoord1 = vtexcoord0 + vec2(-1.5, -1.5)*postfxscale;
- texcoord2 = vtexcoord0 + vec2( 1.5, -1.5)*postfxscale;
- texcoord3 = vtexcoord0 + vec2(-1.5, 1.5)*postfxscale;
- texcoord4 = vtexcoord0 + vec2( 1.5, 1.5)*postfxscale;
- @arg1
- ] [
- varying vec2 texcoord1, texcoord2, texcoord3, texcoord4;
- ]
-]
-
-fsps4 = [
- fsps [
- vec4 s00 = texture2D(tex0, texcoord1);
- vec4 s02 = texture2D(tex0, texcoord2);
- vec4 s20 = texture2D(tex0, texcoord3);
- vec4 s22 = texture2D(tex0, texcoord4);
- @arg1
- ] [
- varying vec2 texcoord1, texcoord2, texcoord3, texcoord4;
- ]
-]
-
-// some simple ones that just do an effect on the RGB value...
-
-lazyshader 0 "invert" (fsvs) (fsps [gl_FragColor = 1.0 - color;])
-lazyshader 0 "gbr" (fsvs) (fsps [gl_FragColor = color.yzxw;])
-lazyshader 0 "bw" (fsvs) (fsps [gl_FragColor = vec4(dot(color.xyz, vec3(0.333)));])
-
-// sobel
-
-lazyshader 0 "sobel" (fsvs4) (fsps4 [
- vec4 t = s00 + s20 - s02 - s22;
- vec4 u = s00 + s02 - s20 - s22;
- gl_FragColor = color + t*t + u*u;
-])
-
-// rotoscope
-
-lazyshader 0 "rotoscope" [
- attribute vec4 vvertex;
- @(screentexcoord 0)
- uniform vec2 postfxscale;
- uniform vec4 params;
- varying vec2 t11, t00, t12, t01, t20, t02, t21, t10, t22;
- void main(void)
- {
- gl_Position = vvertex;
- t11 = vtexcoord0;
- vec2 scale = postfxscale*params.x;
- t00 = vec2(-1.0, -1.0)*scale + vtexcoord0;
- t12 = vec2( 0.0, 1.0)*scale + vtexcoord0;
- t01 = vec2(-1.0, 0.0)*scale + vtexcoord0;
- t20 = vec2( 1.0, -1.0)*scale + vtexcoord0;
- t02 = vec2(-1.0, 1.0)*scale + vtexcoord0;
- t21 = vec2( 1.0, 0.0)*scale + vtexcoord0;
- t10 = vec2( 0.0, -1.0)*scale + vtexcoord0;
- t22 = vec2( 1.0, 1.0)*scale + vtexcoord0;
- }
-] [
- uniform sampler2D tex0;
- varying vec2 t11, t00, t12, t01, t20, t02, t21, t10, t22;
- void main(void)
- {
- vec4 c00 = texture2D(tex0, t00);
- vec4 c01 = texture2D(tex0, t01);
- vec4 c02 = texture2D(tex0, t02);
- vec4 c10 = texture2D(tex0, t10);
- vec4 c11 = texture2D(tex0, t11);
- vec4 c12 = texture2D(tex0, t12);
- vec4 c20 = texture2D(tex0, t20);
- vec4 c21 = texture2D(tex0, t21);
- vec4 c22 = texture2D(tex0, t22);
-
- vec4 diag1 = c00 - c22;
- vec4 diag2 = c02 - c20;
- vec4 xedge = (c01 - c21)*2.0 + diag1 + diag2;
- vec4 yedge = (c10 - c12)*2.0 + diag1 - diag2;
- xedge *= xedge;
- yedge *= yedge;
-
- vec4 xyedge = xedge + yedge;
- float sobel = step(max(xyedge.x, max(xyedge.y, xyedge.z)), 0.1);
-
- float hue = dot(c11.xyz, vec3(1.0));
- c11 /= hue;
- vec3 cc = step(vec3(0.2, 0.8, 1.5), vec3(hue));
- c11 *= dot(cc, vec3(0.5, 0.5, 1.5));
-
- gl_FragColor = c11 * max(cc.z, sobel);
- }
-]
-
blur3shader = [
- lazyshader 0 $arg1 [
+ lazyshader 0 $arg1 [
attribute vec4 vvertex;
@(screentexcoord 0)
uniform vec2 postfxscale;
@@ -1546,7 +1270,7 @@ blur3shader = [
}
] [
varying vec2 texcoord0, texcoord1;
- uniform sampler2D tex0;
+ uniform sampler2D tex0;
void main(void)
{
gl_FragColor = 0.5*(texture2D(tex0, texcoord0) + texture2D(tex0, texcoord1));
@@ -1570,115 +1294,25 @@ blur5shader = [
texcoord2 = vtexcoord0 + vec2(@(? $arg2 1.333 0.0), @(? $arg3 1.333 0.0))*postfxscale;
}
] [
- uniform sampler2D tex0;
+ uniform sampler2D tex0;
varying vec2 texcoord0, texcoord1, texcoord2;
void main(void)
{
gl_FragColor = 0.4*texture2D(tex0, texcoord0) + 0.3*(texture2D(tex0, texcoord1) + texture2D(tex0, texcoord2));
- }
+ }
]
]
blur5shader hblur5 1 0
blur5shader vblur5 0 1
-rotoscope = [
- clearpostfx
- if (>= $numargs 1) [addpostfx rotoscope 0 0 0 $arg1]
- if (>= $numargs 2) [
- if (= $arg2 1) [addpostfx hblur3; addpostfx vblur3]
- if (= $arg2 2) [addpostfx hblur5; addpostfx vblur5]
- ]
-]
-
-shader 0 "screenrect" [
- attribute vec4 vvertex, vcolor;
- @(screentexcoord 0)
- varying vec2 texcoord0;
- varying vec4 color;
- void main(void)
- {
- gl_Position = vvertex;
- texcoord0 = vtexcoord0;
- color = vcolor;
- }
-] [
- varying vec2 texcoord0;
- varying vec4 color;
- uniform sampler2D tex0;
- void main(void)
- {
- gl_FragColor = color * texture2D(tex0, texcoord0);
- }
-]
-
-// bloom-ish
-
-lazyshader 0 "bloom_scale" (fsvs4) (fsps4 [
- gl_FragColor = 0.2 * (s02 + s00 + s22 + s20 + color);
-])
-
-lazyshader 0 "bloom_init" (fsvs) (fsps [
- float t = max(color.r, max(color.g, color.b));
- gl_FragColor = t*t*color;
-])
-
-bloomshader = [
- defershader 0 $arg1 [
- forceshader "bloom_scale"
- forceshader "bloom_init"
- shader 0 @arg1 [
- attribute vec4 vvertex;
- @(screentexcoord 0)
- varying vec2 texcoord0;
- void main(void)
- {
- gl_Position = vvertex;
- texcoord0 = vtexcoord0;
- }
- ] [
- uniform vec4 params;
- varying vec2 texcoord0;
- uniform sampler2D tex0 @@(loopconcat i $arg2 [result [, tex@(+ $i 1)]]);
- void main(void)
- {
- vec4 sample = texture2D(tex0, texcoord0);
- @@(loopconcat i $arg2 [result [
- @(? $i "bloom +=" "vec4 bloom =") texture2D(tex@(+ $i 1), texcoord0);
- ]])
- gl_FragColor = bloom*params.x + sample;
- }
- ]
- ]
-]
-
-bloomshader bloom1 1
-bloomshader bloom2 2
-bloomshader bloom3 3
-bloomshader bloom4 4
-bloomshader bloom5 5
-bloomshader bloom6 6
-
-setupbloom = [
- addpostfx bloom_init 1 1 "+0"
- loop i (- $arg1 1) [
- addpostfx bloom_scale (+ $i 2) (+ $i 2) (concatword "+" (+ $i 1))
- ]
- addpostfx (concatword bloom $arg1) 0 0 (loopconcat i (+ $arg1 1) [result $i]) $arg2
-]
-
-bloom = [
- clearpostfx
- if (>= $numargs 1) [setupbloom 6 $arg1]
-]
-
////////////////////////////////////////////////
//
-// miscellaneous effect shaders:
+// miscellaneous effect shaders:
//
////////////////////////////////////////////////
// wobbles the vertices of an explosion sphere
-// and generates all texcoords
+// and generates all texcoords
// and blends the edge color
// and modulates the texture
explosionshader = [
@@ -1705,13 +1339,13 @@ explosionshader = [
]])
color = vcolor;
-
+
texcoord0 = vtexcoord0;
vec2 texgen = vec2(dot(texgenS, vvertex.xyz), dot(texgenT, vvertex.xyz));
texcoord1 = texgen;
texcoord2 = 0.5*texgen - millis*0.5;
- }
- ] [
+ }
+ ] [
@(if (>= (strstr $arg1 "soft") 0) [result [
uniform sampler2D tex2;
]])
@@ -1719,7 +1353,7 @@ explosionshader = [
uniform vec2 blendparams;
varying vec4 color;
varying vec2 texcoord0, texcoord1, texcoord2;
- @(if (>= (strstr $arg1 "soft") 0) [result [uniform vec4 depthfxparams; varying vec4 texcoord3; ]])
+ @(if (>= (strstr $arg1 "soft") 0) [result [uniform vec4 depthfxparams; varying vec4 texcoord3; ]])
@(if (>= (strstr $arg1 "soft8") 0) [result [uniform vec4 depthfxselect;]])
void main(void)
{
@@ -1733,7 +1367,7 @@ explosionshader = [
diffuse.b += k*k;
]] [result [
diffuse *= blend*4.0; // dup alpha into RGB channels + intensify and over saturate
- diffuse.b += 0.5 - blend*0.5; // blue tint
+ diffuse.b += 0.5 - blend*0.5; // blue tint
]])
@(if (>= (strstr $arg1 "soft") 0) [result [
@@ -1767,7 +1401,7 @@ shader 0 "particlenotexture" [
{
gl_Position = camprojmatrix * vvertex;
color = vcolor * colorscale;
- }
+ }
] [
varying vec4 color;
void main(void)
@@ -1785,12 +1419,12 @@ particleshader = [
uniform vec4 colorscale;
varying vec2 texcoord0;
varying vec4 color;
- @(if (>= (strstr $arg1 "soft") 0) [result [uniform vec4 depthfxparams; varying vec3 texcoord1, surface; ]])
+ @(if (>= (strstr $arg1 "soft") 0) [result [uniform vec4 depthfxparams; varying vec3 texcoord1, surface; ]])
void main(void)
{
gl_Position = camprojmatrix * vvertex;
texcoord0 = vtexcoord0;
- color = vcolor * colorscale;
+ color = vcolor * colorscale;
@(if (>= (strstr $arg1 "soft") 0) [result [
texcoord1 = vec3(0.5*(gl_Position.xy + gl_Position.w), gl_Position.w);
@@ -1806,7 +1440,7 @@ particleshader = [
uniform sampler2D tex0;
varying vec2 texcoord0;
varying vec4 color;
- @(if (>= (strstr $arg1 "soft") 0) [result [uniform vec4 depthfxparams; varying vec3 texcoord1, surface;]])
+ @(if (>= (strstr $arg1 "soft") 0) [result [uniform vec4 depthfxparams; varying vec3 texcoord1, surface;]])
@(if (>= (strstr $arg1 "soft8") 0) [result [uniform vec4 depthfxselect;]])
void main(void)
{
@@ -1824,41 +1458,19 @@ particleshader = [
gl_FragColor = diffuse * color;
}
- ]
+ ]
]
looplist i ["" "soft" "soft8"] [
particleshader [particle@i]
]
-shader 0 "blendbrush" [
- attribute vec4 vvertex, vcolor;
- uniform mat4 camprojmatrix;
- uniform vec4 texgenS, texgenT;
- varying vec4 color;
- varying vec2 texcoord0;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- color = vcolor;
- texcoord0 = vec2(dot(texgenS, vvertex), dot(texgenT, vvertex));
- }
-] [
- varying vec4 color;
- varying vec2 texcoord0;
- uniform sampler2D tex0;
- void main(void)
- {
- gl_FragColor = texture2D(tex0, texcoord0).r * color;
- }
-]
-
lazyshader 0 "prefab" [
attribute vec4 vvertex, vcolor;
attribute vec3 vnormal;
uniform mat4 prefabmatrix;
uniform mat3 prefabworld;
- varying vec4 color;
+ varying vec4 color;
void main(void)
{
@@ -1867,756 +1479,10 @@ lazyshader 0 "prefab" [
color.rgb *= dot(prefabworld * vnormal, vec3(0.0, -0.447213595, 0.894427191));
}
] [
- varying vec4 color;
- void main(void)
- {
- gl_FragColor = color;
- }
-]
-
-lazyshader 0 "moviergb" [
- attribute vec4 vvertex;
- @(screentexcoord 0)
- varying vec2 texcoord0;
- void main(void)
- {
- gl_Position = vvertex;
- texcoord0 = vtexcoord0;
- }
-] [
- varying vec2 texcoord0;
- uniform sampler2D tex0;
- void main(void)
- {
- gl_FragColor = texture2D(tex0, texcoord0);
- }
-]
-
-lazyshader 0 "movieyuv" [
- attribute vec4 vvertex;
- @(screentexcoord 0)
- varying vec2 texcoord0;
- void main(void)
- {
- gl_Position = vvertex;
- texcoord0 = vtexcoord0;
- }
-] [
- varying vec2 texcoord0;
- uniform sampler2D tex0;
- void main(void)
- {
- vec3 sample = texture2D(tex0, texcoord0).rgb;
- gl_FragColor = vec4(dot(sample, vec3(0.439216, -0.367788, -0.071427)) + 0.501961,
- dot(sample, vec3(-0.148224, -0.290992, 0.439216)) + 0.501961,
- dot(sample, vec3(0.256788, 0.504125, 0.097905)) + 0.062745,
- 0.0);
- }
-]
-
-lazyshader 0 "moviey" [
- attribute vec4 vvertex;
- @(screentexcoord 0)
- uniform vec2 moviescale;
- varying vec2 texcoord0, texcoord1, texcoord2, texcoord3;
- void main(void)
- {
- gl_Position = vvertex;
- texcoord0 = vtexcoord0 + vec2(-1.5, 0.0)*moviescale;
- texcoord1 = vtexcoord0 + vec2(-0.5, 0.0)*moviescale;
- texcoord2 = vtexcoord0 + vec2( 0.5, 0.0)*moviescale;
- texcoord3 = vtexcoord0 + vec2( 1.5, 0.0)*moviescale;
- }
-] [
- varying vec2 texcoord0, texcoord1, texcoord2, texcoord3;
- uniform sampler2D tex0;
- void main(void)
- {
- vec3 sample1 = texture2D(tex0, texcoord0).rgb;
- vec3 sample2 = texture2D(tex0, texcoord1).rgb;
- vec3 sample3 = texture2D(tex0, texcoord2).rgb;
- vec3 sample4 = texture2D(tex0, texcoord3).rgb;
- gl_FragColor = vec4(dot(sample3, vec3(0.256788, 0.504125, 0.097905)) + 0.062745,
- dot(sample2, vec3(0.256788, 0.504125, 0.097905)) + 0.062745,
- dot(sample1, vec3(0.256788, 0.504125, 0.097905)) + 0.062745,
- dot(sample4, vec3(0.256788, 0.504125, 0.097905)) + 0.062745);
- }
-]
-
-lazyshader 0 "movieu" [
- attribute vec4 vvertex;
- @(screentexcoord 0)
- uniform vec2 moviescale;
- varying vec2 texcoord0, texcoord1, texcoord2, texcoord3;
- void main(void)
- {
- gl_Position = vvertex;
- texcoord0 = vtexcoord0 + vec2(-3.0, 0.0)*moviescale;
- texcoord1 = vtexcoord0 + vec2(-1.0, 0.0)*moviescale;
- texcoord2 = vtexcoord0 + vec2( 1.0, 0.0)*moviescale;
- texcoord3 = vtexcoord0 + vec2( 3.0, 0.0)*moviescale;
- }
-] [
- varying vec2 texcoord0, texcoord1, texcoord2, texcoord3;
- uniform sampler2D tex0;
- void main(void)
- {
- vec3 sample1 = texture2D(tex0, texcoord0).rgb;
- vec3 sample2 = texture2D(tex0, texcoord1).rgb;
- vec3 sample3 = texture2D(tex0, texcoord2).rgb;
- vec3 sample4 = texture2D(tex0, texcoord3).rgb;
- gl_FragColor = vec4(dot(sample3, vec3(-0.148224, -0.290992, 0.43921)) + 0.501961,
- dot(sample2, vec3(-0.148224, -0.290992, 0.43921)) + 0.501961,
- dot(sample1, vec3(-0.148224, -0.290992, 0.43921)) + 0.501961,
- dot(sample4, vec3(-0.148224, -0.290992, 0.43921)) + 0.501961);
- }
-]
-
-lazyshader 0 "moviev" [
- attribute vec4 vvertex;
- @(screentexcoord 0)
- uniform vec2 moviescale;
- varying vec2 texcoord0, texcoord1, texcoord2, texcoord3;
- void main(void)
- {
- gl_Position = vvertex;
- texcoord0 = vtexcoord0 + vec2(-3.0, 0.0)*moviescale;
- texcoord1 = vtexcoord0 + vec2(-1.0, 0.0)*moviescale;
- texcoord2 = vtexcoord0 + vec2( 1.0, 0.0)*moviescale;
- texcoord3 = vtexcoord0 + vec2( 3.0, 0.0)*moviescale;
- }
-] [
- varying vec2 texcoord0, texcoord1, texcoord2, texcoord3;
- uniform sampler2D tex0;
- void main(void)
- {
- vec3 sample1 = texture2D(tex0, texcoord0).rgb;
- vec3 sample2 = texture2D(tex0, texcoord1).rgb;
- vec3 sample3 = texture2D(tex0, texcoord2).rgb;
- vec3 sample4 = texture2D(tex0, texcoord3).rgb;
- gl_FragColor = vec4(dot(sample3, vec3(0.439216, -0.367788, -0.071427)) + 0.501961,
- dot(sample2, vec3(0.439216, -0.367788, -0.071427)) + 0.501961,
- dot(sample1, vec3(0.439216, -0.367788, -0.071427)) + 0.501961,
- dot(sample4, vec3(0.439216, -0.367788, -0.071427)) + 0.501961);
- }
-]
-
-///////////////////////////////////////////////////
-//
-// reflective/refractive water shaders:
-//
-///////////////////////////////////////////////////
-
-watershader = [
- specular = $arg2
- rgbfog = $arg3
- distort = $arg4
- combine = $arg5
- lazyshader 0 $arg1 [
- attribute vec4 vvertex;
- attribute vec3 vcolor;
- uniform mat4 camprojmatrix;
- uniform vec3 camera;
- uniform mat4 watermatrix;
- uniform float waterheight;
- uniform float millis;
- @(if $specular [result [uniform vec3 lightpos; varying vec3 lightdir;]])
- varying vec3 camdir, color;
- varying vec4 texcoord0;
- varying vec2 texcoord1, texcoord2;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- color = vcolor;
- texcoord0 = watermatrix * vvertex;
- @(if (>= (strstr $arg1 "underwater") 0) [result [
- texcoord0.z = waterheight - vvertex.z;
- ]] [result [
- texcoord0.z = vvertex.z - waterheight;
- ]])
- vec2 tc = vvertex.xy * 0.02;
- texcoord1 = tc + millis*0.05;
- texcoord2 = tc - millis*0.03;
- camdir = camera - vvertex.xyz;
- @(if $specular [result [
- lightdir = lightpos - vvertex.xyz;
- ]])
- }
- ] [
- @(if $rgbfog [result [
- //:fog
- ]] [result [
- //:fogrgba vec4(vec3(0.0), 1.0)
- ]])
- uniform vec2 depth;
- @(if $specular [result [uniform vec3 lightcolor; uniform float lightradius; varying vec3 lightdir;]])
- varying vec3 camdir, color;
- varying vec4 texcoord0;
- varying vec2 texcoord1, texcoord2;
- @(if (>= (strstr $arg1 "env") 0) [result [
- uniform samplerCube tex0;
- ]] [result [
- uniform sampler2D tex0;
- ]])
- uniform sampler2D tex1, tex2, tex3;
- void main(void)
- {
- vec3 camvec = normalize(camdir);
- @(if $specular [result [
- vec3 lightvec = normalize(lightdir);
- vec3 halfangle = normalize(camvec + lightvec);
- ]])
-
- vec2 dudv = texture2D(tex2, texcoord1).xy*2.0 - 1.0;
-
- @distort
-
- @(if $specular [result [
- float spec = pow(clamp(dot(halfangle, bump), 0.0, 1.0), 96.0);
- vec3 light = lightcolor * (1.0 - clamp(length(lightdir)/lightradius, 0.0, 1.0));
- ]])
-
- @combine
- }
- ]
-]
-
-watershader "waterglare" 1 1 [
- vec3 bump = texture2D(tex1, texcoord2 + 0.025*dudv).rgb*2.0 - 1.0;
-] [
- gl_FragColor = vec4(light*spec*spec*32.0, 0.0);
-]
-lazyshader 0 "waterglarefast" [
- //:fog
- attribute vec4 vvertex;
- uniform mat4 camprojmatrix;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- }
-] [
- void main(void)
- {
- gl_FragColor = vec4(0.0);
- }
-]
-fastshader waterglare waterglarefast 2
-altshader waterglare waterglarefast
-
-lazyshader 0 "underwater" [
- attribute vec4 vvertex;
- attribute vec3 vcolor;
- uniform mat4 camprojmatrix;
- varying vec3 color;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- color = vcolor;
- }
-] [
- //:fogrgba vec4(vec3(0.0), 1.0)
- uniform vec2 depth;
- varying vec3 color;
- void main(void)
- {
- gl_FragColor.rgb = 0.8*depth.x*color;
- gl_FragColor.a = 0.5*depth.y;
- }
-]
-
-watershader "underwaterrefract" 0 1 [
- dudv = texture2D(tex2, texcoord2 + 0.025*dudv).xy*2.0 - 1.0;
-
- gl_FragColor = texture2D(tex3, texcoord0.xy/texcoord0.w + 0.007*dudv);
-] []
-watershader "underwaterrefractfast" 0 1 [
- gl_FragColor = texture2DProj(tex3, texcoord0 + vec4(0.3*dudv, 0.0, 0.0));
-] []
-fastshader underwaterrefract underwaterrefractfast 2
-altshader underwaterrefract underwaterrefractfast
-
-watershader "underwaterfade" 0 1 [
- dudv = texture2D(tex2, texcoord2 + 0.025*dudv).xy*2.0 - 1.0;
-
- vec2 projtc = texcoord0.xy/texcoord0.w;
- float fade = texcoord0.z + 4.0*texture2D(tex3, projtc).a;
- gl_FragColor.a = fade * clamp(gl_FragCoord.z, 0.0, 1.0);
- gl_FragColor.rgb = texture2D(tex3, projtc + 0.007*dudv).rgb;
-] []
-watershader "underwaterfadefast" 0 1 [
- gl_FragColor.rgb = texture2DProj(tex3, texcoord0 + vec4(0.3*dudv, 0.0, 0.0)).rgb;
- gl_FragColor.a = texcoord0.z + 4.0*texture2DProj(tex3, texcoord0).a;
-] []
-fastshader underwaterfade underwaterfadefast 2
-altshader underwaterfade underwaterfadefast
-
-watershader "water" 1 0 [
- vec3 bump = texture2D(tex1, texcoord2 + 0.025*dudv).rgb*2.0 - 1.0;
-] [
- float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
- gl_FragColor.rgb = color*depth.x*mix(0.6, 1.0, invfresnel*0.5+0.5) + spec*light;
- gl_FragColor.a = invfresnel*depth.y;
-]
-watershader "waterfast" 0 0 [
- vec3 bump = texture2D(tex1, texcoord2 + 0.025*dudv).rgb*2.0 - 1.0;
-] [
- float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
- gl_FragColor.rgb = color*depth.x*mix(0.6, 1.0, invfresnel*0.5+0.5);
- gl_FragColor.a = invfresnel*depth.y;
-]
-fastshader water waterfast 1
-altshader water waterfast
-
-watershader "waterreflect" 1 0 [
- vec3 reflect = texture2DProj(tex0, texcoord0 + vec4(0.3*dudv, 0.0, 0.0)).rgb;
- vec3 bump = texture2D(tex1, texcoord2 + 0.025*dudv).rgb*2.0 - 1.0;
-] [
- float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
- gl_FragColor.rgb = mix(reflect, color*depth.x, invfresnel*0.5+0.5) + spec*light;
- gl_FragColor.a = invfresnel*depth.y;
-]
-watershader "waterreflectfast" 0 0 [
- vec3 reflect = texture2DProj(tex0, texcoord0 + vec4(0.3*dudv, 0.0, 0.0)).rgb;
- vec3 bump = texture2D(tex1, texcoord2 + 0.025*dudv).rgb*2.0 - 1.0;
-] [
- float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
- gl_FragColor.rgb = mix(reflect, color*depth.x, invfresnel*0.5+0.5);
- gl_FragColor.a = invfresnel*depth.y;
-]
-fastshader waterreflect waterreflectfast 2
-altshader waterreflect waterreflectfast
-
-watershader "waterrefract" 1 1 [
- vec2 dtc = texcoord2 + 0.025*dudv;
- vec3 bump = texture2D(tex1, dtc).rgb*2.0 - 1.0;
- dudv = texture2D(tex2, dtc).xy*2.0 - 1.0;
-
- vec2 rtc = texcoord0.xy/texcoord0.w + 0.007*dudv;
- vec3 reflect = texture2D(tex0, rtc).rgb;
- vec3 refract = texture2D(tex3, rtc).rgb;
-] [
- float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
- gl_FragColor = vec4(mix(reflect, refract, invfresnel*0.5+0.5) + spec*light, 0.0);
-]
-watershader "waterrefractfast" 0 1 [
- vec4 rtc = texcoord0 + vec4(0.3*dudv, 0.0, 0.0);
- vec3 reflect = texture2DProj(tex0, rtc).rgb;
- vec3 refract = texture2DProj(tex3, rtc).rgb;
- vec3 bump = texture2D(tex1, texcoord2 + 0.025*dudv).rgb*2.0 - 1.0;
-] [
- float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
- gl_FragColor = vec4(mix(reflect, refract, invfresnel*0.5+0.5), 0.0);
-]
-fastshader waterrefract waterrefractfast 2
-altshader waterrefract waterrefractfast
-
-watershader "waterfade" 1 1 [
- vec2 dtc = texcoord2 + 0.025*dudv;
- vec3 bump = texture2D(tex1, dtc).rgb*2.0 - 1.0;
- dudv = texture2D(tex2, dtc).xy*2.0 - 1.0;
-
- vec2 projtc = texcoord0.xy/texcoord0.w;
- vec2 rtc = projtc + 0.007*dudv;
- vec3 reflect = texture2D(tex0, rtc).rgb;
- vec3 refract = texture2D(tex3, rtc).rgb;
- float fade = texcoord0.z + 4.0*texture2D(tex3, projtc).a;
- gl_FragColor.a = fade * clamp(gl_FragCoord.z, 0.0, 1.0);
-] [
- float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
- gl_FragColor.rgb = mix(reflect, refract, invfresnel*0.5+0.5) + spec*light;
-]
-watershader "waterfadefast" 0 1 [
- vec4 rtc = texcoord0 + vec4(0.3*dudv, 0.0, 0.0);
- vec3 reflect = texture2DProj(tex0, rtc).rgb;
- vec3 refract = texture2DProj(tex3, rtc).rgb;
- gl_FragColor.a = texcoord0.z + 4.0*texture2DProj(tex3, texcoord0).a;
- vec3 bump = texture2D(tex1, texcoord2 + 0.025*dudv).rgb*2.0 - 1.0;
-] [
- float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
- gl_FragColor.rgb = mix(reflect, refract, invfresnel*0.5+0.5);
-]
-fastshader waterfade waterfadefast 2
-altshader waterfade waterrefract
-
-watershader "waterenv" 1 0 [
- vec3 bump = texture2D(tex1, texcoord2 + 0.025*dudv).rgb*2.0 - 1.0;
- float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
- vec3 reflect = textureCube(tex0, camvec - 2.0*invfresnel*bump).rgb;
-] [
- gl_FragColor.rgb = mix(reflect, color*depth.x, invfresnel*0.5+0.5) + spec*light;
- gl_FragColor.a = invfresnel*depth.y;
-]
-watershader "waterenvfast" 0 0 [
- vec3 bump = texture2D(tex1, texcoord2 + 0.025*dudv).rgb*2.0 - 1.0;
- float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
- vec3 reflect = textureCube(tex0, camvec - 2.0*invfresnel*bump).rgb;
-] [
- gl_FragColor.rgb = mix(reflect, color*depth.x, invfresnel*0.5+0.5);
- gl_FragColor.a = invfresnel*depth.y;
-]
-fastshader waterenv waterenvfast 2
-altshader waterenv waterenvfast
-
-watershader "waterenvrefract" 1 1 [
- vec2 dtc = texcoord2 + 0.025*dudv;
- vec3 bump = texture2D(tex1, dtc).rgb*2.0 - 1.0;
- dudv = texture2D(tex2, dtc).xy*2.0 - 1.0;
-
- vec3 refract = texture2D(tex3, texcoord0.xy/texcoord0.w + 0.007*dudv).rgb;
- float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
- vec3 reflect = textureCube(tex0, camvec - 2.0*invfresnel*bump).rgb;
-] [
- gl_FragColor = vec4(mix(reflect, refract, invfresnel*0.5+0.5) + spec*light, 0.0);
-]
-watershader "waterenvrefractfast" 0 1 [
- vec3 refract = texture2DProj(tex3, texcoord0 + vec4(0.3*dudv, 0.0, 0.0)).rgb;
- vec3 bump = texture2D(tex1, texcoord2 + 0.025*dudv).rgb*2.0 - 1.0;
- float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
- vec3 reflect = textureCube(tex0, camvec - 2.0*invfresnel*bump).rgb;
-] [
- gl_FragColor = vec4(mix(reflect, refract, invfresnel*0.5+0.5), 0.0);
-]
-fastshader waterenvrefract waterenvrefractfast 2
-altshader waterenvrefract waterenvrefractfast
-
-watershader "waterenvfade" 1 1 [
- vec2 dtc = texcoord2 + 0.025*dudv;
- vec3 bump = texture2D(tex1, dtc).rgb*2.0 - 1.0;
- dudv = texture2D(tex2, dtc).xy*2.0 - 1.0;
-
- vec2 projtc = texcoord0.xy/texcoord0.w;
- vec3 refract = texture2D(tex3, projtc + 0.007*dudv).rgb;
- float fade = texcoord0.z + 4.0*texture2D(tex3, projtc).a;
- gl_FragColor.a = fade * clamp(gl_FragCoord.z, 0.0, 1.0);
-
- float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
- vec3 reflect = textureCube(tex0, camvec - 2.0*invfresnel*bump).rgb;
-] [
- gl_FragColor.rgb = mix(reflect, refract, invfresnel*0.5+0.5) + spec*light;
-]
-watershader "waterenvfadefast" 0 1 [
- vec3 refract = texture2DProj(tex3, texcoord0 + vec4(0.3*dudv, 0.0, 0.0)).rgb;
- gl_FragColor.a = texcoord0.z + 4.0*texture2DProj(tex3, texcoord0).a;
- vec3 bump = texture2D(tex1, texcoord2 + 0.025*dudv).rgb*2.0 - 1.0;
- float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
- vec3 reflect = textureCube(tex0, camvec - 2.0*invfresnel*bump).rgb;
-] [
- gl_FragColor.rgb = mix(reflect, refract, invfresnel*0.5+0.5);
-]
-fastshader waterenvfade waterenvfadefast 2
-altshader waterenvfade waterenvrefract
-
-causticshader = [
- lazyshader 0 $arg1 [
- attribute vec4 vvertex;
- uniform mat4 camprojmatrix;
- uniform vec3 texgenS, texgenT;
- varying vec2 texcoord0;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- texcoord0 = vec2(dot(texgenS, vvertex.xyz), dot(texgenT, vvertex.xyz));
- }
- ] [
- //:fog vec3(1.0)
- uniform vec4 frameblend;
- varying vec2 texcoord0;
- uniform sampler2D tex0, tex1;
- void main(void)
- {
- @arg2
- }
- ]
-]
-causticshader caustic [
- gl_FragColor = vec4(vec3(frameblend.x*texture2D(tex0, texcoord0).r + frameblend.y*texture2D(tex1, texcoord0).r + frameblend.w), 1.0);
-]
-
-lazyshader 0 "lava" [
- //:fog
- attribute vec4 vvertex, vcolor;
- attribute vec3 vnormal;
- uniform mat4 camprojmatrix;
- varying vec4 color;
- uniform vec4 lavatexgen;
- varying vec2 texcoord0;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- color = vcolor;
- vec2 tc = mix(vvertex.xz, vvertex.yy, abs(vnormal.xz));
- texcoord0 = (tc + lavatexgen.zw) * lavatexgen.xy;
- }
-] [
- uniform sampler2D tex0;
- varying vec4 color;
- varying vec2 texcoord0;
- void main(void)
- {
- gl_FragColor = color * texture2D(tex0, texcoord0) * 2.0;
- }
-]
-
-lazyshader 0 "lavaglare" [
- //:fog
- attribute vec4 vvertex, vcolor;
- attribute vec3 vnormal;
- uniform mat4 camprojmatrix;
- varying vec4 color;
- uniform vec4 lavatexgen;
- varying vec2 texcoord0;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- color = vec4(vcolor.rgb*2.0 - 1.0, vcolor.a);
- vec2 tc = mix(vvertex.xz, vvertex.yy, abs(vnormal.xz));
- texcoord0 = (tc + lavatexgen.zw) * lavatexgen.xy;
- }
-] [
- uniform sampler2D tex0;
- varying vec4 color;
- varying vec2 texcoord0;
- void main(void)
- {
- vec4 glow = texture2D(tex0, texcoord0) * color;
- float k = max(glow.r, max(glow.g, glow.b));
- gl_FragColor = glow*k*k*32.0;
- }
-]
-
-lazyshader 0 "waterfall" [
- //:fog
- attribute vec4 vvertex, vcolor;
- attribute vec3 vnormal;
- uniform mat4 camprojmatrix;
- varying vec4 color;
- uniform vec4 waterfalltexgen;
- varying vec2 texcoord0;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- color = vcolor;
- vec2 tc = mix(vvertex.xz, vvertex.yy, abs(vnormal.xz));
- texcoord0 = (tc + waterfalltexgen.zw) * waterfalltexgen.xy;
- }
-] [
- uniform sampler2D tex0;
varying vec4 color;
- varying vec2 texcoord0;
void main(void)
{
- gl_FragColor = color * texture2D(tex0, texcoord0);
- }
-]
-
-lazyshader 0 "waterfallrefract" [
- //:fog
- attribute vec4 vvertex, vcolor;
- attribute vec3 vnormal;
- uniform mat4 camprojmatrix;
- uniform mat4 watermatrix;
- varying vec4 color;
- uniform vec4 waterfalltexgen;
- varying vec2 texcoord0;
- varying vec4 texcoord1;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- color = vcolor;
- vec2 tc = mix(vvertex.xz, vvertex.yy, abs(vnormal.xz));
- texcoord0 = (tc + waterfalltexgen.zw) * waterfalltexgen.xy;
- texcoord1 = watermatrix * vvertex;
- }
-] [
- uniform vec2 dudvoffset;
- uniform sampler2D tex0, tex2, tex4;
- varying vec4 color;
- varying vec2 texcoord0;
- varying vec4 texcoord1;
- void main(void)
- {
- vec4 diffuse = texture2D(tex0, texcoord0);
- vec2 dudv = texture2D(tex2, texcoord0 + 0.2*diffuse.xy + dudvoffset).xy;
- vec4 refract = texture2DProj(tex4, texcoord1 + vec4(4.0*dudv, 0.0, 0.0));
- gl_FragColor = mix(refract, color, diffuse);
- }
-]
-
-lazyshader 0 "waterfallenvrefract" [
- //:fog
- attribute vec4 vvertex, vcolor;
- attribute vec3 vnormal;
- uniform mat4 camprojmatrix;
- uniform mat4 watermatrix;
- uniform vec3 camera;
- varying vec4 color;
- uniform vec4 waterfalltexgen;
- varying vec2 texcoord0;
- varying vec4 texcoord1;
- varying vec3 camdir;
- varying mat3 world;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- color = vcolor;
- camdir = camera - vvertex.xyz;
- vec3 absnorm = abs(vnormal);
- world = mat3(absnorm.yzx, -absnorm.zxy, vnormal);
- vec2 tc = mix(vvertex.xz, vvertex.yy, absnorm.xz);
- texcoord0 = (tc + waterfalltexgen.zw) * waterfalltexgen.xy;
- texcoord1 = watermatrix * vvertex;
- }
-] [
- uniform vec2 dudvoffset;
- uniform sampler2D tex0, tex1, tex2, tex4;
- uniform samplerCube tex3;
- varying vec4 color;
- varying vec2 texcoord0;
- varying vec4 texcoord1;
- varying vec3 camdir;
- varying mat3 world;
- void main(void)
- {
- vec4 diffuse = texture2D(tex0, texcoord0);
- vec2 dudv = texture2D(tex2, texcoord0 + 0.2*diffuse.xy + dudvoffset).xy;
- vec3 normal = world * (texture2D(tex1, texcoord0 + 0.1*dudv).rgb*2.0 - 1.0);
- vec4 refract = texture2DProj(tex4, texcoord1 + vec4(4.0*dudv, 0.0, 0.0));
- vec3 camvec = normalize(camdir);
- float invfresnel = dot(normal, camvec);
- vec4 reflect = textureCube(tex3, 2.0*invfresnel*normal - camvec);
- gl_FragColor = mix(mix(reflect, refract, 1.0 - 0.4*step(0.0, invfresnel)), color, diffuse);
- }
-]
-altshader waterfallenvrefract waterfallrefract
-
-lazyshader 0 "waterfallenv" [
- //:fog
- attribute vec4 vvertex;
- attribute vec3 vcolor, vnormal;
- uniform mat4 camprojmatrix;
- uniform vec3 camera;
- uniform vec4 waterfalltexgen;
- varying vec2 texcoord0;
- varying vec3 color, camdir;
- varying mat3 world;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- color = vcolor;
- camdir = camera - vvertex.xyz;
- vec3 absnorm = abs(vnormal);
- world = mat3(absnorm.yzx, -absnorm.zxy, vnormal);
- vec2 tc = mix(vvertex.xz, vvertex.yy, absnorm.xz);
- texcoord0 = (tc + waterfalltexgen.zw) * waterfalltexgen.xy;
- }
-] [
- uniform vec2 dudvoffset;
- uniform sampler2D tex0, tex1, tex2;
- uniform samplerCube tex3;
- varying vec2 texcoord0;
- varying vec3 color, camdir;
- varying mat3 world;
- void main(void)
- {
- vec4 diffuse = texture2D(tex0, texcoord0);
- vec2 dudv = texture2D(tex2, texcoord0 + 0.2*diffuse.xy + dudvoffset).xy;
- vec3 normal = world * (texture2D(tex1, texcoord0 + 0.1*dudv).rgb*2.0 - 1.0);
- vec3 camvec = normalize(camdir);
- vec4 reflect = textureCube(tex3, 2.0*dot(normal, camvec)*normal - camvec);
- gl_FragColor.rgb = mix(reflect.rgb, color, diffuse.rgb);
- gl_FragColor.a = 0.25 + 0.75*diffuse.r;
- }
-]
-
-lazyshader 0 "glass" [
- attribute vec4 vvertex;
- attribute vec3 vcolor, vnormal;
- uniform mat4 camprojmatrix;
- uniform vec3 camera;
- varying vec3 color, rvec, camdir, normal;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- color = vcolor;
- normal = vnormal;
- camdir = camera - vvertex.xyz;
- rvec = 2.0*dot(camdir, vnormal) * vnormal - camdir;
- }
-] [
- //:fogrgba vec4(vec3(0.0), 1.0)
- uniform samplerCube tex0;
- varying vec3 color, rvec, camdir, normal;
- void main(void)
- {
- vec3 camvec = normalize(camdir);
- vec3 reflect = textureCube(tex0, rvec).rgb;
-
- float invfresnel = max(dot(camvec, normal), 0.70);
- gl_FragColor.rgb = mix(reflect, color*0.05, invfresnel);
- gl_FragColor.a = invfresnel * 0.95;
- }
-]
-lazyshader 0 "glassfast" [
- attribute vec4 vvertex;
- attribute vec3 vcolor, vnormal;
- uniform mat4 camprojmatrix;
- uniform vec3 camera;
- varying vec3 color, rvec;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- color = vcolor;
- vec3 camdir = camera - vvertex.xyz;
- rvec = 2.0*dot(camdir, vnormal) * vnormal - camdir;
- }
-] [
- //:fogrgba vec4(vec3(0.0), 1.0)
- uniform samplerCube tex0;
- varying vec3 color, rvec;
- void main(void)
- {
- vec3 reflect = textureCube(tex0, rvec).rgb;
- const float invfresnel = 0.75;
- gl_FragColor.rgb = mix(reflect, color*0.05, invfresnel);
- gl_FragColor.a = invfresnel * 0.95;
- }
-]
-fastshader glass glassfast 2
-altshader glass glassfast
-
-lazyshader 0 "grass" [
- attribute vec4 vvertex, vcolor;
- attribute vec2 vtexcoord0, vtexcoord1;
- attribute vec4 vtangent;
- uniform mat4 camprojmatrix;
- uniform vec3 camera;
- uniform vec3 grassmargin;
- varying vec4 color;
- varying vec2 texcoord0, texcoord1;
- varying vec2 bounds;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- color = vcolor;
- texcoord0 = vtexcoord0;
- texcoord1 = vtexcoord1 * @lmcoordscale;
- vec2 camdir = (camera.xy - vvertex.xy) * grassmargin.y;
- bounds = vec2(dot(camdir, vtangent.xy), dot(camdir, vtangent.zw)) + grassmargin.z;
- }
-] [
- //:fogrgba vec4(0.0)
- varying vec4 color;
- varying vec2 texcoord0, texcoord1;
- varying vec2 bounds;
- uniform sampler2D tex0, tex1;
- void main(void)
- {
- vec4 diffuse = texture2D(tex0, texcoord0);
- diffuse.rgb *= 2.0;
- vec4 lm = texture2D(tex1, texcoord1) * color;
- lm.rgb *= lm.a;
- float margin = clamp(min(bounds.x, bounds.y), 0.0, 1.0);
- gl_FragColor = diffuse * lm * margin;
+ gl_FragColor = color;
}
]
@@ -2633,7 +1499,6 @@ shader 0 "overbrightdecal" [
texcoord0 = vtexcoord0;
}
] [
- //:fog vec3(0.5)
varying vec4 color;
varying vec2 texcoord0;
uniform sampler2D tex0;
@@ -2645,7 +1510,6 @@ shader 0 "overbrightdecal" [
]
shader 0 "saturatedecal" [
- //:fog
attribute vec4 vvertex, vcolor;
attribute vec2 vtexcoord0;
uniform mat4 camprojmatrix;
@@ -2668,135 +1532,3 @@ shader 0 "saturatedecal" [
gl_FragColor = diffuse * color;
}
]
-
-shader 0 "skybox" [
- attribute vec4 vvertex, vcolor;
- attribute vec2 vtexcoord0;
- uniform mat4 skymatrix;
- varying vec2 texcoord0;
- varying vec4 color;
- void main(void)
- {
- gl_Position = skymatrix * vvertex;
- texcoord0 = vtexcoord0;
- color = vcolor;
- }
-] [
- varying vec2 texcoord0;
- varying vec4 color;
- uniform sampler2D tex0;
- void main(void)
- {
- gl_FragColor = color * texture2D(tex0, texcoord0);
- }
-]
-
-shader 0 "skyboxglare" [
- attribute vec4 vvertex, vcolor;
- attribute vec2 vtexcoord0;
- uniform mat4 skymatrix;
- varying vec4 color;
- varying vec2 texcoord0;
- void main(void)
- {
- gl_Position = skymatrix * vvertex;
- color = vcolor;
- texcoord0 = vtexcoord0;
- }
-] [
- varying vec4 color;
- varying vec2 texcoord0;
- uniform sampler2D tex0;
- void main(void)
- {
- vec4 glare = texture2D(tex0, texcoord0) * color;
- gl_FragColor.rgb = vec3(dot(glare.rgb, vec3(10.56, 10.88, 10.56)) - 30.4);
- gl_FragColor.a = glare.a;
- }
-]
-
-shader 0 "skyfog" [
- attribute vec4 vvertex, vcolor;
- uniform mat4 skymatrix;
- varying vec4 color;
- void main(void)
- {
- gl_Position = skymatrix * vvertex;
- color = vcolor;
- }
-] [
- varying vec4 color;
- void main(void)
- {
- gl_FragColor = color;
- }
-]
-
-loop i 2 [
- lazyshader 0 (? $i "atmosphereglare" "atmosphere") [
- attribute vec4 vvertex;
- uniform mat4 skymatrix;
- varying vec3 camvec;
- void main(void)
- {
- gl_Position = skymatrix * vvertex;
-
- camvec = vvertex.xyz;
- }
- ] [
- uniform vec4 sunlight;
- uniform vec3 sundir;
- uniform vec3 sunweight;
- uniform vec3 sundiskcolor;
- uniform vec2 sundiskparams;
- uniform vec4 opticaldepthparams;
- uniform vec3 mieparams;
- uniform vec3 betarayleigh, betamie, betaozone;
- varying vec3 camvec;
-
- void main(void)
- {
- vec3 camdir = normalize(camvec);
- float costheta = dot(camdir, sundir);
-
- // sun disk
- float edgeoffset = max(1.0 - (1.0 - max(costheta, 0.0)*costheta)*sundiskparams.x, 0.0);
- // limb darken with distance to edge
- float limbdarken = sqrt(edgeoffset);
- // lighten edges for corona, but limit it to not interfere with limb darkening
- float corona = min(edgeoffset * sundiskparams.y, 1.0);
- corona = max(0.75 / (1.5 - corona * corona) - 0.5, 0.0);
- // apply limb darkening and corona to clamped sunlight color
- vec3 sundisk = sundiskcolor * limbdarken * corona;
-
- // optical depth along view ray
- float offset = camdir.z*opticaldepthparams.w;
- vec3 depth = sqrt(offset*offset + opticaldepthparams.xyz) - offset;
- vec3 rayleighweight = betarayleigh * depth.x;
- vec3 mieweight = betamie * depth.y;
- vec3 ozoneweight = betaozone * (depth.z - depth.x);
-
- // extinction of light along view ray
- vec3 viewweight = sunweight - (rayleighweight + mieweight + ozoneweight);
- vec3 extinction = (exp2(viewweight) - 1.0) / viewweight;
-
- @(? $i [
- // only glare sundisk, excluding other scattering
- // squared (by skipping gamma encode) to limit it
- gl_FragColor = vec4(sundisk * extinction, sunlight.a);
- ] [
- // calculate in-scattering
- float rphase = (1.5 + 0.5*costheta*costheta) * (3.0 / (16.0 * 3.14159265));
- float mphase = inversesqrt(mieparams.x + mieparams.y*min(costheta, mieparams.z));
- vec3 scatter = rayleighweight * rphase + mieweight * (mphase * mphase * mphase);
-
- // combine scattering and extinction with sundisk
- vec3 inscatter = (sunlight.rgb * scatter + sundisk) * extinction;
-
- // gamma encode
- gl_FragColor = vec4(sqrt(inscatter), sunlight.a);
- ])
- }
- ]
-]
-