diff options
author | Kenneth Graunke <kenneth@whitecape.org> | 2014-07-13 20:40:05 -0700 |
---|---|---|
committer | Kenneth Graunke <kenneth@whitecape.org> | 2014-07-13 23:42:37 -0700 |
commit | 5992ff297b20897f4e933c7bcb7c109a46640928 (patch) | |
tree | 9b77a158b824028f80425718e693727cb4c57ec1 /shaders | |
parent | 73380e68e1adde97fe96a31e7c8442534a8a952c (diff) |
Import "Tesseract" shaders.
This came from a MESA_GLSL=dump report from:
https://bugs.freedesktop.org/show_bug.cgi?id=78691
So I don't know much about the details. Better than nothing.
Diffstat (limited to 'shaders')
215 files changed, 28487 insertions, 0 deletions
diff --git a/shaders/tesseract/101.shader_test b/shaders/tesseract/101.shader_test new file mode 100644 index 0000000..a5b93a5 --- /dev/null +++ b/shaders/tesseract/101.shader_test @@ -0,0 +1,52 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vcolor; + attribute vec2 vtexcoord0; + uniform mat4 camprojmatrix; + uniform vec4 colorscale; + varying vec4 color; + varying vec2 texcoord0; + void main(void) + { + gl_Position = camprojmatrix * vvertex; + color = vcolor * colorscale; + texcoord0 = vtexcoord0; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +#define gglow gl_FragData[1] +uniform sampler2D tex0; + varying vec4 color; + varying vec2 texcoord0; + fragdata(0, fragcolor, vec4) + + fragdata(1, gglow, vec4) + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + #pragma CUBE2_swizzle diffuse + + diffuse *= color; + fragcolor = diffuse; + + gglow.rgb = vec3(0.0); + gglow.a = diffuse.a; + + + } + diff --git a/shaders/tesseract/104.shader_test b/shaders/tesseract/104.shader_test new file mode 100644 index 0000000..b1e9be8 --- /dev/null +++ b/shaders/tesseract/104.shader_test @@ -0,0 +1,47 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vcolor; + attribute vec2 vtexcoord0; + uniform mat4 camprojmatrix; + uniform vec4 colorscale; + varying vec4 color; + varying vec2 texcoord0; + void main(void) + { + gl_Position = camprojmatrix * vvertex; + color = vcolor * colorscale; + texcoord0 = vtexcoord0; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2D tex0; + varying vec4 color; + varying vec2 texcoord0; + fragdata(0, fragcolor, vec4) + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + #pragma CUBE2_swizzle diffuse + + diffuse.rgb = mix(vec3(0.5), diffuse.rgb, color.rgb); + fragcolor.rgb = diffuse.rgb; + fragcolor.a = 0.5; + + + } + diff --git a/shaders/tesseract/106.shader_test b/shaders/tesseract/106.shader_test new file mode 100644 index 0000000..4e8dcd6 --- /dev/null +++ b/shaders/tesseract/106.shader_test @@ -0,0 +1,53 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vcolor; + attribute vec2 vtexcoord0; + uniform mat4 camprojmatrix; + uniform vec4 colorscale; + varying vec4 color; + varying vec2 texcoord0; + void main(void) + { + gl_Position = camprojmatrix * vvertex; + color = vcolor * colorscale; + texcoord0 = vtexcoord0; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +#define gglow gl_FragData[1] +uniform sampler2D tex0; + varying vec4 color; + varying vec2 texcoord0; + fragdata(0, fragcolor, vec4) + + fragdata(1, gglow, vec4) + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + #pragma CUBE2_swizzle diffuse + + diffuse.rgb = mix(vec3(0.5), diffuse.rgb, color.rgb); + fragcolor.rgb = diffuse.rgb; + fragcolor.a = 0.5; + + gglow.rgb = diffuse.rgb; + gglow.a = 0.5; + + + } + diff --git a/shaders/tesseract/109.shader_test b/shaders/tesseract/109.shader_test new file mode 100644 index 0000000..f495e3a --- /dev/null +++ b/shaders/tesseract/109.shader_test @@ -0,0 +1,63 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#pragma CUBE2_fog + + attribute vec4 vvertex, vcolor; + attribute vec2 vtexcoord0; + uniform mat4 camprojmatrix; + uniform vec4 colorscale; + varying vec4 color; + varying vec2 texcoord0; + +uniform vec2 lineardepthscale; +varying float lineardepth; + void main(void) + { + gl_Position = camprojmatrix * vvertex; + color = vcolor * colorscale; + texcoord0 = vtexcoord0; + +lineardepth = dot(lineardepthscale, gl_Position.zw); +} + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2D tex0; + varying vec4 color; + varying vec2 texcoord0; + fragdata(0, fragcolor, vec4) + + +varying float lineardepth; + +uniform vec3 fogcolor; +uniform vec2 fogdensity; +uniform vec4 radialfogscale; +#define fogcoord lineardepth*length(vec3(gl_FragCoord.xy*radialfogscale.xy + radialfogscale.zw, 1.0)) + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + #pragma CUBE2_swizzle diffuse + + diffuse *= color; + fragcolor = diffuse; + + + +#define FOG_COLOR fogcolor +fragcolor.rgb = mix((FOG_COLOR).rgb, fragcolor.rgb, clamp(exp2(fogcoord*-fogdensity.x)*fogdensity.y, 0.0, 1.0)); +} + diff --git a/shaders/tesseract/112.shader_test b/shaders/tesseract/112.shader_test new file mode 100644 index 0000000..610b5b4 --- /dev/null +++ b/shaders/tesseract/112.shader_test @@ -0,0 +1,51 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 camprojmatrix; + void main(void) + { + gl_Position = camprojmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0; + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + #define gfetchoffset(sampler, coords, offset) texture2DRectOffset(sampler, coords, offset) + #define gfetchproj(sampler, coords) texture2DRectProj(sampler, coords) + #define gfetchclamp(sampler, coords) texture2DRect(sampler, coords) + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + + uniform vec3 gdepthpackparams; + fragdata(0, fragcolor, vec4) + void main(void) + { + + + float depth = gdepthscale.x / (gfetch(tex0, gl_FragCoord.xy).r*gdepthscale.y + gdepthscale.z); + + + vec3 packdepth = depth * gdepthpackparams; + packdepth = vec3(packdepth.x, fract(packdepth.yz)); + packdepth.xy -= packdepth.yz * (1.0/255.0); + + + fragcolor = vec4(packdepth, 0.0); + } + diff --git a/shaders/tesseract/115.shader_test b/shaders/tesseract/115.shader_test new file mode 100644 index 0000000..f0f1e1a --- /dev/null +++ b/shaders/tesseract/115.shader_test @@ -0,0 +1,34 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + varying vec2 texcoord0; + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0; + varying vec2 texcoord0; + fragdata(0, fragcolor, vec4) + void main(void) + { + fragcolor.rgb = texture2DRect(tex0, texcoord0).rgb; + } + diff --git a/shaders/tesseract/118.shader_test b/shaders/tesseract/118.shader_test new file mode 100644 index 0000000..2c817f2 --- /dev/null +++ b/shaders/tesseract/118.shader_test @@ -0,0 +1,34 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + varying vec2 texcoord0; + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0; + varying vec2 texcoord0; + fragdata(0, fragcolor, vec4) + void main(void) + { + fragcolor.rgb = 0.5*(texture2DRectOffset(tex0, texcoord0, ivec2(-1, 0)).rgb + texture2DRectOffset(tex0, texcoord0, ivec2(1, 0)).rgb); + } + diff --git a/shaders/tesseract/12.shader_test b/shaders/tesseract/12.shader_test new file mode 100644 index 0000000..4bcd9a7 --- /dev/null +++ b/shaders/tesseract/12.shader_test @@ -0,0 +1,30 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vcolor; +uniform mat4 hudmatrix;varying vec4 color; +void main(void) { + gl_Position = hudmatrix * vvertex; + color = vcolor; +} + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +varying vec4 color; +fragdata(0, fragcolor, vec4) +void main(void) { + fragcolor = color; +} + diff --git a/shaders/tesseract/121.shader_test b/shaders/tesseract/121.shader_test new file mode 100644 index 0000000..a69ae6e --- /dev/null +++ b/shaders/tesseract/121.shader_test @@ -0,0 +1,35 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + varying vec2 texcoord0; + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0; + varying vec2 texcoord0; + fragdata(0, fragcolor, vec4) + void main(void) + { + fragcolor.rgb = 0.25*(texture2DRectOffset(tex0, texcoord0, ivec2(-1, -1)).rgb + texture2DRectOffset(tex0, texcoord0, ivec2(1, -1)).rgb + + texture2DRectOffset(tex0, texcoord0, ivec2(1, 1)).rgb + texture2DRectOffset(tex0, texcoord0, ivec2(-1, 1)).rgb); + } + diff --git a/shaders/tesseract/124.shader_test b/shaders/tesseract/124.shader_test new file mode 100644 index 0000000..a1f25f5 --- /dev/null +++ b/shaders/tesseract/124.shader_test @@ -0,0 +1,41 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + varying vec2 texcoord0; + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0; + uniform vec2 hdrgamma; + varying vec2 texcoord0; + fragdata(0, fragcolor, vec4) + void main(void) + { + vec3 color = texture2DRect(tex0, texcoord0).rgb*2.0; + + color *= color; + + float lum = dot(color, vec3(0.2126, 0.7152, 0.0722)); + float loglum = sqrt(clamp(lum, 0.015625, 4.0)) * (1.0/2.0); + fragcolor.rgb = vec3(loglum); + } + diff --git a/shaders/tesseract/127.shader_test b/shaders/tesseract/127.shader_test new file mode 100644 index 0000000..68b3f22 --- /dev/null +++ b/shaders/tesseract/127.shader_test @@ -0,0 +1,50 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + varying vec2 texcoord0; + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0; + uniform vec2 hdrgamma; + varying vec2 texcoord0; + fragdata(0, fragcolor, vec4) + void main(void) + { + + vec3 color0 = texture2DRectOffset(tex0, texcoord0, ivec2(-1, 0)).rgb*2.0; + + color0 *= color0; + + float lum0 = dot(color0, vec3(0.2126, 0.7152, 0.0722)); + float loglum0 = sqrt(clamp(lum0, 0.015625, 4.0)) * (1.0/2.0); + + vec3 color1 = texture2DRectOffset(tex0, texcoord0, ivec2(1, 0)).rgb*2.0; + + color1 *= color1; + + float lum1 = dot(color1, vec3(0.2126, 0.7152, 0.0722)); + float loglum1 = sqrt(clamp(lum1, 0.015625, 4.0)) * (1.0/2.0); + + fragcolor.rgb = vec3(0.5*(loglum0 + loglum1)); + } + diff --git a/shaders/tesseract/130.shader_test b/shaders/tesseract/130.shader_test new file mode 100644 index 0000000..6823056 --- /dev/null +++ b/shaders/tesseract/130.shader_test @@ -0,0 +1,64 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + varying vec2 texcoord0; + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0; + uniform vec2 hdrgamma; + varying vec2 texcoord0; + fragdata(0, fragcolor, vec4) + void main(void) + { + + vec3 color0 = texture2DRectOffset(tex0, texcoord0, ivec2(-1, -1)).rgb*2.0; + + color0 *= color0; + + float lum0 = dot(color0, vec3(0.2126, 0.7152, 0.0722)); + float loglum0 = sqrt(clamp(lum0, 0.015625, 4.0)) * (1.0/2.0); + + vec3 color1 = texture2DRectOffset(tex0, texcoord0, ivec2(1, -1)).rgb*2.0; + + color1 *= color1; + + float lum1 = dot(color1, vec3(0.2126, 0.7152, 0.0722)); + float loglum1 = sqrt(clamp(lum1, 0.015625, 4.0)) * (1.0/2.0); + + vec3 color2 = texture2DRectOffset(tex0, texcoord0, ivec2(1, 1)).rgb*2.0; + + color2 *= color2; + + float lum2 = dot(color2, vec3(0.2126, 0.7152, 0.0722)); + float loglum2 = sqrt(clamp(lum2, 0.015625, 4.0)) * (1.0/2.0); + + vec3 color3 = texture2DRectOffset(tex0, texcoord0, ivec2(-1, 1)).rgb*2.0; + + color3 *= color3; + + float lum3 = dot(color3, vec3(0.2126, 0.7152, 0.0722)); + float loglum3 = sqrt(clamp(lum3, 0.015625, 4.0)) * (1.0/2.0); + + fragcolor.rgb = vec3(0.25*(loglum0 + loglum1 + loglum2 + loglum3)); + } + diff --git a/shaders/tesseract/133.shader_test b/shaders/tesseract/133.shader_test new file mode 100644 index 0000000..68da955 --- /dev/null +++ b/shaders/tesseract/133.shader_test @@ -0,0 +1,33 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + void main(void) + { + gl_Position = vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0; + uniform float accumscale; + fragdata(0, fragcolor, vec4) + void main(void) + { + float lum = texture2DRect(tex0, vec2(0.5, 0.5)).r * 2.0; + lum *= lum; + fragcolor = vec4(vec3(lum*0.25), accumscale); + } + diff --git a/shaders/tesseract/136.shader_test b/shaders/tesseract/136.shader_test new file mode 100644 index 0000000..b004e10 --- /dev/null +++ b/shaders/tesseract/136.shader_test @@ -0,0 +1,53 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + + uniform sampler2D tex2; + + uniform vec4 hdrparams; + varying vec2 texcoord0; + flat varying float lumscale, lumthreshold; + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + float avglum = 4.0 * texture2D(tex2, vec2(0.5, 0.5)).r; + lumscale = hdrparams.x * -log2(1.0 - clamp(avglum, 0.03, 0.3))/(avglum + 1e-4); + lumthreshold = -log2(1.0 - hdrparams.z); + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0; + uniform vec2 hdrgamma; + varying vec2 texcoord0; + flat varying float lumscale, lumthreshold; + fragdata(0, fragcolor, vec4) + void main(void) + { + vec3 color = texture2DRect(tex0, texcoord0).rgb*2.0; + + color *= color; + + float lum = dot(color, vec3(0.2126, 0.7152, 0.0722)); + color *= max(lum*lumscale - lumthreshold, 0.0) / (lum + 1e-4); + + color = sqrt(color); + + fragcolor.rgb = color; + } + diff --git a/shaders/tesseract/139.shader_test b/shaders/tesseract/139.shader_test new file mode 100644 index 0000000..9a10484 --- /dev/null +++ b/shaders/tesseract/139.shader_test @@ -0,0 +1,37 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + varying vec2 texcoord0; + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0; + varying vec2 texcoord0; + fragdata(0, fragcolor, vec4) + void main(void) + { + vec3 color = texture2DRect(tex0, texcoord0).rgb; + fragcolor.rgb = color; + + fragcolor.a = 0.0; + } + diff --git a/shaders/tesseract/142.shader_test b/shaders/tesseract/142.shader_test new file mode 100644 index 0000000..517256b --- /dev/null +++ b/shaders/tesseract/142.shader_test @@ -0,0 +1,65 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0, vtexcoord1; + + uniform sampler2D tex2; + + uniform vec4 hdrparams; + varying vec2 texcoord0, texcoord1; + flat varying float lumscale, lumsaturate; + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + texcoord1 = vtexcoord1; + float avglum = 4.0 * texture2D(tex2, vec2(0.5, 0.5)).r; + lumscale = hdrparams.x * -log2(1.0 - clamp(avglum, 0.03, 0.3))/(avglum + 1e-4); + lumsaturate = -log2(1.0 - hdrparams.y) / lumscale; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1; + + uniform vec4 hdrparams; + uniform vec2 hdrgamma; + varying vec2 texcoord0, texcoord1; + flat varying float lumscale, lumsaturate; + + fragdata(0, fragcolor, vec4) + void main(void) + { + vec3 bloom = texture2DRect(tex1, texcoord1).rgb*hdrparams.w; + vec3 color = texture2DRect(tex0, texcoord0).rgb*2.0; + color += bloom; + + color *= color; + + { + + float lum = dot(color, vec3(0.2126, 0.7152, 0.0722)); + color = min(color, lumsaturate); + color *= (1.0 - exp2(-lum*lumscale)) / (dot(color, vec3(0.2126, 0.7152, 0.0722)) + 1e-4); + } + + color = sqrt(color); + + fragcolor.rgb = color; + + fragcolor.a = 0.0; + } + diff --git a/shaders/tesseract/145.shader_test b/shaders/tesseract/145.shader_test new file mode 100644 index 0000000..7193b5f --- /dev/null +++ b/shaders/tesseract/145.shader_test @@ -0,0 +1,41 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vcolor; + attribute vec2 vtexcoord0; + uniform mat4 skymatrix; + uniform float ldrscale; + varying vec4 colorscale; + varying vec2 texcoord0; + void main(void) + { + gl_Position = skymatrix * vvertex; + texcoord0 = vtexcoord0; + colorscale = vec4(ldrscale * vcolor.rgb, vcolor.a); + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2D tex0; + varying vec4 colorscale; + varying vec2 texcoord0; + fragdata(0, fragcolor, vec4) + void main(void) + { + vec4 color = texture2D(tex0, texcoord0); + #pragma CUBE2_swizzle color + fragcolor = colorscale * color; + } + diff --git a/shaders/tesseract/148.shader_test b/shaders/tesseract/148.shader_test new file mode 100644 index 0000000..0d29185 --- /dev/null +++ b/shaders/tesseract/148.shader_test @@ -0,0 +1,46 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vcolor; + attribute vec2 vtexcoord0; + uniform mat4 skymatrix; + uniform float ldrscale; + varying vec4 colorscale; + varying vec2 texcoord0; + void main(void) + { + gl_Position = skymatrix * vvertex; + texcoord0 = vtexcoord0; + colorscale = vec4(ldrscale * vcolor.rgb, vcolor.a); + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2D tex0; + uniform vec3 overbrightparams; + uniform float ldrscale; + varying vec4 colorscale; + varying vec2 texcoord0; + fragdata(0, fragcolor, vec4) + void main(void) + { + vec4 color = texture2D(tex0, texcoord0); + #pragma CUBE2_swizzle color + float lum = dot(vec3(0.2126, 0.7152, 0.0722), color.rgb); + float overbright = mix(overbrightparams.x, overbrightparams.y, clamp(lum - overbrightparams.z, 0.0, 1.0)); + color.rgb *= overbright; + fragcolor = colorscale * color; + } + diff --git a/shaders/tesseract/15.shader_test b/shaders/tesseract/15.shader_test new file mode 100644 index 0000000..7416935 --- /dev/null +++ b/shaders/tesseract/15.shader_test @@ -0,0 +1,29 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + void main(void) + { + gl_Position = vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +fragdata(0, fragcolor, vec4) + void main(void) + { + fragcolor = vec4(1.0, 0.0, 1.0, 1.0); + } + diff --git a/shaders/tesseract/151.shader_test b/shaders/tesseract/151.shader_test new file mode 100644 index 0000000..6dcb37f --- /dev/null +++ b/shaders/tesseract/151.shader_test @@ -0,0 +1,98 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 sunmatrix; + varying vec3 camvec; + void main(void) + { + gl_Position = vvertex; + + vec4 p = sunmatrix * vvertex; + camvec = p.xyz / p.w; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform vec3 sunlight; + uniform vec3 sundir; + uniform vec3 sundiskparams; + uniform vec3 atmoradius; + uniform float gm; + uniform vec3 betar, betam, betarm; + uniform vec2 hdrgamma; + uniform float atmoalpha; + varying vec3 camvec; + fragdata(0, fragcolor, vec4) + + vec3 calcextinction(float dist) + { + return exp2(-dist * betarm); + } + + vec3 calcscatter(float costheta) + { + float rphase = 1.0 + costheta*costheta; + float mphase = pow(1.0 + gm*(gm - 2.0*costheta), -1.5); + return betar*rphase + betam*mphase; + } + + float baseopticaldepth(vec3 ray) + { + float a = atmoradius.x * max(ray.z, min(sundir.z, 0.0)); + return sqrt(a*a + atmoradius.z) - a; + } + + float opticaldepth(vec3 pos, vec3 ray) + { + pos.z = max(pos.z, 0.0) + atmoradius.x; + float a = dot(pos, ray); + return sqrt(a*a + atmoradius.y - dot(pos, pos)) - a; + } + + void main(void) + { + vec3 camdir = normalize(camvec); + float costheta = dot(camdir, sundir); + + + float raydist = baseopticaldepth(camdir); + + + vec3 extinction = calcextinction(raydist); + + + float lightraydist = opticaldepth(camdir * (raydist * max(0.15 + 0.75 * sundir.z, 0.0)), sundir); + + + vec3 incominglight = calcextinction(lightraydist); + + + vec3 scattering = calcscatter(costheta) * (1.0 - extinction); + + + vec3 inscatter = incominglight * scattering; + + + vec3 sundisk = sundiskparams.z * extinction * pow(clamp(costheta*sundiskparams.x + sundiskparams.y, 0.0, 1.0), 8.0); + + inscatter += sundisk; + + inscatter = sqrt(inscatter); + + + fragcolor = vec4(sunlight * inscatter, atmoalpha); + } + diff --git a/shaders/tesseract/154.shader_test b/shaders/tesseract/154.shader_test new file mode 100644 index 0000000..f7635b8 --- /dev/null +++ b/shaders/tesseract/154.shader_test @@ -0,0 +1,35 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vcolor; + uniform mat4 skymatrix; + uniform float ldrscale; + varying vec4 color; + void main(void) + { + gl_Position = skymatrix * vvertex; + color = vec4(ldrscale * vcolor.rgb, vcolor.a); + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2D tex0; + varying vec4 color; + fragdata(0, fragcolor, vec4) + void main(void) + { + fragcolor = color; + } + diff --git a/shaders/tesseract/157.shader_test b/shaders/tesseract/157.shader_test new file mode 100644 index 0000000..b2da6ed --- /dev/null +++ b/shaders/tesseract/157.shader_test @@ -0,0 +1,36 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + varying vec2 texcoord0; + + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0; + varying vec2 texcoord0; + fragdata(0, fragcolor, vec4) + + void main(void) + { + fragcolor = texture2DRect(tex0, texcoord0); + } + diff --git a/shaders/tesseract/160.shader_test b/shaders/tesseract/160.shader_test new file mode 100644 index 0000000..12cca92 --- /dev/null +++ b/shaders/tesseract/160.shader_test @@ -0,0 +1,50 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + uniform float offsets[8]; + varying vec2 texcoord0, texcoord1, texcoord2; + + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + vec2 tc1 = vtexcoord0.xy, tc2 = vtexcoord0; + tc1.x += offsets[1]; + tc2.x -= offsets[1]; + texcoord1 = tc1; + texcoord2 = tc2; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform float weights[8]; + uniform float offsets[8]; + uniform sampler2D tex0; + varying vec2 texcoord0, texcoord1, texcoord2; + + fragdata(0, fragcolor, vec4) + void main(void) + { + #define texval(coords) texture2D(tex0, (coords)) + vec4 val = texval(texcoord0) * weights[0]; + + val += weights[1] * (texval(texcoord1) + texval(texcoord2)); + + fragcolor = val; + } + diff --git a/shaders/tesseract/163.shader_test b/shaders/tesseract/163.shader_test new file mode 100644 index 0000000..adabb2c --- /dev/null +++ b/shaders/tesseract/163.shader_test @@ -0,0 +1,50 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + uniform float offsets[8]; + varying vec2 texcoord0, texcoord1, texcoord2; + + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + vec2 tc1 = vtexcoord0.xy, tc2 = vtexcoord0; + tc1.y += offsets[1]; + tc2.y -= offsets[1]; + texcoord1 = tc1; + texcoord2 = tc2; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform float weights[8]; + uniform float offsets[8]; + uniform sampler2D tex0; + varying vec2 texcoord0, texcoord1, texcoord2; + + fragdata(0, fragcolor, vec4) + void main(void) + { + #define texval(coords) texture2D(tex0, (coords)) + vec4 val = texval(texcoord0) * weights[0]; + + val += weights[1] * (texval(texcoord1) + texval(texcoord2)); + + fragcolor = val; + } + diff --git a/shaders/tesseract/166.shader_test b/shaders/tesseract/166.shader_test new file mode 100644 index 0000000..3b69b66 --- /dev/null +++ b/shaders/tesseract/166.shader_test @@ -0,0 +1,50 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + uniform float offsets[8]; + varying vec2 texcoord0, texcoord1, texcoord2; + + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + vec2 tc1 = vtexcoord0.xy, tc2 = vtexcoord0; + tc1.x += offsets[1]; + tc2.x -= offsets[1]; + texcoord1 = tc1; + texcoord2 = tc2; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform float weights[8]; + uniform float offsets[8]; + uniform sampler2DRect tex0; + varying vec2 texcoord0, texcoord1, texcoord2; + + fragdata(0, fragcolor, vec4) + void main(void) + { + #define texval(coords) texture2DRect(tex0, (coords)) + vec4 val = texval(texcoord0) * weights[0]; + + val += weights[1] * (texval(texcoord1) + texval(texcoord2)); + + fragcolor = val; + } + diff --git a/shaders/tesseract/169.shader_test b/shaders/tesseract/169.shader_test new file mode 100644 index 0000000..4054712 --- /dev/null +++ b/shaders/tesseract/169.shader_test @@ -0,0 +1,50 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + uniform float offsets[8]; + varying vec2 texcoord0, texcoord1, texcoord2; + + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + vec2 tc1 = vtexcoord0.xy, tc2 = vtexcoord0; + tc1.y += offsets[1]; + tc2.y -= offsets[1]; + texcoord1 = tc1; + texcoord2 = tc2; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform float weights[8]; + uniform float offsets[8]; + uniform sampler2DRect tex0; + varying vec2 texcoord0, texcoord1, texcoord2; + + fragdata(0, fragcolor, vec4) + void main(void) + { + #define texval(coords) texture2DRect(tex0, (coords)) + vec4 val = texval(texcoord0) * weights[0]; + + val += weights[1] * (texval(texcoord1) + texval(texcoord2)); + + fragcolor = val; + } + diff --git a/shaders/tesseract/172.shader_test b/shaders/tesseract/172.shader_test new file mode 100644 index 0000000..2c620ff --- /dev/null +++ b/shaders/tesseract/172.shader_test @@ -0,0 +1,61 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + uniform float offsets[8]; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + vec2 tc1 = vtexcoord0.xy, tc2 = vtexcoord0; + tc1.x += offsets[1]; + tc2.x -= offsets[1]; + texcoord1 = tc1; + texcoord2 = tc2; + + tc1.x = vtexcoord0.x + offsets[2]; + tc2.x = vtexcoord0.x - offsets[2]; + texcoord3 = tc1; + texcoord4 = tc2; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform float weights[8]; + uniform float offsets[8]; + uniform sampler2D tex0; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + fragdata(0, fragcolor, vec4) + void main(void) + { + #define texval(coords) texture2D(tex0, (coords)) + vec4 val = texval(texcoord0) * weights[0]; + + val += weights[1] * (texval(texcoord1) + texval(texcoord2)); + + val += weights[2] * (texval(texcoord3) + texval(texcoord4)); + + fragcolor = val; + } + diff --git a/shaders/tesseract/175.shader_test b/shaders/tesseract/175.shader_test new file mode 100644 index 0000000..899a9c3 --- /dev/null +++ b/shaders/tesseract/175.shader_test @@ -0,0 +1,61 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + uniform float offsets[8]; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + vec2 tc1 = vtexcoord0.xy, tc2 = vtexcoord0; + tc1.y += offsets[1]; + tc2.y -= offsets[1]; + texcoord1 = tc1; + texcoord2 = tc2; + + tc1.y = vtexcoord0.y + offsets[2]; + tc2.y = vtexcoord0.y - offsets[2]; + texcoord3 = tc1; + texcoord4 = tc2; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform float weights[8]; + uniform float offsets[8]; + uniform sampler2D tex0; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + fragdata(0, fragcolor, vec4) + void main(void) + { + #define texval(coords) texture2D(tex0, (coords)) + vec4 val = texval(texcoord0) * weights[0]; + + val += weights[1] * (texval(texcoord1) + texval(texcoord2)); + + val += weights[2] * (texval(texcoord3) + texval(texcoord4)); + + fragcolor = val; + } + diff --git a/shaders/tesseract/178.shader_test b/shaders/tesseract/178.shader_test new file mode 100644 index 0000000..e848fb8 --- /dev/null +++ b/shaders/tesseract/178.shader_test @@ -0,0 +1,61 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + uniform float offsets[8]; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + vec2 tc1 = vtexcoord0.xy, tc2 = vtexcoord0; + tc1.x += offsets[1]; + tc2.x -= offsets[1]; + texcoord1 = tc1; + texcoord2 = tc2; + + tc1.x = vtexcoord0.x + offsets[2]; + tc2.x = vtexcoord0.x - offsets[2]; + texcoord3 = tc1; + texcoord4 = tc2; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform float weights[8]; + uniform float offsets[8]; + uniform sampler2DRect tex0; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + fragdata(0, fragcolor, vec4) + void main(void) + { + #define texval(coords) texture2DRect(tex0, (coords)) + vec4 val = texval(texcoord0) * weights[0]; + + val += weights[1] * (texval(texcoord1) + texval(texcoord2)); + + val += weights[2] * (texval(texcoord3) + texval(texcoord4)); + + fragcolor = val; + } + diff --git a/shaders/tesseract/18.shader_test b/shaders/tesseract/18.shader_test new file mode 100644 index 0000000..3c7e988 --- /dev/null +++ b/shaders/tesseract/18.shader_test @@ -0,0 +1,22 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 camprojmatrix; + void main() { gl_Position = camprojmatrix * vvertex; } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +void main() {} + diff --git a/shaders/tesseract/181.shader_test b/shaders/tesseract/181.shader_test new file mode 100644 index 0000000..da43648 --- /dev/null +++ b/shaders/tesseract/181.shader_test @@ -0,0 +1,61 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + uniform float offsets[8]; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + vec2 tc1 = vtexcoord0.xy, tc2 = vtexcoord0; + tc1.y += offsets[1]; + tc2.y -= offsets[1]; + texcoord1 = tc1; + texcoord2 = tc2; + + tc1.y = vtexcoord0.y + offsets[2]; + tc2.y = vtexcoord0.y - offsets[2]; + texcoord3 = tc1; + texcoord4 = tc2; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform float weights[8]; + uniform float offsets[8]; + uniform sampler2DRect tex0; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + fragdata(0, fragcolor, vec4) + void main(void) + { + #define texval(coords) texture2DRect(tex0, (coords)) + vec4 val = texval(texcoord0) * weights[0]; + + val += weights[1] * (texval(texcoord1) + texval(texcoord2)); + + val += weights[2] * (texval(texcoord3) + texval(texcoord4)); + + fragcolor = val; + } + diff --git a/shaders/tesseract/184.shader_test b/shaders/tesseract/184.shader_test new file mode 100644 index 0000000..e3330ca --- /dev/null +++ b/shaders/tesseract/184.shader_test @@ -0,0 +1,72 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + uniform float offsets[8]; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + vec2 tc1 = vtexcoord0.xy, tc2 = vtexcoord0; + tc1.x += offsets[1]; + tc2.x -= offsets[1]; + texcoord1 = tc1; + texcoord2 = tc2; + + tc1.x = vtexcoord0.x + offsets[2]; + tc2.x = vtexcoord0.x - offsets[2]; + texcoord3 = tc1; + texcoord4 = tc2; + + tc1.x = vtexcoord0.x + offsets[3]; + tc2.x = vtexcoord0.x - offsets[3]; + texcoord5 = tc1; + texcoord6 = tc2; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform float weights[8]; + uniform float offsets[8]; + uniform sampler2D tex0; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + fragdata(0, fragcolor, vec4) + void main(void) + { + #define texval(coords) texture2D(tex0, (coords)) + vec4 val = texval(texcoord0) * weights[0]; + + val += weights[1] * (texval(texcoord1) + texval(texcoord2)); + + val += weights[2] * (texval(texcoord3) + texval(texcoord4)); + + val += weights[3] * (texval(texcoord5) + texval(texcoord6)); + + fragcolor = val; + } + diff --git a/shaders/tesseract/187.shader_test b/shaders/tesseract/187.shader_test new file mode 100644 index 0000000..dd94304 --- /dev/null +++ b/shaders/tesseract/187.shader_test @@ -0,0 +1,72 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + uniform float offsets[8]; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + vec2 tc1 = vtexcoord0.xy, tc2 = vtexcoord0; + tc1.y += offsets[1]; + tc2.y -= offsets[1]; + texcoord1 = tc1; + texcoord2 = tc2; + + tc1.y = vtexcoord0.y + offsets[2]; + tc2.y = vtexcoord0.y - offsets[2]; + texcoord3 = tc1; + texcoord4 = tc2; + + tc1.y = vtexcoord0.y + offsets[3]; + tc2.y = vtexcoord0.y - offsets[3]; + texcoord5 = tc1; + texcoord6 = tc2; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform float weights[8]; + uniform float offsets[8]; + uniform sampler2D tex0; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + fragdata(0, fragcolor, vec4) + void main(void) + { + #define texval(coords) texture2D(tex0, (coords)) + vec4 val = texval(texcoord0) * weights[0]; + + val += weights[1] * (texval(texcoord1) + texval(texcoord2)); + + val += weights[2] * (texval(texcoord3) + texval(texcoord4)); + + val += weights[3] * (texval(texcoord5) + texval(texcoord6)); + + fragcolor = val; + } + diff --git a/shaders/tesseract/190.shader_test b/shaders/tesseract/190.shader_test new file mode 100644 index 0000000..55f231a --- /dev/null +++ b/shaders/tesseract/190.shader_test @@ -0,0 +1,72 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + uniform float offsets[8]; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + vec2 tc1 = vtexcoord0.xy, tc2 = vtexcoord0; + tc1.x += offsets[1]; + tc2.x -= offsets[1]; + texcoord1 = tc1; + texcoord2 = tc2; + + tc1.x = vtexcoord0.x + offsets[2]; + tc2.x = vtexcoord0.x - offsets[2]; + texcoord3 = tc1; + texcoord4 = tc2; + + tc1.x = vtexcoord0.x + offsets[3]; + tc2.x = vtexcoord0.x - offsets[3]; + texcoord5 = tc1; + texcoord6 = tc2; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform float weights[8]; + uniform float offsets[8]; + uniform sampler2DRect tex0; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + fragdata(0, fragcolor, vec4) + void main(void) + { + #define texval(coords) texture2DRect(tex0, (coords)) + vec4 val = texval(texcoord0) * weights[0]; + + val += weights[1] * (texval(texcoord1) + texval(texcoord2)); + + val += weights[2] * (texval(texcoord3) + texval(texcoord4)); + + val += weights[3] * (texval(texcoord5) + texval(texcoord6)); + + fragcolor = val; + } + diff --git a/shaders/tesseract/193.shader_test b/shaders/tesseract/193.shader_test new file mode 100644 index 0000000..4ab27fe --- /dev/null +++ b/shaders/tesseract/193.shader_test @@ -0,0 +1,72 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + uniform float offsets[8]; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + vec2 tc1 = vtexcoord0.xy, tc2 = vtexcoord0; + tc1.y += offsets[1]; + tc2.y -= offsets[1]; + texcoord1 = tc1; + texcoord2 = tc2; + + tc1.y = vtexcoord0.y + offsets[2]; + tc2.y = vtexcoord0.y - offsets[2]; + texcoord3 = tc1; + texcoord4 = tc2; + + tc1.y = vtexcoord0.y + offsets[3]; + tc2.y = vtexcoord0.y - offsets[3]; + texcoord5 = tc1; + texcoord6 = tc2; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform float weights[8]; + uniform float offsets[8]; + uniform sampler2DRect tex0; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + fragdata(0, fragcolor, vec4) + void main(void) + { + #define texval(coords) texture2DRect(tex0, (coords)) + vec4 val = texval(texcoord0) * weights[0]; + + val += weights[1] * (texval(texcoord1) + texval(texcoord2)); + + val += weights[2] * (texval(texcoord3) + texval(texcoord4)); + + val += weights[3] * (texval(texcoord5) + texval(texcoord6)); + + fragcolor = val; + } + diff --git a/shaders/tesseract/196.shader_test b/shaders/tesseract/196.shader_test new file mode 100644 index 0000000..930ec8f --- /dev/null +++ b/shaders/tesseract/196.shader_test @@ -0,0 +1,77 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + uniform float offsets[8]; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + vec2 tc1 = vtexcoord0.xy, tc2 = vtexcoord0; + tc1.x += offsets[1]; + tc2.x -= offsets[1]; + texcoord1 = tc1; + texcoord2 = tc2; + + tc1.x = vtexcoord0.x + offsets[2]; + tc2.x = vtexcoord0.x - offsets[2]; + texcoord3 = tc1; + texcoord4 = tc2; + + tc1.x = vtexcoord0.x + offsets[3]; + tc2.x = vtexcoord0.x - offsets[3]; + texcoord5 = tc1; + texcoord6 = tc2; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform float weights[8]; + uniform float offsets[8]; + uniform sampler2D tex0; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + fragdata(0, fragcolor, vec4) + void main(void) + { + #define texval(coords) texture2D(tex0, (coords)) + vec4 val = texval(texcoord0) * weights[0]; + + val += weights[1] * (texval(texcoord1) + texval(texcoord2)); + + val += weights[2] * (texval(texcoord3) + texval(texcoord4)); + + val += weights[3] * (texval(texcoord5) + texval(texcoord6)); + + val += weights[4] * + + (texval(vec2(texcoord0.x + offsets[4], texcoord0.y)) + texval(vec2(texcoord0.x - offsets[4], texcoord0.y))); + + + fragcolor = val; + } + diff --git a/shaders/tesseract/199.shader_test b/shaders/tesseract/199.shader_test new file mode 100644 index 0000000..60a699e --- /dev/null +++ b/shaders/tesseract/199.shader_test @@ -0,0 +1,77 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + uniform float offsets[8]; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + vec2 tc1 = vtexcoord0.xy, tc2 = vtexcoord0; + tc1.y += offsets[1]; + tc2.y -= offsets[1]; + texcoord1 = tc1; + texcoord2 = tc2; + + tc1.y = vtexcoord0.y + offsets[2]; + tc2.y = vtexcoord0.y - offsets[2]; + texcoord3 = tc1; + texcoord4 = tc2; + + tc1.y = vtexcoord0.y + offsets[3]; + tc2.y = vtexcoord0.y - offsets[3]; + texcoord5 = tc1; + texcoord6 = tc2; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform float weights[8]; + uniform float offsets[8]; + uniform sampler2D tex0; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + fragdata(0, fragcolor, vec4) + void main(void) + { + #define texval(coords) texture2D(tex0, (coords)) + vec4 val = texval(texcoord0) * weights[0]; + + val += weights[1] * (texval(texcoord1) + texval(texcoord2)); + + val += weights[2] * (texval(texcoord3) + texval(texcoord4)); + + val += weights[3] * (texval(texcoord5) + texval(texcoord6)); + + val += weights[4] * + + (texval(vec2(texcoord0.x, texcoord0.y + offsets[4])) + texval(vec2(texcoord0.x, texcoord0.y - offsets[4]))); + + + fragcolor = val; + } + diff --git a/shaders/tesseract/202.shader_test b/shaders/tesseract/202.shader_test new file mode 100644 index 0000000..cebb638 --- /dev/null +++ b/shaders/tesseract/202.shader_test @@ -0,0 +1,77 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + uniform float offsets[8]; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + vec2 tc1 = vtexcoord0.xy, tc2 = vtexcoord0; + tc1.x += offsets[1]; + tc2.x -= offsets[1]; + texcoord1 = tc1; + texcoord2 = tc2; + + tc1.x = vtexcoord0.x + offsets[2]; + tc2.x = vtexcoord0.x - offsets[2]; + texcoord3 = tc1; + texcoord4 = tc2; + + tc1.x = vtexcoord0.x + offsets[3]; + tc2.x = vtexcoord0.x - offsets[3]; + texcoord5 = tc1; + texcoord6 = tc2; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform float weights[8]; + uniform float offsets[8]; + uniform sampler2DRect tex0; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + fragdata(0, fragcolor, vec4) + void main(void) + { + #define texval(coords) texture2DRect(tex0, (coords)) + vec4 val = texval(texcoord0) * weights[0]; + + val += weights[1] * (texval(texcoord1) + texval(texcoord2)); + + val += weights[2] * (texval(texcoord3) + texval(texcoord4)); + + val += weights[3] * (texval(texcoord5) + texval(texcoord6)); + + val += weights[4] * + + (texval(vec2(texcoord0.x + offsets[4], texcoord0.y)) + texval(vec2(texcoord0.x - offsets[4], texcoord0.y))); + + + fragcolor = val; + } + diff --git a/shaders/tesseract/205.shader_test b/shaders/tesseract/205.shader_test new file mode 100644 index 0000000..cbcd7f6 --- /dev/null +++ b/shaders/tesseract/205.shader_test @@ -0,0 +1,77 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + uniform float offsets[8]; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + vec2 tc1 = vtexcoord0.xy, tc2 = vtexcoord0; + tc1.y += offsets[1]; + tc2.y -= offsets[1]; + texcoord1 = tc1; + texcoord2 = tc2; + + tc1.y = vtexcoord0.y + offsets[2]; + tc2.y = vtexcoord0.y - offsets[2]; + texcoord3 = tc1; + texcoord4 = tc2; + + tc1.y = vtexcoord0.y + offsets[3]; + tc2.y = vtexcoord0.y - offsets[3]; + texcoord5 = tc1; + texcoord6 = tc2; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform float weights[8]; + uniform float offsets[8]; + uniform sampler2DRect tex0; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + fragdata(0, fragcolor, vec4) + void main(void) + { + #define texval(coords) texture2DRect(tex0, (coords)) + vec4 val = texval(texcoord0) * weights[0]; + + val += weights[1] * (texval(texcoord1) + texval(texcoord2)); + + val += weights[2] * (texval(texcoord3) + texval(texcoord4)); + + val += weights[3] * (texval(texcoord5) + texval(texcoord6)); + + val += weights[4] * + + (texval(vec2(texcoord0.x, texcoord0.y + offsets[4])) + texval(vec2(texcoord0.x, texcoord0.y - offsets[4]))); + + + fragcolor = val; + } + diff --git a/shaders/tesseract/208.shader_test b/shaders/tesseract/208.shader_test new file mode 100644 index 0000000..b0d09c5 --- /dev/null +++ b/shaders/tesseract/208.shader_test @@ -0,0 +1,82 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + uniform float offsets[8]; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + vec2 tc1 = vtexcoord0.xy, tc2 = vtexcoord0; + tc1.x += offsets[1]; + tc2.x -= offsets[1]; + texcoord1 = tc1; + texcoord2 = tc2; + + tc1.x = vtexcoord0.x + offsets[2]; + tc2.x = vtexcoord0.x - offsets[2]; + texcoord3 = tc1; + texcoord4 = tc2; + + tc1.x = vtexcoord0.x + offsets[3]; + tc2.x = vtexcoord0.x - offsets[3]; + texcoord5 = tc1; + texcoord6 = tc2; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform float weights[8]; + uniform float offsets[8]; + uniform sampler2D tex0; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + fragdata(0, fragcolor, vec4) + void main(void) + { + #define texval(coords) texture2D(tex0, (coords)) + vec4 val = texval(texcoord0) * weights[0]; + + val += weights[1] * (texval(texcoord1) + texval(texcoord2)); + + val += weights[2] * (texval(texcoord3) + texval(texcoord4)); + + val += weights[3] * (texval(texcoord5) + texval(texcoord6)); + + val += weights[4] * + + (texval(vec2(texcoord0.x + offsets[4], texcoord0.y)) + texval(vec2(texcoord0.x - offsets[4], texcoord0.y))); + + + val += weights[5] * + + (texval(vec2(texcoord0.x + offsets[5], texcoord0.y)) + texval(vec2(texcoord0.x - offsets[5], texcoord0.y))); + + + fragcolor = val; + } + diff --git a/shaders/tesseract/21.shader_test b/shaders/tesseract/21.shader_test new file mode 100644 index 0000000..d6e3d5e --- /dev/null +++ b/shaders/tesseract/21.shader_test @@ -0,0 +1,41 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vcolor; + attribute vec2 vtexcoord0; + uniform mat4 camprojmatrix; + uniform float ldrscale; + varying vec2 texcoord0; + varying vec4 colorscale; + void main(void) + { + gl_Position = camprojmatrix * vvertex; + texcoord0 = vtexcoord0; + colorscale = vec4(ldrscale * vcolor.rgb, vcolor.a); + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2D tex0; + varying vec2 texcoord0; + varying vec4 colorscale; + fragdata(0, fragcolor, vec4) + void main(void) + { + vec4 color = texture2D(tex0, texcoord0); + #pragma CUBE2_swizzle color + fragcolor = colorscale * color; + } + diff --git a/shaders/tesseract/211.shader_test b/shaders/tesseract/211.shader_test new file mode 100644 index 0000000..bc22999 --- /dev/null +++ b/shaders/tesseract/211.shader_test @@ -0,0 +1,82 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + uniform float offsets[8]; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + vec2 tc1 = vtexcoord0.xy, tc2 = vtexcoord0; + tc1.y += offsets[1]; + tc2.y -= offsets[1]; + texcoord1 = tc1; + texcoord2 = tc2; + + tc1.y = vtexcoord0.y + offsets[2]; + tc2.y = vtexcoord0.y - offsets[2]; + texcoord3 = tc1; + texcoord4 = tc2; + + tc1.y = vtexcoord0.y + offsets[3]; + tc2.y = vtexcoord0.y - offsets[3]; + texcoord5 = tc1; + texcoord6 = tc2; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform float weights[8]; + uniform float offsets[8]; + uniform sampler2D tex0; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + fragdata(0, fragcolor, vec4) + void main(void) + { + #define texval(coords) texture2D(tex0, (coords)) + vec4 val = texval(texcoord0) * weights[0]; + + val += weights[1] * (texval(texcoord1) + texval(texcoord2)); + + val += weights[2] * (texval(texcoord3) + texval(texcoord4)); + + val += weights[3] * (texval(texcoord5) + texval(texcoord6)); + + val += weights[4] * + + (texval(vec2(texcoord0.x, texcoord0.y + offsets[4])) + texval(vec2(texcoord0.x, texcoord0.y - offsets[4]))); + + + val += weights[5] * + + (texval(vec2(texcoord0.x, texcoord0.y + offsets[5])) + texval(vec2(texcoord0.x, texcoord0.y - offsets[5]))); + + + fragcolor = val; + } + diff --git a/shaders/tesseract/214.shader_test b/shaders/tesseract/214.shader_test new file mode 100644 index 0000000..535b56c --- /dev/null +++ b/shaders/tesseract/214.shader_test @@ -0,0 +1,82 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + uniform float offsets[8]; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + vec2 tc1 = vtexcoord0.xy, tc2 = vtexcoord0; + tc1.x += offsets[1]; + tc2.x -= offsets[1]; + texcoord1 = tc1; + texcoord2 = tc2; + + tc1.x = vtexcoord0.x + offsets[2]; + tc2.x = vtexcoord0.x - offsets[2]; + texcoord3 = tc1; + texcoord4 = tc2; + + tc1.x = vtexcoord0.x + offsets[3]; + tc2.x = vtexcoord0.x - offsets[3]; + texcoord5 = tc1; + texcoord6 = tc2; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform float weights[8]; + uniform float offsets[8]; + uniform sampler2DRect tex0; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + fragdata(0, fragcolor, vec4) + void main(void) + { + #define texval(coords) texture2DRect(tex0, (coords)) + vec4 val = texval(texcoord0) * weights[0]; + + val += weights[1] * (texval(texcoord1) + texval(texcoord2)); + + val += weights[2] * (texval(texcoord3) + texval(texcoord4)); + + val += weights[3] * (texval(texcoord5) + texval(texcoord6)); + + val += weights[4] * + + (texval(vec2(texcoord0.x + offsets[4], texcoord0.y)) + texval(vec2(texcoord0.x - offsets[4], texcoord0.y))); + + + val += weights[5] * + + (texval(vec2(texcoord0.x + offsets[5], texcoord0.y)) + texval(vec2(texcoord0.x - offsets[5], texcoord0.y))); + + + fragcolor = val; + } + diff --git a/shaders/tesseract/217.shader_test b/shaders/tesseract/217.shader_test new file mode 100644 index 0000000..1d6918d --- /dev/null +++ b/shaders/tesseract/217.shader_test @@ -0,0 +1,82 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + uniform float offsets[8]; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + vec2 tc1 = vtexcoord0.xy, tc2 = vtexcoord0; + tc1.y += offsets[1]; + tc2.y -= offsets[1]; + texcoord1 = tc1; + texcoord2 = tc2; + + tc1.y = vtexcoord0.y + offsets[2]; + tc2.y = vtexcoord0.y - offsets[2]; + texcoord3 = tc1; + texcoord4 = tc2; + + tc1.y = vtexcoord0.y + offsets[3]; + tc2.y = vtexcoord0.y - offsets[3]; + texcoord5 = tc1; + texcoord6 = tc2; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform float weights[8]; + uniform float offsets[8]; + uniform sampler2DRect tex0; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + fragdata(0, fragcolor, vec4) + void main(void) + { + #define texval(coords) texture2DRect(tex0, (coords)) + vec4 val = texval(texcoord0) * weights[0]; + + val += weights[1] * (texval(texcoord1) + texval(texcoord2)); + + val += weights[2] * (texval(texcoord3) + texval(texcoord4)); + + val += weights[3] * (texval(texcoord5) + texval(texcoord6)); + + val += weights[4] * + + (texval(vec2(texcoord0.x, texcoord0.y + offsets[4])) + texval(vec2(texcoord0.x, texcoord0.y - offsets[4]))); + + + val += weights[5] * + + (texval(vec2(texcoord0.x, texcoord0.y + offsets[5])) + texval(vec2(texcoord0.x, texcoord0.y - offsets[5]))); + + + fragcolor = val; + } + diff --git a/shaders/tesseract/220.shader_test b/shaders/tesseract/220.shader_test new file mode 100644 index 0000000..1fd6301 --- /dev/null +++ b/shaders/tesseract/220.shader_test @@ -0,0 +1,87 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + uniform float offsets[8]; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + vec2 tc1 = vtexcoord0.xy, tc2 = vtexcoord0; + tc1.x += offsets[1]; + tc2.x -= offsets[1]; + texcoord1 = tc1; + texcoord2 = tc2; + + tc1.x = vtexcoord0.x + offsets[2]; + tc2.x = vtexcoord0.x - offsets[2]; + texcoord3 = tc1; + texcoord4 = tc2; + + tc1.x = vtexcoord0.x + offsets[3]; + tc2.x = vtexcoord0.x - offsets[3]; + texcoord5 = tc1; + texcoord6 = tc2; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform float weights[8]; + uniform float offsets[8]; + uniform sampler2D tex0; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + fragdata(0, fragcolor, vec4) + void main(void) + { + #define texval(coords) texture2D(tex0, (coords)) + vec4 val = texval(texcoord0) * weights[0]; + + val += weights[1] * (texval(texcoord1) + texval(texcoord2)); + + val += weights[2] * (texval(texcoord3) + texval(texcoord4)); + + val += weights[3] * (texval(texcoord5) + texval(texcoord6)); + + val += weights[4] * + + (texval(vec2(texcoord0.x + offsets[4], texcoord0.y)) + texval(vec2(texcoord0.x - offsets[4], texcoord0.y))); + + + val += weights[5] * + + (texval(vec2(texcoord0.x + offsets[5], texcoord0.y)) + texval(vec2(texcoord0.x - offsets[5], texcoord0.y))); + + + val += weights[6] * + + (texval(vec2(texcoord0.x + offsets[6], texcoord0.y)) + texval(vec2(texcoord0.x - offsets[6], texcoord0.y))); + + + fragcolor = val; + } + diff --git a/shaders/tesseract/223.shader_test b/shaders/tesseract/223.shader_test new file mode 100644 index 0000000..bfcb2b1 --- /dev/null +++ b/shaders/tesseract/223.shader_test @@ -0,0 +1,87 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + uniform float offsets[8]; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + vec2 tc1 = vtexcoord0.xy, tc2 = vtexcoord0; + tc1.y += offsets[1]; + tc2.y -= offsets[1]; + texcoord1 = tc1; + texcoord2 = tc2; + + tc1.y = vtexcoord0.y + offsets[2]; + tc2.y = vtexcoord0.y - offsets[2]; + texcoord3 = tc1; + texcoord4 = tc2; + + tc1.y = vtexcoord0.y + offsets[3]; + tc2.y = vtexcoord0.y - offsets[3]; + texcoord5 = tc1; + texcoord6 = tc2; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform float weights[8]; + uniform float offsets[8]; + uniform sampler2D tex0; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + fragdata(0, fragcolor, vec4) + void main(void) + { + #define texval(coords) texture2D(tex0, (coords)) + vec4 val = texval(texcoord0) * weights[0]; + + val += weights[1] * (texval(texcoord1) + texval(texcoord2)); + + val += weights[2] * (texval(texcoord3) + texval(texcoord4)); + + val += weights[3] * (texval(texcoord5) + texval(texcoord6)); + + val += weights[4] * + + (texval(vec2(texcoord0.x, texcoord0.y + offsets[4])) + texval(vec2(texcoord0.x, texcoord0.y - offsets[4]))); + + + val += weights[5] * + + (texval(vec2(texcoord0.x, texcoord0.y + offsets[5])) + texval(vec2(texcoord0.x, texcoord0.y - offsets[5]))); + + + val += weights[6] * + + (texval(vec2(texcoord0.x, texcoord0.y + offsets[6])) + texval(vec2(texcoord0.x, texcoord0.y - offsets[6]))); + + + fragcolor = val; + } + diff --git a/shaders/tesseract/226.shader_test b/shaders/tesseract/226.shader_test new file mode 100644 index 0000000..2386310 --- /dev/null +++ b/shaders/tesseract/226.shader_test @@ -0,0 +1,87 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + uniform float offsets[8]; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + vec2 tc1 = vtexcoord0.xy, tc2 = vtexcoord0; + tc1.x += offsets[1]; + tc2.x -= offsets[1]; + texcoord1 = tc1; + texcoord2 = tc2; + + tc1.x = vtexcoord0.x + offsets[2]; + tc2.x = vtexcoord0.x - offsets[2]; + texcoord3 = tc1; + texcoord4 = tc2; + + tc1.x = vtexcoord0.x + offsets[3]; + tc2.x = vtexcoord0.x - offsets[3]; + texcoord5 = tc1; + texcoord6 = tc2; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform float weights[8]; + uniform float offsets[8]; + uniform sampler2DRect tex0; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + fragdata(0, fragcolor, vec4) + void main(void) + { + #define texval(coords) texture2DRect(tex0, (coords)) + vec4 val = texval(texcoord0) * weights[0]; + + val += weights[1] * (texval(texcoord1) + texval(texcoord2)); + + val += weights[2] * (texval(texcoord3) + texval(texcoord4)); + + val += weights[3] * (texval(texcoord5) + texval(texcoord6)); + + val += weights[4] * + + (texval(vec2(texcoord0.x + offsets[4], texcoord0.y)) + texval(vec2(texcoord0.x - offsets[4], texcoord0.y))); + + + val += weights[5] * + + (texval(vec2(texcoord0.x + offsets[5], texcoord0.y)) + texval(vec2(texcoord0.x - offsets[5], texcoord0.y))); + + + val += weights[6] * + + (texval(vec2(texcoord0.x + offsets[6], texcoord0.y)) + texval(vec2(texcoord0.x - offsets[6], texcoord0.y))); + + + fragcolor = val; + } + diff --git a/shaders/tesseract/229.shader_test b/shaders/tesseract/229.shader_test new file mode 100644 index 0000000..b619925 --- /dev/null +++ b/shaders/tesseract/229.shader_test @@ -0,0 +1,87 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + uniform float offsets[8]; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + vec2 tc1 = vtexcoord0.xy, tc2 = vtexcoord0; + tc1.y += offsets[1]; + tc2.y -= offsets[1]; + texcoord1 = tc1; + texcoord2 = tc2; + + tc1.y = vtexcoord0.y + offsets[2]; + tc2.y = vtexcoord0.y - offsets[2]; + texcoord3 = tc1; + texcoord4 = tc2; + + tc1.y = vtexcoord0.y + offsets[3]; + tc2.y = vtexcoord0.y - offsets[3]; + texcoord5 = tc1; + texcoord6 = tc2; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform float weights[8]; + uniform float offsets[8]; + uniform sampler2DRect tex0; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + fragdata(0, fragcolor, vec4) + void main(void) + { + #define texval(coords) texture2DRect(tex0, (coords)) + vec4 val = texval(texcoord0) * weights[0]; + + val += weights[1] * (texval(texcoord1) + texval(texcoord2)); + + val += weights[2] * (texval(texcoord3) + texval(texcoord4)); + + val += weights[3] * (texval(texcoord5) + texval(texcoord6)); + + val += weights[4] * + + (texval(vec2(texcoord0.x, texcoord0.y + offsets[4])) + texval(vec2(texcoord0.x, texcoord0.y - offsets[4]))); + + + val += weights[5] * + + (texval(vec2(texcoord0.x, texcoord0.y + offsets[5])) + texval(vec2(texcoord0.x, texcoord0.y - offsets[5]))); + + + val += weights[6] * + + (texval(vec2(texcoord0.x, texcoord0.y + offsets[6])) + texval(vec2(texcoord0.x, texcoord0.y - offsets[6]))); + + + fragcolor = val; + } + diff --git a/shaders/tesseract/232.shader_test b/shaders/tesseract/232.shader_test new file mode 100644 index 0000000..d005265 --- /dev/null +++ b/shaders/tesseract/232.shader_test @@ -0,0 +1,92 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + uniform float offsets[8]; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + vec2 tc1 = vtexcoord0.xy, tc2 = vtexcoord0; + tc1.x += offsets[1]; + tc2.x -= offsets[1]; + texcoord1 = tc1; + texcoord2 = tc2; + + tc1.x = vtexcoord0.x + offsets[2]; + tc2.x = vtexcoord0.x - offsets[2]; + texcoord3 = tc1; + texcoord4 = tc2; + + tc1.x = vtexcoord0.x + offsets[3]; + tc2.x = vtexcoord0.x - offsets[3]; + texcoord5 = tc1; + texcoord6 = tc2; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform float weights[8]; + uniform float offsets[8]; + uniform sampler2D tex0; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + fragdata(0, fragcolor, vec4) + void main(void) + { + #define texval(coords) texture2D(tex0, (coords)) + vec4 val = texval(texcoord0) * weights[0]; + + val += weights[1] * (texval(texcoord1) + texval(texcoord2)); + + val += weights[2] * (texval(texcoord3) + texval(texcoord4)); + + val += weights[3] * (texval(texcoord5) + texval(texcoord6)); + + val += weights[4] * + + (texval(vec2(texcoord0.x + offsets[4], texcoord0.y)) + texval(vec2(texcoord0.x - offsets[4], texcoord0.y))); + + + val += weights[5] * + + (texval(vec2(texcoord0.x + offsets[5], texcoord0.y)) + texval(vec2(texcoord0.x - offsets[5], texcoord0.y))); + + + val += weights[6] * + + (texval(vec2(texcoord0.x + offsets[6], texcoord0.y)) + texval(vec2(texcoord0.x - offsets[6], texcoord0.y))); + + + val += weights[7] * + + (texval(vec2(texcoord0.x + offsets[7], texcoord0.y)) + texval(vec2(texcoord0.x - offsets[7], texcoord0.y))); + + + fragcolor = val; + } + diff --git a/shaders/tesseract/235.shader_test b/shaders/tesseract/235.shader_test new file mode 100644 index 0000000..d197e8f --- /dev/null +++ b/shaders/tesseract/235.shader_test @@ -0,0 +1,92 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + uniform float offsets[8]; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + vec2 tc1 = vtexcoord0.xy, tc2 = vtexcoord0; + tc1.y += offsets[1]; + tc2.y -= offsets[1]; + texcoord1 = tc1; + texcoord2 = tc2; + + tc1.y = vtexcoord0.y + offsets[2]; + tc2.y = vtexcoord0.y - offsets[2]; + texcoord3 = tc1; + texcoord4 = tc2; + + tc1.y = vtexcoord0.y + offsets[3]; + tc2.y = vtexcoord0.y - offsets[3]; + texcoord5 = tc1; + texcoord6 = tc2; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform float weights[8]; + uniform float offsets[8]; + uniform sampler2D tex0; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + fragdata(0, fragcolor, vec4) + void main(void) + { + #define texval(coords) texture2D(tex0, (coords)) + vec4 val = texval(texcoord0) * weights[0]; + + val += weights[1] * (texval(texcoord1) + texval(texcoord2)); + + val += weights[2] * (texval(texcoord3) + texval(texcoord4)); + + val += weights[3] * (texval(texcoord5) + texval(texcoord6)); + + val += weights[4] * + + (texval(vec2(texcoord0.x, texcoord0.y + offsets[4])) + texval(vec2(texcoord0.x, texcoord0.y - offsets[4]))); + + + val += weights[5] * + + (texval(vec2(texcoord0.x, texcoord0.y + offsets[5])) + texval(vec2(texcoord0.x, texcoord0.y - offsets[5]))); + + + val += weights[6] * + + (texval(vec2(texcoord0.x, texcoord0.y + offsets[6])) + texval(vec2(texcoord0.x, texcoord0.y - offsets[6]))); + + + val += weights[7] * + + (texval(vec2(texcoord0.x, texcoord0.y + offsets[7])) + texval(vec2(texcoord0.x, texcoord0.y - offsets[7]))); + + + fragcolor = val; + } + diff --git a/shaders/tesseract/238.shader_test b/shaders/tesseract/238.shader_test new file mode 100644 index 0000000..ade637d --- /dev/null +++ b/shaders/tesseract/238.shader_test @@ -0,0 +1,92 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + uniform float offsets[8]; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + vec2 tc1 = vtexcoord0.xy, tc2 = vtexcoord0; + tc1.x += offsets[1]; + tc2.x -= offsets[1]; + texcoord1 = tc1; + texcoord2 = tc2; + + tc1.x = vtexcoord0.x + offsets[2]; + tc2.x = vtexcoord0.x - offsets[2]; + texcoord3 = tc1; + texcoord4 = tc2; + + tc1.x = vtexcoord0.x + offsets[3]; + tc2.x = vtexcoord0.x - offsets[3]; + texcoord5 = tc1; + texcoord6 = tc2; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform float weights[8]; + uniform float offsets[8]; + uniform sampler2DRect tex0; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + fragdata(0, fragcolor, vec4) + void main(void) + { + #define texval(coords) texture2DRect(tex0, (coords)) + vec4 val = texval(texcoord0) * weights[0]; + + val += weights[1] * (texval(texcoord1) + texval(texcoord2)); + + val += weights[2] * (texval(texcoord3) + texval(texcoord4)); + + val += weights[3] * (texval(texcoord5) + texval(texcoord6)); + + val += weights[4] * + + (texval(vec2(texcoord0.x + offsets[4], texcoord0.y)) + texval(vec2(texcoord0.x - offsets[4], texcoord0.y))); + + + val += weights[5] * + + (texval(vec2(texcoord0.x + offsets[5], texcoord0.y)) + texval(vec2(texcoord0.x - offsets[5], texcoord0.y))); + + + val += weights[6] * + + (texval(vec2(texcoord0.x + offsets[6], texcoord0.y)) + texval(vec2(texcoord0.x - offsets[6], texcoord0.y))); + + + val += weights[7] * + + (texval(vec2(texcoord0.x + offsets[7], texcoord0.y)) + texval(vec2(texcoord0.x - offsets[7], texcoord0.y))); + + + fragcolor = val; + } + diff --git a/shaders/tesseract/24.shader_test b/shaders/tesseract/24.shader_test new file mode 100644 index 0000000..9631934 --- /dev/null +++ b/shaders/tesseract/24.shader_test @@ -0,0 +1,34 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vcolor; + uniform mat4 camprojmatrix; + uniform float ldrscale; + varying vec4 color; + void main(void) + { + gl_Position = camprojmatrix * vvertex; + color = vec4(ldrscale * vcolor.rgb, vcolor.a); + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +varying vec4 color; + fragdata(0, fragcolor, vec4) + void main(void) + { + fragcolor = color; + } + diff --git a/shaders/tesseract/241.shader_test b/shaders/tesseract/241.shader_test new file mode 100644 index 0000000..455f6a1 --- /dev/null +++ b/shaders/tesseract/241.shader_test @@ -0,0 +1,92 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + uniform float offsets[8]; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + vec2 tc1 = vtexcoord0.xy, tc2 = vtexcoord0; + tc1.y += offsets[1]; + tc2.y -= offsets[1]; + texcoord1 = tc1; + texcoord2 = tc2; + + tc1.y = vtexcoord0.y + offsets[2]; + tc2.y = vtexcoord0.y - offsets[2]; + texcoord3 = tc1; + texcoord4 = tc2; + + tc1.y = vtexcoord0.y + offsets[3]; + tc2.y = vtexcoord0.y - offsets[3]; + texcoord5 = tc1; + texcoord6 = tc2; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform float weights[8]; + uniform float offsets[8]; + uniform sampler2DRect tex0; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + varying vec2 texcoord5, texcoord6; + + fragdata(0, fragcolor, vec4) + void main(void) + { + #define texval(coords) texture2DRect(tex0, (coords)) + vec4 val = texval(texcoord0) * weights[0]; + + val += weights[1] * (texval(texcoord1) + texval(texcoord2)); + + val += weights[2] * (texval(texcoord3) + texval(texcoord4)); + + val += weights[3] * (texval(texcoord5) + texval(texcoord6)); + + val += weights[4] * + + (texval(vec2(texcoord0.x, texcoord0.y + offsets[4])) + texval(vec2(texcoord0.x, texcoord0.y - offsets[4]))); + + + val += weights[5] * + + (texval(vec2(texcoord0.x, texcoord0.y + offsets[5])) + texval(vec2(texcoord0.x, texcoord0.y - offsets[5]))); + + + val += weights[6] * + + (texval(vec2(texcoord0.x, texcoord0.y + offsets[6])) + texval(vec2(texcoord0.x, texcoord0.y - offsets[6]))); + + + val += weights[7] * + + (texval(vec2(texcoord0.x, texcoord0.y + offsets[7])) + texval(vec2(texcoord0.x, texcoord0.y - offsets[7]))); + + + fragcolor = val; + } + diff --git a/shaders/tesseract/244.shader_test b/shaders/tesseract/244.shader_test new file mode 100644 index 0000000..c030bc0 --- /dev/null +++ b/shaders/tesseract/244.shader_test @@ -0,0 +1,39 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vcolor; + uniform mat4 camprojmatrix; + uniform vec4 texgenS, texgenT; + uniform float ldrscale; + varying vec4 color; + varying vec2 texcoord0; + void main(void) + { + gl_Position = camprojmatrix * vvertex; + color = vec4(ldrscale * vcolor.rgb, vcolor.a); + texcoord0 = vec2(dot(texgenS, vvertex), dot(texgenT, vvertex)); + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2D tex0; + varying vec4 color; + varying vec2 texcoord0; + fragdata(0, fragcolor, vec4) + void main(void) + { + fragcolor = texture2D(tex0, texcoord0).r * color; + } + diff --git a/shaders/tesseract/247.shader_test b/shaders/tesseract/247.shader_test new file mode 100644 index 0000000..c36f6bf --- /dev/null +++ b/shaders/tesseract/247.shader_test @@ -0,0 +1,146 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + + varying vec2 texcoord0; + + +uniform vec4 specscale; + +uniform vec4 envscale; + void main(void) + { + + #define mpos vvertex + #define mquat vtangent + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + uniform sampler2D tex1; + + uniform sampler2D tex3; + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + +uniform vec4 specscale; + +uniform vec4 envscale; + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + + glowk /= glowk + colork + 1.0e-3; + gcolor.rgb = gcolor.rgb * (1.0 - 2.0*glowk*(glowk - 1.0)); + #define packnorm 1.0-glowk + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + diff --git a/shaders/tesseract/249.shader_test b/shaders/tesseract/249.shader_test new file mode 100644 index 0000000..19f8032 --- /dev/null +++ b/shaders/tesseract/249.shader_test @@ -0,0 +1,155 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index]; + vec4 dqdual = animdata[index+1]; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + uniform sampler2D tex1; + + uniform sampler2D tex3; + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + +uniform vec4 specscale; + +uniform vec4 envscale; + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + + glowk /= glowk + colork + 1.0e-3; + gcolor.rgb = gcolor.rgb * (1.0 - 2.0*glowk*(glowk - 1.0)); + #define packnorm 1.0-glowk + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + diff --git a/shaders/tesseract/251.shader_test b/shaders/tesseract/251.shader_test new file mode 100644 index 0000000..afce8ee --- /dev/null +++ b/shaders/tesseract/251.shader_test @@ -0,0 +1,163 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + uniform sampler2D tex1; + + uniform sampler2D tex3; + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + +uniform vec4 specscale; + +uniform vec4 envscale; + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + + glowk /= glowk + colork + 1.0e-3; + gcolor.rgb = gcolor.rgb * (1.0 - 2.0*glowk*(glowk - 1.0)); + #define packnorm 1.0-glowk + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + diff --git a/shaders/tesseract/253.shader_test b/shaders/tesseract/253.shader_test new file mode 100644 index 0000000..6175e1f --- /dev/null +++ b/shaders/tesseract/253.shader_test @@ -0,0 +1,167 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + index = int(vboneindex.z); + dqreal += animdata[index] * vboneweight.z; + dqdual += animdata[index+1] * vboneweight.z; + + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + uniform sampler2D tex1; + + uniform sampler2D tex3; + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + +uniform vec4 specscale; + +uniform vec4 envscale; + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + + glowk /= glowk + colork + 1.0e-3; + gcolor.rgb = gcolor.rgb * (1.0 - 2.0*glowk*(glowk - 1.0)); + #define packnorm 1.0-glowk + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + diff --git a/shaders/tesseract/255.shader_test b/shaders/tesseract/255.shader_test new file mode 100644 index 0000000..1172dfe --- /dev/null +++ b/shaders/tesseract/255.shader_test @@ -0,0 +1,171 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + index = int(vboneindex.z); + dqreal += animdata[index] * vboneweight.z; + dqdual += animdata[index+1] * vboneweight.z; + + + index = int(vboneindex.w); + dqreal += animdata[index] * vboneweight.w; + dqdual += animdata[index+1] * vboneweight.w; + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + uniform sampler2D tex1; + + uniform sampler2D tex3; + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + +uniform vec4 specscale; + +uniform vec4 envscale; + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + + glowk /= glowk + colork + 1.0e-3; + gcolor.rgb = gcolor.rgb * (1.0 - 2.0*glowk*(glowk - 1.0)); + #define packnorm 1.0-glowk + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + diff --git a/shaders/tesseract/257.shader_test b/shaders/tesseract/257.shader_test new file mode 100644 index 0000000..4bfc930 --- /dev/null +++ b/shaders/tesseract/257.shader_test @@ -0,0 +1,142 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + + varying vec2 texcoord0; + + +uniform vec4 specscale; + +uniform vec4 envscale; + void main(void) + { + + #define mpos vvertex + #define mquat vtangent + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + uniform sampler2D tex1; + + uniform sampler2D tex3; + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + gglow.rgb = gcolor.rgb*glowk; + gcolor.rgb *= colork; + #define packnorm colorscale.a + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + + diff --git a/shaders/tesseract/258.shader_test b/shaders/tesseract/258.shader_test new file mode 100644 index 0000000..a12fb70 --- /dev/null +++ b/shaders/tesseract/258.shader_test @@ -0,0 +1,151 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index]; + vec4 dqdual = animdata[index+1]; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + uniform sampler2D tex1; + + uniform sampler2D tex3; + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + gglow.rgb = gcolor.rgb*glowk; + gcolor.rgb *= colork; + #define packnorm colorscale.a + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + + diff --git a/shaders/tesseract/259.shader_test b/shaders/tesseract/259.shader_test new file mode 100644 index 0000000..e327fa6 --- /dev/null +++ b/shaders/tesseract/259.shader_test @@ -0,0 +1,159 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + uniform sampler2D tex1; + + uniform sampler2D tex3; + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + gglow.rgb = gcolor.rgb*glowk; + gcolor.rgb *= colork; + #define packnorm colorscale.a + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + + diff --git a/shaders/tesseract/260.shader_test b/shaders/tesseract/260.shader_test new file mode 100644 index 0000000..2d29f0a --- /dev/null +++ b/shaders/tesseract/260.shader_test @@ -0,0 +1,163 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + index = int(vboneindex.z); + dqreal += animdata[index] * vboneweight.z; + dqdual += animdata[index+1] * vboneweight.z; + + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + uniform sampler2D tex1; + + uniform sampler2D tex3; + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + gglow.rgb = gcolor.rgb*glowk; + gcolor.rgb *= colork; + #define packnorm colorscale.a + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + + diff --git a/shaders/tesseract/261.shader_test b/shaders/tesseract/261.shader_test new file mode 100644 index 0000000..65be666 --- /dev/null +++ b/shaders/tesseract/261.shader_test @@ -0,0 +1,166 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + index = int(vboneindex.z); + dqreal += animdata[index] * vboneweight.z; + dqdual += animdata[index+1] * vboneweight.z; + + + index = int(vboneindex.w); + dqreal += animdata[index] * vboneweight.w; + dqdual += animdata[index+1] * vboneweight.w; + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + uniform sampler2D tex1; + + uniform sampler2D tex3; + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + gglow.rgb = gcolor.rgb*glowk; + gcolor.rgb *= colork; + #define packnorm colorscale.a + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + diff --git a/shaders/tesseract/264.shader_test b/shaders/tesseract/264.shader_test new file mode 100644 index 0000000..f9ff5c4 --- /dev/null +++ b/shaders/tesseract/264.shader_test @@ -0,0 +1,36 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + + uniform mat4 modelmatrix; + + void main(void) + { + + #define mpos vvertex + + + gl_Position = modelmatrix * mpos; + + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +void main(void) + { + + } + diff --git a/shaders/tesseract/266.shader_test b/shaders/tesseract/266.shader_test new file mode 100644 index 0000000..d61c10b --- /dev/null +++ b/shaders/tesseract/266.shader_test @@ -0,0 +1,48 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index]; + vec4 dqdual = animdata[index+1]; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + + + gl_Position = modelmatrix * mpos; + + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +void main(void) + { + + } + diff --git a/shaders/tesseract/268.shader_test b/shaders/tesseract/268.shader_test new file mode 100644 index 0000000..4106ca1 --- /dev/null +++ b/shaders/tesseract/268.shader_test @@ -0,0 +1,56 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + + + gl_Position = modelmatrix * mpos; + + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +void main(void) + { + + } + diff --git a/shaders/tesseract/27.shader_test b/shaders/tesseract/27.shader_test new file mode 100644 index 0000000..fb93e8c --- /dev/null +++ b/shaders/tesseract/27.shader_test @@ -0,0 +1,56 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#pragma CUBE2_fog + attribute vec4 vvertex, vcolor; + attribute vec2 vtexcoord0; + uniform mat4 camprojmatrix; + varying vec2 texcoord0; + varying vec4 colorscale; + +uniform vec2 lineardepthscale; +varying float lineardepth; + void main(void) + { + gl_Position = camprojmatrix * vvertex; + texcoord0 = vtexcoord0; + colorscale = vcolor; + +lineardepth = dot(lineardepthscale, gl_Position.zw); +} + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2D tex0; + varying vec2 texcoord0; + varying vec4 colorscale; + fragdata(0, fragcolor, vec4) + +varying float lineardepth; + +uniform vec3 fogcolor; +uniform vec2 fogdensity; +uniform vec4 radialfogscale; +#define fogcoord lineardepth*length(vec3(gl_FragCoord.xy*radialfogscale.xy + radialfogscale.zw, 1.0)) + void main(void) + { + vec4 color = texture2D(tex0, texcoord0); + #pragma CUBE2_swizzle color + fragcolor = colorscale * color; + +#define FOG_COLOR fogcolor +fragcolor.rgb = mix((FOG_COLOR).rgb, fragcolor.rgb, clamp(exp2(fogcoord*-fogdensity.x)*fogdensity.y, 0.0, 1.0)); +} + diff --git a/shaders/tesseract/270.shader_test b/shaders/tesseract/270.shader_test new file mode 100644 index 0000000..9cca5bc --- /dev/null +++ b/shaders/tesseract/270.shader_test @@ -0,0 +1,60 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + index = int(vboneindex.z); + dqreal += animdata[index] * vboneweight.z; + dqdual += animdata[index+1] * vboneweight.z; + + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + + + gl_Position = modelmatrix * mpos; + + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +void main(void) + { + + } + diff --git a/shaders/tesseract/272.shader_test b/shaders/tesseract/272.shader_test new file mode 100644 index 0000000..273fed2 --- /dev/null +++ b/shaders/tesseract/272.shader_test @@ -0,0 +1,64 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + index = int(vboneindex.z); + dqreal += animdata[index] * vboneweight.z; + dqdual += animdata[index+1] * vboneweight.z; + + + index = int(vboneindex.w); + dqreal += animdata[index] * vboneweight.w; + dqdual += animdata[index+1] * vboneweight.w; + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + + + gl_Position = modelmatrix * mpos; + + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +void main(void) + { + + } + diff --git a/shaders/tesseract/275.shader_test b/shaders/tesseract/275.shader_test new file mode 100644 index 0000000..f12bd13 --- /dev/null +++ b/shaders/tesseract/275.shader_test @@ -0,0 +1,152 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + varying vec3 camvec; + + + varying vec2 texcoord0; + + void main(void) + { + + #define mpos vvertex + #define mquat vtangent + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + camvec = modelworld * normalize(modelcamera - mpos.xyz); + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec2 envmapscale; + varying vec3 camvec; + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + uniform sampler2D tex1; + uniform samplerCube tex2; + uniform sampler2D tex3; + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + vec3 camn = normalize(camvec); + float invfresnel = dot(camn, normal); + vec3 rvec = 2.0*invfresnel*normal - camn; + float rmod = envmapscale.x*clamp(invfresnel, 0.0, 1.0) + envmapscale.y; + vec3 reflect = textureCube(tex2, rvec).rgb; + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*masks.b); + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + + glowk /= glowk + colork + 1.0e-3; + gcolor.rgb = gcolor.rgb * (1.0 - 2.0*glowk*(glowk - 1.0)); + #define packnorm 1.0-glowk + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + diff --git a/shaders/tesseract/277.shader_test b/shaders/tesseract/277.shader_test new file mode 100644 index 0000000..2dcf939 --- /dev/null +++ b/shaders/tesseract/277.shader_test @@ -0,0 +1,165 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + varying vec3 camvec; + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index]; + vec4 dqdual = animdata[index+1]; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + camvec = modelworld * normalize(modelcamera - mpos.xyz); + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec2 envmapscale; + varying vec3 camvec; + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + uniform sampler2D tex1; + uniform samplerCube tex2; + uniform sampler2D tex3; + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + vec3 camn = normalize(camvec); + float invfresnel = dot(camn, normal); + vec3 rvec = 2.0*invfresnel*normal - camn; + float rmod = envmapscale.x*clamp(invfresnel, 0.0, 1.0) + envmapscale.y; + vec3 reflect = textureCube(tex2, rvec).rgb; + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*masks.b); + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + + glowk /= glowk + colork + 1.0e-3; + gcolor.rgb = gcolor.rgb * (1.0 - 2.0*glowk*(glowk - 1.0)); + #define packnorm 1.0-glowk + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + diff --git a/shaders/tesseract/279.shader_test b/shaders/tesseract/279.shader_test new file mode 100644 index 0000000..187a6bd --- /dev/null +++ b/shaders/tesseract/279.shader_test @@ -0,0 +1,173 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + varying vec3 camvec; + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + camvec = modelworld * normalize(modelcamera - mpos.xyz); + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec2 envmapscale; + varying vec3 camvec; + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + uniform sampler2D tex1; + uniform samplerCube tex2; + uniform sampler2D tex3; + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + vec3 camn = normalize(camvec); + float invfresnel = dot(camn, normal); + vec3 rvec = 2.0*invfresnel*normal - camn; + float rmod = envmapscale.x*clamp(invfresnel, 0.0, 1.0) + envmapscale.y; + vec3 reflect = textureCube(tex2, rvec).rgb; + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*masks.b); + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + + glowk /= glowk + colork + 1.0e-3; + gcolor.rgb = gcolor.rgb * (1.0 - 2.0*glowk*(glowk - 1.0)); + #define packnorm 1.0-glowk + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + diff --git a/shaders/tesseract/281.shader_test b/shaders/tesseract/281.shader_test new file mode 100644 index 0000000..bc71ae7 --- /dev/null +++ b/shaders/tesseract/281.shader_test @@ -0,0 +1,177 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + varying vec3 camvec; + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + index = int(vboneindex.z); + dqreal += animdata[index] * vboneweight.z; + dqdual += animdata[index+1] * vboneweight.z; + + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + camvec = modelworld * normalize(modelcamera - mpos.xyz); + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec2 envmapscale; + varying vec3 camvec; + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + uniform sampler2D tex1; + uniform samplerCube tex2; + uniform sampler2D tex3; + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + vec3 camn = normalize(camvec); + float invfresnel = dot(camn, normal); + vec3 rvec = 2.0*invfresnel*normal - camn; + float rmod = envmapscale.x*clamp(invfresnel, 0.0, 1.0) + envmapscale.y; + vec3 reflect = textureCube(tex2, rvec).rgb; + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*masks.b); + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + + glowk /= glowk + colork + 1.0e-3; + gcolor.rgb = gcolor.rgb * (1.0 - 2.0*glowk*(glowk - 1.0)); + #define packnorm 1.0-glowk + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + diff --git a/shaders/tesseract/283.shader_test b/shaders/tesseract/283.shader_test new file mode 100644 index 0000000..80a75ba --- /dev/null +++ b/shaders/tesseract/283.shader_test @@ -0,0 +1,181 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + varying vec3 camvec; + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + index = int(vboneindex.z); + dqreal += animdata[index] * vboneweight.z; + dqdual += animdata[index+1] * vboneweight.z; + + + index = int(vboneindex.w); + dqreal += animdata[index] * vboneweight.w; + dqdual += animdata[index+1] * vboneweight.w; + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + camvec = modelworld * normalize(modelcamera - mpos.xyz); + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec2 envmapscale; + varying vec3 camvec; + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + uniform sampler2D tex1; + uniform samplerCube tex2; + uniform sampler2D tex3; + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + vec3 camn = normalize(camvec); + float invfresnel = dot(camn, normal); + vec3 rvec = 2.0*invfresnel*normal - camn; + float rmod = envmapscale.x*clamp(invfresnel, 0.0, 1.0) + envmapscale.y; + vec3 reflect = textureCube(tex2, rvec).rgb; + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*masks.b); + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + + glowk /= glowk + colork + 1.0e-3; + gcolor.rgb = gcolor.rgb * (1.0 - 2.0*glowk*(glowk - 1.0)); + #define packnorm 1.0-glowk + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + diff --git a/shaders/tesseract/285.shader_test b/shaders/tesseract/285.shader_test new file mode 100644 index 0000000..d44fc30 --- /dev/null +++ b/shaders/tesseract/285.shader_test @@ -0,0 +1,152 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + varying vec3 camvec; + + + varying vec2 texcoord0; + + void main(void) + { + + #define mpos vvertex + #define mquat vtangent + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + camvec = modelworld * normalize(modelcamera - mpos.xyz); + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec2 envmapscale; + varying vec3 camvec; + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + uniform sampler2D tex1; + uniform samplerCube tex2; + uniform sampler2D tex3; + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + vec3 camn = normalize(camvec); + float invfresnel = dot(camn, normal); + vec3 rvec = 2.0*invfresnel*normal - camn; + float rmod = envmapscale.x*clamp(invfresnel, 0.0, 1.0) + envmapscale.y; + vec3 reflect = textureCube(tex2, rvec).rgb; + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*masks.b); + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + gglow.rgb = gcolor.rgb*glowk; + gcolor.rgb *= colork; + #define packnorm colorscale.a + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + + diff --git a/shaders/tesseract/286.shader_test b/shaders/tesseract/286.shader_test new file mode 100644 index 0000000..f2503d6 --- /dev/null +++ b/shaders/tesseract/286.shader_test @@ -0,0 +1,165 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + varying vec3 camvec; + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index]; + vec4 dqdual = animdata[index+1]; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + camvec = modelworld * normalize(modelcamera - mpos.xyz); + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec2 envmapscale; + varying vec3 camvec; + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + uniform sampler2D tex1; + uniform samplerCube tex2; + uniform sampler2D tex3; + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + vec3 camn = normalize(camvec); + float invfresnel = dot(camn, normal); + vec3 rvec = 2.0*invfresnel*normal - camn; + float rmod = envmapscale.x*clamp(invfresnel, 0.0, 1.0) + envmapscale.y; + vec3 reflect = textureCube(tex2, rvec).rgb; + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*masks.b); + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + gglow.rgb = gcolor.rgb*glowk; + gcolor.rgb *= colork; + #define packnorm colorscale.a + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + + diff --git a/shaders/tesseract/287.shader_test b/shaders/tesseract/287.shader_test new file mode 100644 index 0000000..46164ca --- /dev/null +++ b/shaders/tesseract/287.shader_test @@ -0,0 +1,173 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + varying vec3 camvec; + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + camvec = modelworld * normalize(modelcamera - mpos.xyz); + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec2 envmapscale; + varying vec3 camvec; + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + uniform sampler2D tex1; + uniform samplerCube tex2; + uniform sampler2D tex3; + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + vec3 camn = normalize(camvec); + float invfresnel = dot(camn, normal); + vec3 rvec = 2.0*invfresnel*normal - camn; + float rmod = envmapscale.x*clamp(invfresnel, 0.0, 1.0) + envmapscale.y; + vec3 reflect = textureCube(tex2, rvec).rgb; + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*masks.b); + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + gglow.rgb = gcolor.rgb*glowk; + gcolor.rgb *= colork; + #define packnorm colorscale.a + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + + diff --git a/shaders/tesseract/288.shader_test b/shaders/tesseract/288.shader_test new file mode 100644 index 0000000..fe45224 --- /dev/null +++ b/shaders/tesseract/288.shader_test @@ -0,0 +1,177 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + varying vec3 camvec; + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + index = int(vboneindex.z); + dqreal += animdata[index] * vboneweight.z; + dqdual += animdata[index+1] * vboneweight.z; + + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + camvec = modelworld * normalize(modelcamera - mpos.xyz); + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec2 envmapscale; + varying vec3 camvec; + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + uniform sampler2D tex1; + uniform samplerCube tex2; + uniform sampler2D tex3; + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + vec3 camn = normalize(camvec); + float invfresnel = dot(camn, normal); + vec3 rvec = 2.0*invfresnel*normal - camn; + float rmod = envmapscale.x*clamp(invfresnel, 0.0, 1.0) + envmapscale.y; + vec3 reflect = textureCube(tex2, rvec).rgb; + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*masks.b); + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + gglow.rgb = gcolor.rgb*glowk; + gcolor.rgb *= colork; + #define packnorm colorscale.a + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + + diff --git a/shaders/tesseract/289.shader_test b/shaders/tesseract/289.shader_test new file mode 100644 index 0000000..719a1ad --- /dev/null +++ b/shaders/tesseract/289.shader_test @@ -0,0 +1,180 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + varying vec3 camvec; + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + index = int(vboneindex.z); + dqreal += animdata[index] * vboneweight.z; + dqdual += animdata[index+1] * vboneweight.z; + + + index = int(vboneindex.w); + dqreal += animdata[index] * vboneweight.w; + dqdual += animdata[index+1] * vboneweight.w; + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + camvec = modelworld * normalize(modelcamera - mpos.xyz); + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec2 envmapscale; + varying vec3 camvec; + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + uniform sampler2D tex1; + uniform samplerCube tex2; + uniform sampler2D tex3; + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + vec3 camn = normalize(camvec); + float invfresnel = dot(camn, normal); + vec3 rvec = 2.0*invfresnel*normal - camn; + float rmod = envmapscale.x*clamp(invfresnel, 0.0, 1.0) + envmapscale.y; + vec3 reflect = textureCube(tex2, rvec).rgb; + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*masks.b); + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + gglow.rgb = gcolor.rgb*glowk; + gcolor.rgb *= colork; + #define packnorm colorscale.a + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + diff --git a/shaders/tesseract/292.shader_test b/shaders/tesseract/292.shader_test new file mode 100644 index 0000000..e41e28c --- /dev/null +++ b/shaders/tesseract/292.shader_test @@ -0,0 +1,123 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying vec3 nvec; + + + + varying vec2 texcoord0; + + void main(void) + { + + #define mpos vvertex + #define mquat vtangent + + vec3 mnormal = cross(mquat.xyz, vec3(mquat.y, -mquat.x, mquat.w))*2.0 + vec3(0.0, 0.0, 1.0); + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + + + nvec = modelworld * mnormal; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying vec3 nvec; + + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + + + + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = normalize(nvec); + + + + float spec = maskscale.x; + + gcolor.a = 0.5*spec; + + + float glowk = fullbright.y, colork = fullbright.x-fullbright.y; + + + + + glowk /= glowk + colork + 1.0e-3; + gcolor.rgb = gcolor.rgb * (1.0 - 2.0*glowk*(glowk - 1.0)); + #define packnorm 1.0-glowk + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + diff --git a/shaders/tesseract/294.shader_test b/shaders/tesseract/294.shader_test new file mode 100644 index 0000000..4ed7cda --- /dev/null +++ b/shaders/tesseract/294.shader_test @@ -0,0 +1,136 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying vec3 nvec; + + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index]; + vec4 dqdual = animdata[index+1]; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec3 mnormal = cross(mquat.xyz, vec3(mquat.y, -mquat.x, mquat.w))*2.0 + vec3(0.0, 0.0, 1.0); + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + + + nvec = modelworld * mnormal; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying vec3 nvec; + + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + + + + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = normalize(nvec); + + + + float spec = maskscale.x; + + gcolor.a = 0.5*spec; + + + float glowk = fullbright.y, colork = fullbright.x-fullbright.y; + + + + + glowk /= glowk + colork + 1.0e-3; + gcolor.rgb = gcolor.rgb * (1.0 - 2.0*glowk*(glowk - 1.0)); + #define packnorm 1.0-glowk + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + diff --git a/shaders/tesseract/296.shader_test b/shaders/tesseract/296.shader_test new file mode 100644 index 0000000..1ed40ca --- /dev/null +++ b/shaders/tesseract/296.shader_test @@ -0,0 +1,144 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying vec3 nvec; + + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec3 mnormal = cross(mquat.xyz, vec3(mquat.y, -mquat.x, mquat.w))*2.0 + vec3(0.0, 0.0, 1.0); + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + + + nvec = modelworld * mnormal; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying vec3 nvec; + + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + + + + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = normalize(nvec); + + + + float spec = maskscale.x; + + gcolor.a = 0.5*spec; + + + float glowk = fullbright.y, colork = fullbright.x-fullbright.y; + + + + + glowk /= glowk + colork + 1.0e-3; + gcolor.rgb = gcolor.rgb * (1.0 - 2.0*glowk*(glowk - 1.0)); + #define packnorm 1.0-glowk + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + diff --git a/shaders/tesseract/298.shader_test b/shaders/tesseract/298.shader_test new file mode 100644 index 0000000..8c318a0 --- /dev/null +++ b/shaders/tesseract/298.shader_test @@ -0,0 +1,148 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying vec3 nvec; + + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + index = int(vboneindex.z); + dqreal += animdata[index] * vboneweight.z; + dqdual += animdata[index+1] * vboneweight.z; + + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec3 mnormal = cross(mquat.xyz, vec3(mquat.y, -mquat.x, mquat.w))*2.0 + vec3(0.0, 0.0, 1.0); + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + + + nvec = modelworld * mnormal; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying vec3 nvec; + + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + + + + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = normalize(nvec); + + + + float spec = maskscale.x; + + gcolor.a = 0.5*spec; + + + float glowk = fullbright.y, colork = fullbright.x-fullbright.y; + + + + + glowk /= glowk + colork + 1.0e-3; + gcolor.rgb = gcolor.rgb * (1.0 - 2.0*glowk*(glowk - 1.0)); + #define packnorm 1.0-glowk + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + diff --git a/shaders/tesseract/3.shader_test b/shaders/tesseract/3.shader_test new file mode 100644 index 0000000..4560575 --- /dev/null +++ b/shaders/tesseract/3.shader_test @@ -0,0 +1,27 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; +void main(void) { + gl_Position = vvertex; +} + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +fragdata(0, fragcolor, vec4) +void main(void) { + fragcolor = vec4(1.0, 0.0, 1.0, 1.0); +} + diff --git a/shaders/tesseract/30.shader_test b/shaders/tesseract/30.shader_test new file mode 100644 index 0000000..efe71b5 --- /dev/null +++ b/shaders/tesseract/30.shader_test @@ -0,0 +1,49 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#pragma CUBE2_fog + attribute vec4 vvertex, vcolor; + uniform mat4 camprojmatrix; + varying vec4 color; + +uniform vec2 lineardepthscale; +varying float lineardepth; + void main(void) + { + gl_Position = camprojmatrix * vvertex; + color = vcolor; + +lineardepth = dot(lineardepthscale, gl_Position.zw); +} + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +varying vec4 color; + fragdata(0, fragcolor, vec4) + +varying float lineardepth; + +uniform vec3 fogcolor; +uniform vec2 fogdensity; +uniform vec4 radialfogscale; +#define fogcoord lineardepth*length(vec3(gl_FragCoord.xy*radialfogscale.xy + radialfogscale.zw, 1.0)) + void main(void) + { + fragcolor = color; + +#define FOG_COLOR fogcolor +fragcolor.rgb = mix((FOG_COLOR).rgb, fragcolor.rgb, clamp(exp2(fogcoord*-fogdensity.x)*fogdensity.y, 0.0, 1.0)); +} + diff --git a/shaders/tesseract/300.shader_test b/shaders/tesseract/300.shader_test new file mode 100644 index 0000000..f6699b6 --- /dev/null +++ b/shaders/tesseract/300.shader_test @@ -0,0 +1,152 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying vec3 nvec; + + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + index = int(vboneindex.z); + dqreal += animdata[index] * vboneweight.z; + dqdual += animdata[index+1] * vboneweight.z; + + + index = int(vboneindex.w); + dqreal += animdata[index] * vboneweight.w; + dqdual += animdata[index+1] * vboneweight.w; + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec3 mnormal = cross(mquat.xyz, vec3(mquat.y, -mquat.x, mquat.w))*2.0 + vec3(0.0, 0.0, 1.0); + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + + + nvec = modelworld * mnormal; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying vec3 nvec; + + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + + + + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = normalize(nvec); + + + + float spec = maskscale.x; + + gcolor.a = 0.5*spec; + + + float glowk = fullbright.y, colork = fullbright.x-fullbright.y; + + + + + glowk /= glowk + colork + 1.0e-3; + gcolor.rgb = gcolor.rgb * (1.0 - 2.0*glowk*(glowk - 1.0)); + #define packnorm 1.0-glowk + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + diff --git a/shaders/tesseract/302.shader_test b/shaders/tesseract/302.shader_test new file mode 100644 index 0000000..2f84511 --- /dev/null +++ b/shaders/tesseract/302.shader_test @@ -0,0 +1,123 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying vec3 nvec; + + + + varying vec2 texcoord0; + + void main(void) + { + + #define mpos vvertex + #define mquat vtangent + + vec3 mnormal = cross(mquat.xyz, vec3(mquat.y, -mquat.x, mquat.w))*2.0 + vec3(0.0, 0.0, 1.0); + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + + + nvec = modelworld * mnormal; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying vec3 nvec; + + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + + + + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = normalize(nvec); + + + + float spec = maskscale.x; + + gcolor.a = 0.5*spec; + + + float glowk = fullbright.y, colork = fullbright.x-fullbright.y; + + + + gglow.rgb = gcolor.rgb*glowk; + gcolor.rgb *= colork; + #define packnorm colorscale.a + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + + diff --git a/shaders/tesseract/303.shader_test b/shaders/tesseract/303.shader_test new file mode 100644 index 0000000..db180cb --- /dev/null +++ b/shaders/tesseract/303.shader_test @@ -0,0 +1,136 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying vec3 nvec; + + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index]; + vec4 dqdual = animdata[index+1]; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec3 mnormal = cross(mquat.xyz, vec3(mquat.y, -mquat.x, mquat.w))*2.0 + vec3(0.0, 0.0, 1.0); + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + + + nvec = modelworld * mnormal; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying vec3 nvec; + + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + + + + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = normalize(nvec); + + + + float spec = maskscale.x; + + gcolor.a = 0.5*spec; + + + float glowk = fullbright.y, colork = fullbright.x-fullbright.y; + + + + gglow.rgb = gcolor.rgb*glowk; + gcolor.rgb *= colork; + #define packnorm colorscale.a + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + + diff --git a/shaders/tesseract/304.shader_test b/shaders/tesseract/304.shader_test new file mode 100644 index 0000000..88ef6a4 --- /dev/null +++ b/shaders/tesseract/304.shader_test @@ -0,0 +1,144 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying vec3 nvec; + + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec3 mnormal = cross(mquat.xyz, vec3(mquat.y, -mquat.x, mquat.w))*2.0 + vec3(0.0, 0.0, 1.0); + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + + + nvec = modelworld * mnormal; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying vec3 nvec; + + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + + + + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = normalize(nvec); + + + + float spec = maskscale.x; + + gcolor.a = 0.5*spec; + + + float glowk = fullbright.y, colork = fullbright.x-fullbright.y; + + + + gglow.rgb = gcolor.rgb*glowk; + gcolor.rgb *= colork; + #define packnorm colorscale.a + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + + diff --git a/shaders/tesseract/305.shader_test b/shaders/tesseract/305.shader_test new file mode 100644 index 0000000..2791e8c --- /dev/null +++ b/shaders/tesseract/305.shader_test @@ -0,0 +1,148 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying vec3 nvec; + + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + index = int(vboneindex.z); + dqreal += animdata[index] * vboneweight.z; + dqdual += animdata[index+1] * vboneweight.z; + + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec3 mnormal = cross(mquat.xyz, vec3(mquat.y, -mquat.x, mquat.w))*2.0 + vec3(0.0, 0.0, 1.0); + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + + + nvec = modelworld * mnormal; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying vec3 nvec; + + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + + + + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = normalize(nvec); + + + + float spec = maskscale.x; + + gcolor.a = 0.5*spec; + + + float glowk = fullbright.y, colork = fullbright.x-fullbright.y; + + + + gglow.rgb = gcolor.rgb*glowk; + gcolor.rgb *= colork; + #define packnorm colorscale.a + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + + diff --git a/shaders/tesseract/306.shader_test b/shaders/tesseract/306.shader_test new file mode 100644 index 0000000..f4d0cca --- /dev/null +++ b/shaders/tesseract/306.shader_test @@ -0,0 +1,151 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying vec3 nvec; + + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + index = int(vboneindex.z); + dqreal += animdata[index] * vboneweight.z; + dqdual += animdata[index+1] * vboneweight.z; + + + index = int(vboneindex.w); + dqreal += animdata[index] * vboneweight.w; + dqdual += animdata[index+1] * vboneweight.w; + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec3 mnormal = cross(mquat.xyz, vec3(mquat.y, -mquat.x, mquat.w))*2.0 + vec3(0.0, 0.0, 1.0); + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + + + nvec = modelworld * mnormal; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying vec3 nvec; + + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + + + + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = normalize(nvec); + + + + float spec = maskscale.x; + + gcolor.a = 0.5*spec; + + + float glowk = fullbright.y, colork = fullbright.x-fullbright.y; + + + + gglow.rgb = gcolor.rgb*glowk; + gcolor.rgb *= colork; + #define packnorm colorscale.a + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + diff --git a/shaders/tesseract/309.shader_test b/shaders/tesseract/309.shader_test new file mode 100644 index 0000000..96da870 --- /dev/null +++ b/shaders/tesseract/309.shader_test @@ -0,0 +1,155 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + varying vec3 camvec; + + + varying vec2 texcoord0; + + void main(void) + { + + #define mpos vvertex + #define mquat vtangent + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + camvec = modelworld * normalize(modelcamera - mpos.xyz); + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec2 envmapscale; + varying vec3 camvec; + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + uniform float alphatest; + uniform sampler2D tex0; + uniform sampler2D tex1; + uniform samplerCube tex2; + uniform sampler2D tex3; + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + if(diffuse.a <= alphatest) + discard; + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + vec3 camn = normalize(camvec); + float invfresnel = dot(camn, normal); + vec3 rvec = 2.0*invfresnel*normal - camn; + float rmod = envmapscale.x*clamp(invfresnel, 0.0, 1.0) + envmapscale.y; + vec3 reflect = textureCube(tex2, rvec).rgb; + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*masks.b); + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + + glowk /= glowk + colork + 1.0e-3; + gcolor.rgb = gcolor.rgb * (1.0 - 2.0*glowk*(glowk - 1.0)); + #define packnorm 1.0-glowk + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + diff --git a/shaders/tesseract/311.shader_test b/shaders/tesseract/311.shader_test new file mode 100644 index 0000000..1629f07 --- /dev/null +++ b/shaders/tesseract/311.shader_test @@ -0,0 +1,168 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + varying vec3 camvec; + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index]; + vec4 dqdual = animdata[index+1]; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + camvec = modelworld * normalize(modelcamera - mpos.xyz); + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec2 envmapscale; + varying vec3 camvec; + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + uniform float alphatest; + uniform sampler2D tex0; + uniform sampler2D tex1; + uniform samplerCube tex2; + uniform sampler2D tex3; + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + if(diffuse.a <= alphatest) + discard; + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + vec3 camn = normalize(camvec); + float invfresnel = dot(camn, normal); + vec3 rvec = 2.0*invfresnel*normal - camn; + float rmod = envmapscale.x*clamp(invfresnel, 0.0, 1.0) + envmapscale.y; + vec3 reflect = textureCube(tex2, rvec).rgb; + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*masks.b); + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + + glowk /= glowk + colork + 1.0e-3; + gcolor.rgb = gcolor.rgb * (1.0 - 2.0*glowk*(glowk - 1.0)); + #define packnorm 1.0-glowk + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + diff --git a/shaders/tesseract/313.shader_test b/shaders/tesseract/313.shader_test new file mode 100644 index 0000000..c5f4593 --- /dev/null +++ b/shaders/tesseract/313.shader_test @@ -0,0 +1,176 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + varying vec3 camvec; + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + camvec = modelworld * normalize(modelcamera - mpos.xyz); + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec2 envmapscale; + varying vec3 camvec; + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + uniform float alphatest; + uniform sampler2D tex0; + uniform sampler2D tex1; + uniform samplerCube tex2; + uniform sampler2D tex3; + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + if(diffuse.a <= alphatest) + discard; + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + vec3 camn = normalize(camvec); + float invfresnel = dot(camn, normal); + vec3 rvec = 2.0*invfresnel*normal - camn; + float rmod = envmapscale.x*clamp(invfresnel, 0.0, 1.0) + envmapscale.y; + vec3 reflect = textureCube(tex2, rvec).rgb; + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*masks.b); + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + + glowk /= glowk + colork + 1.0e-3; + gcolor.rgb = gcolor.rgb * (1.0 - 2.0*glowk*(glowk - 1.0)); + #define packnorm 1.0-glowk + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + diff --git a/shaders/tesseract/315.shader_test b/shaders/tesseract/315.shader_test new file mode 100644 index 0000000..a30bd81 --- /dev/null +++ b/shaders/tesseract/315.shader_test @@ -0,0 +1,180 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + varying vec3 camvec; + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + index = int(vboneindex.z); + dqreal += animdata[index] * vboneweight.z; + dqdual += animdata[index+1] * vboneweight.z; + + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + camvec = modelworld * normalize(modelcamera - mpos.xyz); + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec2 envmapscale; + varying vec3 camvec; + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + uniform float alphatest; + uniform sampler2D tex0; + uniform sampler2D tex1; + uniform samplerCube tex2; + uniform sampler2D tex3; + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + if(diffuse.a <= alphatest) + discard; + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + vec3 camn = normalize(camvec); + float invfresnel = dot(camn, normal); + vec3 rvec = 2.0*invfresnel*normal - camn; + float rmod = envmapscale.x*clamp(invfresnel, 0.0, 1.0) + envmapscale.y; + vec3 reflect = textureCube(tex2, rvec).rgb; + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*masks.b); + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + + glowk /= glowk + colork + 1.0e-3; + gcolor.rgb = gcolor.rgb * (1.0 - 2.0*glowk*(glowk - 1.0)); + #define packnorm 1.0-glowk + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + diff --git a/shaders/tesseract/317.shader_test b/shaders/tesseract/317.shader_test new file mode 100644 index 0000000..f160716 --- /dev/null +++ b/shaders/tesseract/317.shader_test @@ -0,0 +1,184 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + varying vec3 camvec; + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + index = int(vboneindex.z); + dqreal += animdata[index] * vboneweight.z; + dqdual += animdata[index+1] * vboneweight.z; + + + index = int(vboneindex.w); + dqreal += animdata[index] * vboneweight.w; + dqdual += animdata[index+1] * vboneweight.w; + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + camvec = modelworld * normalize(modelcamera - mpos.xyz); + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec2 envmapscale; + varying vec3 camvec; + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + uniform float alphatest; + uniform sampler2D tex0; + uniform sampler2D tex1; + uniform samplerCube tex2; + uniform sampler2D tex3; + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + if(diffuse.a <= alphatest) + discard; + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + vec3 camn = normalize(camvec); + float invfresnel = dot(camn, normal); + vec3 rvec = 2.0*invfresnel*normal - camn; + float rmod = envmapscale.x*clamp(invfresnel, 0.0, 1.0) + envmapscale.y; + vec3 reflect = textureCube(tex2, rvec).rgb; + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*masks.b); + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + + glowk /= glowk + colork + 1.0e-3; + gcolor.rgb = gcolor.rgb * (1.0 - 2.0*glowk*(glowk - 1.0)); + #define packnorm 1.0-glowk + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + diff --git a/shaders/tesseract/319.shader_test b/shaders/tesseract/319.shader_test new file mode 100644 index 0000000..4d98fd8 --- /dev/null +++ b/shaders/tesseract/319.shader_test @@ -0,0 +1,155 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + varying vec3 camvec; + + + varying vec2 texcoord0; + + void main(void) + { + + #define mpos vvertex + #define mquat vtangent + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + camvec = modelworld * normalize(modelcamera - mpos.xyz); + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec2 envmapscale; + varying vec3 camvec; + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + uniform float alphatest; + uniform sampler2D tex0; + uniform sampler2D tex1; + uniform samplerCube tex2; + uniform sampler2D tex3; + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + if(diffuse.a <= alphatest) + discard; + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + vec3 camn = normalize(camvec); + float invfresnel = dot(camn, normal); + vec3 rvec = 2.0*invfresnel*normal - camn; + float rmod = envmapscale.x*clamp(invfresnel, 0.0, 1.0) + envmapscale.y; + vec3 reflect = textureCube(tex2, rvec).rgb; + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*masks.b); + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + gglow.rgb = gcolor.rgb*glowk; + gcolor.rgb *= colork; + #define packnorm colorscale.a + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + + diff --git a/shaders/tesseract/320.shader_test b/shaders/tesseract/320.shader_test new file mode 100644 index 0000000..bb740b6 --- /dev/null +++ b/shaders/tesseract/320.shader_test @@ -0,0 +1,168 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + varying vec3 camvec; + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index]; + vec4 dqdual = animdata[index+1]; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + camvec = modelworld * normalize(modelcamera - mpos.xyz); + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec2 envmapscale; + varying vec3 camvec; + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + uniform float alphatest; + uniform sampler2D tex0; + uniform sampler2D tex1; + uniform samplerCube tex2; + uniform sampler2D tex3; + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + if(diffuse.a <= alphatest) + discard; + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + vec3 camn = normalize(camvec); + float invfresnel = dot(camn, normal); + vec3 rvec = 2.0*invfresnel*normal - camn; + float rmod = envmapscale.x*clamp(invfresnel, 0.0, 1.0) + envmapscale.y; + vec3 reflect = textureCube(tex2, rvec).rgb; + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*masks.b); + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + gglow.rgb = gcolor.rgb*glowk; + gcolor.rgb *= colork; + #define packnorm colorscale.a + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + + diff --git a/shaders/tesseract/321.shader_test b/shaders/tesseract/321.shader_test new file mode 100644 index 0000000..ec6dcb1 --- /dev/null +++ b/shaders/tesseract/321.shader_test @@ -0,0 +1,176 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + varying vec3 camvec; + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + camvec = modelworld * normalize(modelcamera - mpos.xyz); + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec2 envmapscale; + varying vec3 camvec; + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + uniform float alphatest; + uniform sampler2D tex0; + uniform sampler2D tex1; + uniform samplerCube tex2; + uniform sampler2D tex3; + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + if(diffuse.a <= alphatest) + discard; + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + vec3 camn = normalize(camvec); + float invfresnel = dot(camn, normal); + vec3 rvec = 2.0*invfresnel*normal - camn; + float rmod = envmapscale.x*clamp(invfresnel, 0.0, 1.0) + envmapscale.y; + vec3 reflect = textureCube(tex2, rvec).rgb; + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*masks.b); + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + gglow.rgb = gcolor.rgb*glowk; + gcolor.rgb *= colork; + #define packnorm colorscale.a + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + + diff --git a/shaders/tesseract/322.shader_test b/shaders/tesseract/322.shader_test new file mode 100644 index 0000000..237e7e5 --- /dev/null +++ b/shaders/tesseract/322.shader_test @@ -0,0 +1,180 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + varying vec3 camvec; + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + index = int(vboneindex.z); + dqreal += animdata[index] * vboneweight.z; + dqdual += animdata[index+1] * vboneweight.z; + + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + camvec = modelworld * normalize(modelcamera - mpos.xyz); + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec2 envmapscale; + varying vec3 camvec; + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + uniform float alphatest; + uniform sampler2D tex0; + uniform sampler2D tex1; + uniform samplerCube tex2; + uniform sampler2D tex3; + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + if(diffuse.a <= alphatest) + discard; + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + vec3 camn = normalize(camvec); + float invfresnel = dot(camn, normal); + vec3 rvec = 2.0*invfresnel*normal - camn; + float rmod = envmapscale.x*clamp(invfresnel, 0.0, 1.0) + envmapscale.y; + vec3 reflect = textureCube(tex2, rvec).rgb; + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*masks.b); + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + gglow.rgb = gcolor.rgb*glowk; + gcolor.rgb *= colork; + #define packnorm colorscale.a + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + + diff --git a/shaders/tesseract/323.shader_test b/shaders/tesseract/323.shader_test new file mode 100644 index 0000000..6638ab4 --- /dev/null +++ b/shaders/tesseract/323.shader_test @@ -0,0 +1,183 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + varying vec3 camvec; + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + index = int(vboneindex.z); + dqreal += animdata[index] * vboneweight.z; + dqdual += animdata[index+1] * vboneweight.z; + + + index = int(vboneindex.w); + dqreal += animdata[index] * vboneweight.w; + dqdual += animdata[index+1] * vboneweight.w; + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + camvec = modelworld * normalize(modelcamera - mpos.xyz); + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec2 envmapscale; + varying vec3 camvec; + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + uniform float alphatest; + uniform sampler2D tex0; + uniform sampler2D tex1; + uniform samplerCube tex2; + uniform sampler2D tex3; + + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + if(diffuse.a <= alphatest) + discard; + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + vec3 camn = normalize(camvec); + float invfresnel = dot(camn, normal); + vec3 rvec = 2.0*invfresnel*normal - camn; + float rmod = envmapscale.x*clamp(invfresnel, 0.0, 1.0) + envmapscale.y; + vec3 reflect = textureCube(tex2, rvec).rgb; + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*masks.b); + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + gglow.rgb = gcolor.rgb*glowk; + gcolor.rgb *= colork; + #define packnorm colorscale.a + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + diff --git a/shaders/tesseract/326.shader_test b/shaders/tesseract/326.shader_test new file mode 100644 index 0000000..1a8384c --- /dev/null +++ b/shaders/tesseract/326.shader_test @@ -0,0 +1,157 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + varying vec3 camvec; + + + varying vec2 texcoord0; + + void main(void) + { + + #define mpos vvertex + #define mquat vtangent + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + camvec = modelworld * normalize(modelcamera - mpos.xyz); + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec2 envmapscale; + varying vec3 camvec; + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + uniform sampler2D tex1; + uniform samplerCube tex2; + uniform sampler2D tex3; + uniform sampler2D tex4; + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + vec4 decal = texture2D(tex4, texcoord0); + + gcolor.rgb = mix(gcolor.rgb, decal.rgb, decal.a); + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + vec3 camn = normalize(camvec); + float invfresnel = dot(camn, normal); + vec3 rvec = 2.0*invfresnel*normal - camn; + float rmod = envmapscale.x*clamp(invfresnel, 0.0, 1.0) + envmapscale.y; + vec3 reflect = textureCube(tex2, rvec).rgb; + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*masks.b); + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + + glowk /= glowk + colork + 1.0e-3; + gcolor.rgb = gcolor.rgb * (1.0 - 2.0*glowk*(glowk - 1.0)); + #define packnorm 1.0-glowk + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + diff --git a/shaders/tesseract/328.shader_test b/shaders/tesseract/328.shader_test new file mode 100644 index 0000000..ee87eb0 --- /dev/null +++ b/shaders/tesseract/328.shader_test @@ -0,0 +1,170 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + varying vec3 camvec; + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index]; + vec4 dqdual = animdata[index+1]; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + camvec = modelworld * normalize(modelcamera - mpos.xyz); + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec2 envmapscale; + varying vec3 camvec; + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + uniform sampler2D tex1; + uniform samplerCube tex2; + uniform sampler2D tex3; + uniform sampler2D tex4; + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + vec4 decal = texture2D(tex4, texcoord0); + + gcolor.rgb = mix(gcolor.rgb, decal.rgb, decal.a); + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + vec3 camn = normalize(camvec); + float invfresnel = dot(camn, normal); + vec3 rvec = 2.0*invfresnel*normal - camn; + float rmod = envmapscale.x*clamp(invfresnel, 0.0, 1.0) + envmapscale.y; + vec3 reflect = textureCube(tex2, rvec).rgb; + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*masks.b); + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + + glowk /= glowk + colork + 1.0e-3; + gcolor.rgb = gcolor.rgb * (1.0 - 2.0*glowk*(glowk - 1.0)); + #define packnorm 1.0-glowk + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + diff --git a/shaders/tesseract/33.shader_test b/shaders/tesseract/33.shader_test new file mode 100644 index 0000000..cdf508c --- /dev/null +++ b/shaders/tesseract/33.shader_test @@ -0,0 +1,32 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vcolor; + varying vec4 color; + void main(void) + { + gl_Position = vvertex; + color = vcolor; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +varying vec4 color; + fragdata(0, fragcolor, vec4) + void main(void) + { + fragcolor = color; + } + diff --git a/shaders/tesseract/330.shader_test b/shaders/tesseract/330.shader_test new file mode 100644 index 0000000..eac9954 --- /dev/null +++ b/shaders/tesseract/330.shader_test @@ -0,0 +1,178 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + varying vec3 camvec; + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + camvec = modelworld * normalize(modelcamera - mpos.xyz); + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec2 envmapscale; + varying vec3 camvec; + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + uniform sampler2D tex1; + uniform samplerCube tex2; + uniform sampler2D tex3; + uniform sampler2D tex4; + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + vec4 decal = texture2D(tex4, texcoord0); + + gcolor.rgb = mix(gcolor.rgb, decal.rgb, decal.a); + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + vec3 camn = normalize(camvec); + float invfresnel = dot(camn, normal); + vec3 rvec = 2.0*invfresnel*normal - camn; + float rmod = envmapscale.x*clamp(invfresnel, 0.0, 1.0) + envmapscale.y; + vec3 reflect = textureCube(tex2, rvec).rgb; + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*masks.b); + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + + glowk /= glowk + colork + 1.0e-3; + gcolor.rgb = gcolor.rgb * (1.0 - 2.0*glowk*(glowk - 1.0)); + #define packnorm 1.0-glowk + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + diff --git a/shaders/tesseract/332.shader_test b/shaders/tesseract/332.shader_test new file mode 100644 index 0000000..de5d491 --- /dev/null +++ b/shaders/tesseract/332.shader_test @@ -0,0 +1,182 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + varying vec3 camvec; + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + index = int(vboneindex.z); + dqreal += animdata[index] * vboneweight.z; + dqdual += animdata[index+1] * vboneweight.z; + + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + camvec = modelworld * normalize(modelcamera - mpos.xyz); + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec2 envmapscale; + varying vec3 camvec; + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + uniform sampler2D tex1; + uniform samplerCube tex2; + uniform sampler2D tex3; + uniform sampler2D tex4; + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + vec4 decal = texture2D(tex4, texcoord0); + + gcolor.rgb = mix(gcolor.rgb, decal.rgb, decal.a); + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + vec3 camn = normalize(camvec); + float invfresnel = dot(camn, normal); + vec3 rvec = 2.0*invfresnel*normal - camn; + float rmod = envmapscale.x*clamp(invfresnel, 0.0, 1.0) + envmapscale.y; + vec3 reflect = textureCube(tex2, rvec).rgb; + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*masks.b); + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + + glowk /= glowk + colork + 1.0e-3; + gcolor.rgb = gcolor.rgb * (1.0 - 2.0*glowk*(glowk - 1.0)); + #define packnorm 1.0-glowk + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + diff --git a/shaders/tesseract/334.shader_test b/shaders/tesseract/334.shader_test new file mode 100644 index 0000000..cde862c --- /dev/null +++ b/shaders/tesseract/334.shader_test @@ -0,0 +1,186 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + varying vec3 camvec; + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + index = int(vboneindex.z); + dqreal += animdata[index] * vboneweight.z; + dqdual += animdata[index+1] * vboneweight.z; + + + index = int(vboneindex.w); + dqreal += animdata[index] * vboneweight.w; + dqdual += animdata[index+1] * vboneweight.w; + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + camvec = modelworld * normalize(modelcamera - mpos.xyz); + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec2 envmapscale; + varying vec3 camvec; + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + uniform sampler2D tex1; + uniform samplerCube tex2; + uniform sampler2D tex3; + uniform sampler2D tex4; + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + vec4 decal = texture2D(tex4, texcoord0); + + gcolor.rgb = mix(gcolor.rgb, decal.rgb, decal.a); + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + vec3 camn = normalize(camvec); + float invfresnel = dot(camn, normal); + vec3 rvec = 2.0*invfresnel*normal - camn; + float rmod = envmapscale.x*clamp(invfresnel, 0.0, 1.0) + envmapscale.y; + vec3 reflect = textureCube(tex2, rvec).rgb; + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*masks.b); + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + + glowk /= glowk + colork + 1.0e-3; + gcolor.rgb = gcolor.rgb * (1.0 - 2.0*glowk*(glowk - 1.0)); + #define packnorm 1.0-glowk + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + diff --git a/shaders/tesseract/336.shader_test b/shaders/tesseract/336.shader_test new file mode 100644 index 0000000..b8544ca --- /dev/null +++ b/shaders/tesseract/336.shader_test @@ -0,0 +1,157 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + varying vec3 camvec; + + + varying vec2 texcoord0; + + void main(void) + { + + #define mpos vvertex + #define mquat vtangent + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + camvec = modelworld * normalize(modelcamera - mpos.xyz); + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec2 envmapscale; + varying vec3 camvec; + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + uniform sampler2D tex1; + uniform samplerCube tex2; + uniform sampler2D tex3; + uniform sampler2D tex4; + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + vec4 decal = texture2D(tex4, texcoord0); + + gcolor.rgb = mix(gcolor.rgb, decal.rgb, decal.a); + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + vec3 camn = normalize(camvec); + float invfresnel = dot(camn, normal); + vec3 rvec = 2.0*invfresnel*normal - camn; + float rmod = envmapscale.x*clamp(invfresnel, 0.0, 1.0) + envmapscale.y; + vec3 reflect = textureCube(tex2, rvec).rgb; + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*masks.b); + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + gglow.rgb = gcolor.rgb*glowk; + gcolor.rgb *= colork; + #define packnorm colorscale.a + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + + diff --git a/shaders/tesseract/337.shader_test b/shaders/tesseract/337.shader_test new file mode 100644 index 0000000..c4cea1f --- /dev/null +++ b/shaders/tesseract/337.shader_test @@ -0,0 +1,170 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + varying vec3 camvec; + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index]; + vec4 dqdual = animdata[index+1]; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + camvec = modelworld * normalize(modelcamera - mpos.xyz); + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec2 envmapscale; + varying vec3 camvec; + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + uniform sampler2D tex1; + uniform samplerCube tex2; + uniform sampler2D tex3; + uniform sampler2D tex4; + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + vec4 decal = texture2D(tex4, texcoord0); + + gcolor.rgb = mix(gcolor.rgb, decal.rgb, decal.a); + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + vec3 camn = normalize(camvec); + float invfresnel = dot(camn, normal); + vec3 rvec = 2.0*invfresnel*normal - camn; + float rmod = envmapscale.x*clamp(invfresnel, 0.0, 1.0) + envmapscale.y; + vec3 reflect = textureCube(tex2, rvec).rgb; + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*masks.b); + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + gglow.rgb = gcolor.rgb*glowk; + gcolor.rgb *= colork; + #define packnorm colorscale.a + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + + diff --git a/shaders/tesseract/338.shader_test b/shaders/tesseract/338.shader_test new file mode 100644 index 0000000..47778bf --- /dev/null +++ b/shaders/tesseract/338.shader_test @@ -0,0 +1,178 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + varying vec3 camvec; + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + camvec = modelworld * normalize(modelcamera - mpos.xyz); + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec2 envmapscale; + varying vec3 camvec; + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + uniform sampler2D tex1; + uniform samplerCube tex2; + uniform sampler2D tex3; + uniform sampler2D tex4; + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + vec4 decal = texture2D(tex4, texcoord0); + + gcolor.rgb = mix(gcolor.rgb, decal.rgb, decal.a); + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + vec3 camn = normalize(camvec); + float invfresnel = dot(camn, normal); + vec3 rvec = 2.0*invfresnel*normal - camn; + float rmod = envmapscale.x*clamp(invfresnel, 0.0, 1.0) + envmapscale.y; + vec3 reflect = textureCube(tex2, rvec).rgb; + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*masks.b); + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + gglow.rgb = gcolor.rgb*glowk; + gcolor.rgb *= colork; + #define packnorm colorscale.a + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + + diff --git a/shaders/tesseract/339.shader_test b/shaders/tesseract/339.shader_test new file mode 100644 index 0000000..479ffbf --- /dev/null +++ b/shaders/tesseract/339.shader_test @@ -0,0 +1,182 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + varying vec3 camvec; + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + index = int(vboneindex.z); + dqreal += animdata[index] * vboneweight.z; + dqdual += animdata[index+1] * vboneweight.z; + + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + camvec = modelworld * normalize(modelcamera - mpos.xyz); + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec2 envmapscale; + varying vec3 camvec; + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + uniform sampler2D tex1; + uniform samplerCube tex2; + uniform sampler2D tex3; + uniform sampler2D tex4; + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + vec4 decal = texture2D(tex4, texcoord0); + + gcolor.rgb = mix(gcolor.rgb, decal.rgb, decal.a); + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + vec3 camn = normalize(camvec); + float invfresnel = dot(camn, normal); + vec3 rvec = 2.0*invfresnel*normal - camn; + float rmod = envmapscale.x*clamp(invfresnel, 0.0, 1.0) + envmapscale.y; + vec3 reflect = textureCube(tex2, rvec).rgb; + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*masks.b); + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + gglow.rgb = gcolor.rgb*glowk; + gcolor.rgb *= colork; + #define packnorm colorscale.a + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + + diff --git a/shaders/tesseract/340.shader_test b/shaders/tesseract/340.shader_test new file mode 100644 index 0000000..57bbb93 --- /dev/null +++ b/shaders/tesseract/340.shader_test @@ -0,0 +1,185 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec3 modelcamera; + uniform vec2 texscroll; + + varying mat3 world; + + + varying vec3 camvec; + + + varying vec2 texcoord0; + + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + index = int(vboneindex.z); + dqreal += animdata[index] * vboneweight.z; + dqdual += animdata[index+1] * vboneweight.z; + + + index = int(vboneindex.w); + dqreal += animdata[index] * vboneweight.w; + dqdual += animdata[index+1] * vboneweight.w; + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec4 qxyz = mquat.xxyy*mquat.yzyz, qxzw = vec4(mquat.xzw, -mquat.w); + vec3 mtangent = (qxzw.yzw*mquat.zzy + qxyz.zxy)*vec3(-2.0, 2.0, 2.0) + vec3(1.0, 0.0, 0.0); + vec3 mnormal = (qxzw.zwx*mquat.yxx + qxyz.ywz)*vec3(2.0, 2.0, -2.0) + vec3(0.0, 0.0, 1.0); + + + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + + + + camvec = modelworld * normalize(modelcamera - mpos.xyz); + + + + + + vec3 wnormal = modelworld * mnormal; + vec3 wtangent = modelworld * mtangent; + vec3 wbitangent = cross(wnormal, wtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0); + world = mat3(wtangent, wbitangent, wnormal); + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +varying mat3 world; + + + uniform vec2 envmapscale; + varying vec3 camvec; + + uniform vec4 colorscale; + uniform vec2 fullbright; + uniform vec2 maskscale; + + uniform sampler2D tex0; + uniform sampler2D tex1; + uniform samplerCube tex2; + uniform sampler2D tex3; + uniform sampler2D tex4; + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + varying vec2 texcoord0; + uniform float aamask; + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + + + gcolor.rgb = diffuse.rgb*colorscale.rgb; + + + vec4 decal = texture2D(tex4, texcoord0); + + gcolor.rgb = mix(gcolor.rgb, decal.rgb, decal.a); + + + + + vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + + normal = normalize(world * normal); + + + float spec = maskscale.x; + + vec3 masks = texture2D(tex1, texcoord0).rgb; + spec *= masks.r; + + + vec3 camn = normalize(camvec); + float invfresnel = dot(camn, normal); + vec3 rvec = 2.0*invfresnel*normal - camn; + float rmod = envmapscale.x*clamp(invfresnel, 0.0, 1.0) + envmapscale.y; + vec3 reflect = textureCube(tex2, rvec).rgb; + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*masks.b); + + + gcolor.a = 0.5*spec; + + + float glowk = max(maskscale.y*masks.g, fullbright.y), colork = max(fullbright.x-glowk, 0.0); + + + + gglow.rgb = gcolor.rgb*glowk; + gcolor.rgb *= colork; + #define packnorm colorscale.a + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + } + diff --git a/shaders/tesseract/343.shader_test b/shaders/tesseract/343.shader_test new file mode 100644 index 0000000..c6d38c6 --- /dev/null +++ b/shaders/tesseract/343.shader_test @@ -0,0 +1,240 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 ; + + + uniform sampler2DRectShadow tex4; + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform mat3 csmmatrix; + uniform vec3 sunlightdir; + uniform vec3 sunlightcolor; + + uniform vec3 skylightcolor; + uniform float giscale, rhnudge; + uniform vec4 rhbb[2]; + uniform vec3 rhscale[2]; + uniform vec3 rhoffset[2]; + uniform sampler3D tex6, tex7, tex8, tex9; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + uniform sampler2DRect tex5; uniform vec2 aoscale; uniform vec4 aoparams; + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + + + #define shadowval(center, xoff, yoff) float(shadow2DRect(tex4, center + vec3(xoff, yoff, 0.0))) + float filtershadow(vec3 shadowtc) + { + vec2 offset = fract(shadowtc.xy - 0.5); + vec3 center = shadowtc; + + + + + + + + center.xy -= offset*0.5; + vec4 size = vec4(offset + 1.0, 2.0 - offset); + return (1.0/9.0)*dot(size.zxzx*size.wwyy, + vec4(shadowval(center, -0.5, -0.5), + shadowval(center, 1.0, -0.5), + shadowval(center, -0.5, 1.0), + shadowval(center, 1.0, 1.0))); + } + + + + vec3 getcsmtc(vec3 pos, float distbias) + { + pos = csmmatrix * pos; + pos.z -= distbias; + + if(all(lessThan(abs(pos - splitcenter[0]), splitbounds[0]))) + pos = pos*splitscale[0] + splitoffset[0]; + else + + if(all(lessThan(abs(pos - splitcenter[1]), splitbounds[1]))) + pos = pos*splitscale[1] + splitoffset[1]; + else + + if(all(lessThan(abs(pos.xy - splitcenter[2].xy), splitbounds[2].xy))) + pos = pos*splitscale[2] + splitoffset[2]; + else pos = vec3(-1.0); + return pos; + } + + + vec4 getrhlight(vec3 pos, vec3 norm) + { + vec3 tc; + pos += norm*rhnudge; + + if(all(lessThan(abs(pos - rhbb[0].xyz), vec3(rhbb[0].w)))) + tc = pos*rhscale[0] + rhoffset[0]; + else + + if(all(lessThan(abs(pos - rhbb[1].xyz), vec3(rhbb[1].w)))) + tc = pos*rhscale[1] + rhoffset[1]; + else + + tc = vec3(-1.0); + vec4 shr = texture3D(tex6, tc), shg = texture3D(tex7, tc), shb = texture3D(tex8, tc), sha = texture3D(tex9, tc); + shr.rgb -= 0.5; + shg.rgb -= 0.5; + shb.rgb -= 0.5; + sha.rgb -= 0.5; + vec4 basis = vec4(norm*-(1.023326*0.488603/3.14159*2.0), (0.886226*0.282095/3.14159)); + return clamp(vec4(dot(basis, shr), dot(basis, shg), dot(basis, shb), min(dot(basis, sha), norm.z + 1.0)), 0.0, 1.0); + } + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + float alpha = float(normal.x + normal.y != 0.0); + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define glowscale normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + vec3 glow = diffuse.rgb * (1.0 - glowscale); + + diffuse.rgb *= glowscale; + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + + + + vec3 light = lightscale.rgb; + + vec4 rhlight = getrhlight(pos.xyz, normal.xyz); + light += rhlight.a * skylightcolor; + + light *= diffuse.rgb; + + float ao = texture2DRect(tex5, gl_FragCoord.xy*aoscale).r; + light *= aoparams.x + ao*aoparams.y; + + light += glow * lightscale.a; + + + + + vec3 sunlight = rhlight.rgb * giscale * diffuse.rgb; + + float sunfacing = dot(sunlightdir, normal.xyz); + if(sunfacing > 0.0) + { + + #define distbias 0.0 + + vec3 csmtc = getcsmtc(pos.xyz, distbias); + float sunoccluded = sunfacing * filtershadow(csmtc); + + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + float sunspec = pow(clamp(sunfacing*facing - dot(camdir, sunlightdir), 0.0, 1.0), 16.0) * diffuse.a; + + sunlight += (diffuse.rgb + sunspec) * sunoccluded; + + + } + + + sunlight *= aoparams.z + ao*aoparams.w; + + light += sunlight * sunlightcolor; + + + + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(mix(fogcolor*alpha, light, foglerp)); + accumalpha(alpha); + + + + + } + diff --git a/shaders/tesseract/345.shader_test b/shaders/tesseract/345.shader_test new file mode 100644 index 0000000..71b2e50 --- /dev/null +++ b/shaders/tesseract/345.shader_test @@ -0,0 +1,237 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 , tex2; + + + uniform sampler2DRectShadow tex4; + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform mat3 csmmatrix; + uniform vec3 sunlightdir; + uniform vec3 sunlightcolor; + + uniform vec3 skylightcolor; + uniform float giscale, rhnudge; + uniform vec4 rhbb[2]; + uniform vec3 rhscale[2]; + uniform vec3 rhoffset[2]; + uniform sampler3D tex6, tex7, tex8, tex9; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + uniform sampler2DRect tex5; uniform vec2 aoscale; uniform vec4 aoparams; + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + + + #define shadowval(center, xoff, yoff) float(shadow2DRect(tex4, center + vec3(xoff, yoff, 0.0))) + float filtershadow(vec3 shadowtc) + { + vec2 offset = fract(shadowtc.xy - 0.5); + vec3 center = shadowtc; + + + + + + + + center.xy -= offset*0.5; + vec4 size = vec4(offset + 1.0, 2.0 - offset); + return (1.0/9.0)*dot(size.zxzx*size.wwyy, + vec4(shadowval(center, -0.5, -0.5), + shadowval(center, 1.0, -0.5), + shadowval(center, -0.5, 1.0), + shadowval(center, 1.0, 1.0))); + } + + + + vec3 getcsmtc(vec3 pos, float distbias) + { + pos = csmmatrix * pos; + pos.z -= distbias; + + if(all(lessThan(abs(pos - splitcenter[0]), splitbounds[0]))) + pos = pos*splitscale[0] + splitoffset[0]; + else + + if(all(lessThan(abs(pos - splitcenter[1]), splitbounds[1]))) + pos = pos*splitscale[1] + splitoffset[1]; + else + + if(all(lessThan(abs(pos.xy - splitcenter[2].xy), splitbounds[2].xy))) + pos = pos*splitscale[2] + splitoffset[2]; + else pos = vec3(-1.0); + return pos; + } + + + vec4 getrhlight(vec3 pos, vec3 norm) + { + vec3 tc; + pos += norm*rhnudge; + + if(all(lessThan(abs(pos - rhbb[0].xyz), vec3(rhbb[0].w)))) + tc = pos*rhscale[0] + rhoffset[0]; + else + + if(all(lessThan(abs(pos - rhbb[1].xyz), vec3(rhbb[1].w)))) + tc = pos*rhscale[1] + rhoffset[1]; + else + + tc = vec3(-1.0); + vec4 shr = texture3D(tex6, tc), shg = texture3D(tex7, tc), shb = texture3D(tex8, tc), sha = texture3D(tex9, tc); + shr.rgb -= 0.5; + shg.rgb -= 0.5; + shb.rgb -= 0.5; + sha.rgb -= 0.5; + vec4 basis = vec4(norm*-(1.023326*0.488603/3.14159*2.0), (0.886226*0.282095/3.14159)); + return clamp(vec4(dot(basis, shr), dot(basis, shg), dot(basis, shb), min(dot(basis, sha), norm.z + 1.0)), 0.0, 1.0); + } + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define alpha normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + vec3 glow = gfetch(tex2, gl_FragCoord.xy).rgb; + + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + + + + vec3 light = lightscale.rgb; + + vec4 rhlight = getrhlight(pos.xyz, normal.xyz); + light += rhlight.a * skylightcolor; + + light *= diffuse.rgb; + + float ao = texture2DRect(tex5, gl_FragCoord.xy*aoscale).r; + light *= aoparams.x + ao*aoparams.y; + + light += glow * lightscale.a; + + + + + vec3 sunlight = rhlight.rgb * giscale * diffuse.rgb; + + float sunfacing = dot(sunlightdir, normal.xyz); + if(sunfacing > 0.0) + { + + #define distbias 0.0 + + vec3 csmtc = getcsmtc(pos.xyz, distbias); + float sunoccluded = sunfacing * filtershadow(csmtc); + + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + float sunspec = pow(clamp(sunfacing*facing - dot(camdir, sunlightdir), 0.0, 1.0), 16.0) * diffuse.a; + + sunlight += (diffuse.rgb + sunspec) * sunoccluded; + + + } + + + sunlight *= aoparams.z + ao*aoparams.w; + + light += sunlight * sunlightcolor; + + + + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(mix(fogcolor*alpha, light, foglerp)); + accumalpha(alpha); + + + + + } + diff --git a/shaders/tesseract/347.shader_test b/shaders/tesseract/347.shader_test new file mode 100644 index 0000000..0fbadd7 --- /dev/null +++ b/shaders/tesseract/347.shader_test @@ -0,0 +1,240 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 ; + + + uniform sampler2DRectShadow tex4; + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform mat3 csmmatrix; + uniform vec3 sunlightdir; + uniform vec3 sunlightcolor; + + uniform vec3 skylightcolor; + uniform float giscale, rhnudge; + uniform vec4 rhbb[2]; + uniform vec3 rhscale[2]; + uniform vec3 rhoffset[2]; + uniform sampler3D tex6, tex7, tex8, tex9; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + uniform sampler2DRect tex5; uniform vec2 aoscale; uniform vec4 aoparams; + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + + + #define shadowval(center, xoff, yoff) float(shadow2DRect(tex4, center + vec3(xoff, yoff, 0.0))) + float filtershadow(vec3 shadowtc) + { + vec2 offset = fract(shadowtc.xy - 0.5); + vec3 center = shadowtc; + + + + + + + + center.xy -= offset*0.5; + vec4 size = vec4(offset + 1.0, 2.0 - offset); + return (1.0/9.0)*dot(size.zxzx*size.wwyy, + vec4(shadowval(center, -0.5, -0.5), + shadowval(center, 1.0, -0.5), + shadowval(center, -0.5, 1.0), + shadowval(center, 1.0, 1.0))); + } + + + + vec3 getcsmtc(vec3 pos, float distbias) + { + pos = csmmatrix * pos; + pos.z -= distbias; + + if(all(lessThan(abs(pos - splitcenter[0]), splitbounds[0]))) + pos = pos*splitscale[0] + splitoffset[0]; + else + + if(all(lessThan(abs(pos - splitcenter[1]), splitbounds[1]))) + pos = pos*splitscale[1] + splitoffset[1]; + else + + if(all(lessThan(abs(pos.xy - splitcenter[2].xy), splitbounds[2].xy))) + pos = pos*splitscale[2] + splitoffset[2]; + else pos = vec3(-1.0); + return pos; + } + + + vec4 getrhlight(vec3 pos, vec3 norm) + { + vec3 tc; + pos += norm*rhnudge; + + if(all(lessThan(abs(pos - rhbb[0].xyz), vec3(rhbb[0].w)))) + tc = pos*rhscale[0] + rhoffset[0]; + else + + if(all(lessThan(abs(pos - rhbb[1].xyz), vec3(rhbb[1].w)))) + tc = pos*rhscale[1] + rhoffset[1]; + else + + tc = vec3(-1.0); + vec4 shr = texture3D(tex6, tc), shg = texture3D(tex7, tc), shb = texture3D(tex8, tc), sha = texture3D(tex9, tc); + shr.rgb -= 0.5; + shg.rgb -= 0.5; + shb.rgb -= 0.5; + sha.rgb -= 0.5; + vec4 basis = vec4(norm*-(1.023326*0.488603/3.14159*2.0), (0.886226*0.282095/3.14159)); + return clamp(vec4(dot(basis, shr), dot(basis, shg), dot(basis, shb), min(dot(basis, sha), norm.z + 1.0)), 0.0, 1.0); + } + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + float alpha = float(normal.x + normal.y != 0.0); + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define glowscale normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + vec3 glow = diffuse.rgb * (1.0 - glowscale); + + diffuse.rgb *= glowscale; + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + + + + vec3 light = lightscale.rgb; + + vec4 rhlight = getrhlight(pos.xyz, normal.xyz); + light += rhlight.a * skylightcolor; + + light *= diffuse.rgb; + + float ao = texture2DRect(tex5, gl_FragCoord.xy*aoscale).r; + light *= aoparams.x + ao*aoparams.y; + + light += glow * lightscale.a; + + + + + vec3 sunlight = rhlight.rgb * giscale * diffuse.rgb; + + float sunfacing = dot(sunlightdir, normal.xyz); + if(sunfacing > 0.0) + { + + #define distbias -8.0 + + vec3 csmtc = getcsmtc(pos.xyz, distbias); + float sunoccluded = sunfacing * filtershadow(csmtc); + + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + float sunspec = pow(clamp(sunfacing*facing - dot(camdir, sunlightdir), 0.0, 1.0), 16.0) * diffuse.a; + + sunlight += (diffuse.rgb + sunspec) * sunoccluded; + + + } + + + sunlight *= aoparams.z + ao*aoparams.w; + + light += sunlight * sunlightcolor; + + + + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(mix(fogcolor*alpha, light, foglerp)); + accumalpha(alpha); + + + + + } + diff --git a/shaders/tesseract/351.shader_test b/shaders/tesseract/351.shader_test new file mode 100644 index 0000000..4e1121c --- /dev/null +++ b/shaders/tesseract/351.shader_test @@ -0,0 +1,191 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 ; + + + uniform sampler2DRectShadow tex4; + + + uniform vec4 lightpos[1]; + uniform vec3 lightcolor[1]; + + + uniform vec4 shadowparams[1]; + uniform vec2 shadowoffset[1]; + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + vec3 getshadowtc(vec3 dir, vec4 shadowparams, vec2 shadowoffset, float distbias) + { + vec3 adir = abs(dir); + float m = max(adir.x, adir.y), mz = max(adir.z, m); + vec2 mparams = shadowparams.xy / max(mz + distbias, 1e-5); + vec4 proj; + if(adir.x > adir.y) proj = vec4(dir.zyx, 0.0); else proj = vec4(dir.xzy, 1.0); + if(adir.z > m) proj = vec4(dir, 2.0); + return vec3(proj.xy * mparams.x + vec2(proj.w, step(proj.z, 0.0)) * shadowparams.z + shadowoffset, mparams.y + shadowparams.w); + } + + + + #define shadowval(center, xoff, yoff) float(shadow2DRect(tex4, center + vec3(xoff, yoff, 0.0))) + float filtershadow(vec3 shadowtc) + { + vec2 offset = fract(shadowtc.xy - 0.5); + vec3 center = shadowtc; + + + + + + + + center.xy -= offset*0.5; + vec4 size = vec4(offset + 1.0, 2.0 - offset); + return (1.0/9.0)*dot(size.zxzx*size.wwyy, + vec4(shadowval(center, -0.5, -0.5), + shadowval(center, 1.0, -0.5), + shadowval(center, -0.5, 1.0), + shadowval(center, 1.0, 1.0))); + } + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define glowscale normal.a + + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + float fogcoord = length(camera - pos.xyz); + + + #define distbias 0.0 + + + vec3 shadow0tc = getshadowtc(light0dir, shadowparams[0], shadowoffset[0], distbias * lightpos[0].w); + light0atten *= filtershadow(shadow0tc); + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + + diffuse.rgb *= glowscale; + + + + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + light *= foglerp; + + + + } + } + + + accumlight(light); + accumalpha(0.0); + + + + } + diff --git a/shaders/tesseract/353.shader_test b/shaders/tesseract/353.shader_test new file mode 100644 index 0000000..573488e --- /dev/null +++ b/shaders/tesseract/353.shader_test @@ -0,0 +1,146 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 , tex2; + + + + uniform vec4 lightpos[1]; + uniform vec3 lightcolor[1]; + + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define glowscale normal.a + + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + float fogcoord = length(camera - pos.xyz); + + + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + + + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + light *= foglerp; + + + + } + } + + + accumlight(light); + accumalpha(0.0); + + + + } + diff --git a/shaders/tesseract/355.shader_test b/shaders/tesseract/355.shader_test new file mode 100644 index 0000000..95c49a6 --- /dev/null +++ b/shaders/tesseract/355.shader_test @@ -0,0 +1,188 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 , tex2; + + + uniform sampler2DRectShadow tex4; + + + uniform vec4 lightpos[1]; + uniform vec3 lightcolor[1]; + + + uniform vec4 shadowparams[1]; + uniform vec2 shadowoffset[1]; + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + vec3 getshadowtc(vec3 dir, vec4 shadowparams, vec2 shadowoffset, float distbias) + { + vec3 adir = abs(dir); + float m = max(adir.x, adir.y), mz = max(adir.z, m); + vec2 mparams = shadowparams.xy / max(mz + distbias, 1e-5); + vec4 proj; + if(adir.x > adir.y) proj = vec4(dir.zyx, 0.0); else proj = vec4(dir.xzy, 1.0); + if(adir.z > m) proj = vec4(dir, 2.0); + return vec3(proj.xy * mparams.x + vec2(proj.w, step(proj.z, 0.0)) * shadowparams.z + shadowoffset, mparams.y + shadowparams.w); + } + + + + #define shadowval(center, xoff, yoff) float(shadow2DRect(tex4, center + vec3(xoff, yoff, 0.0))) + float filtershadow(vec3 shadowtc) + { + vec2 offset = fract(shadowtc.xy - 0.5); + vec3 center = shadowtc; + + + + + + + + center.xy -= offset*0.5; + vec4 size = vec4(offset + 1.0, 2.0 - offset); + return (1.0/9.0)*dot(size.zxzx*size.wwyy, + vec4(shadowval(center, -0.5, -0.5), + shadowval(center, 1.0, -0.5), + shadowval(center, -0.5, 1.0), + shadowval(center, 1.0, 1.0))); + } + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define glowscale normal.a + + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + float fogcoord = length(camera - pos.xyz); + + + #define distbias 0.0 + + + vec3 shadow0tc = getshadowtc(light0dir, shadowparams[0], shadowoffset[0], distbias * lightpos[0].w); + light0atten *= filtershadow(shadow0tc); + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + + + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + light *= foglerp; + + + + } + } + + + accumlight(light); + accumalpha(0.0); + + + + } + diff --git a/shaders/tesseract/357.shader_test b/shaders/tesseract/357.shader_test new file mode 100644 index 0000000..3089694 --- /dev/null +++ b/shaders/tesseract/357.shader_test @@ -0,0 +1,149 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 ; + + + + uniform vec4 lightpos[1]; + uniform vec3 lightcolor[1]; + + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define glowscale normal.a + + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + float fogcoord = length(camera - pos.xyz); + + + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + + diffuse.rgb *= glowscale; + + + + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + light *= foglerp; + + + + } + } + + + accumlight(light); + accumalpha(0.0); + + + + } + diff --git a/shaders/tesseract/359.shader_test b/shaders/tesseract/359.shader_test new file mode 100644 index 0000000..5520a8a --- /dev/null +++ b/shaders/tesseract/359.shader_test @@ -0,0 +1,191 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 ; + + + uniform sampler2DRectShadow tex4; + + + uniform vec4 lightpos[1]; + uniform vec3 lightcolor[1]; + + + uniform vec4 shadowparams[1]; + uniform vec2 shadowoffset[1]; + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + vec3 getshadowtc(vec3 dir, vec4 shadowparams, vec2 shadowoffset, float distbias) + { + vec3 adir = abs(dir); + float m = max(adir.x, adir.y), mz = max(adir.z, m); + vec2 mparams = shadowparams.xy / max(mz + distbias, 1e-5); + vec4 proj; + if(adir.x > adir.y) proj = vec4(dir.zyx, 0.0); else proj = vec4(dir.xzy, 1.0); + if(adir.z > m) proj = vec4(dir, 2.0); + return vec3(proj.xy * mparams.x + vec2(proj.w, step(proj.z, 0.0)) * shadowparams.z + shadowoffset, mparams.y + shadowparams.w); + } + + + + #define shadowval(center, xoff, yoff) float(shadow2DRect(tex4, center + vec3(xoff, yoff, 0.0))) + float filtershadow(vec3 shadowtc) + { + vec2 offset = fract(shadowtc.xy - 0.5); + vec3 center = shadowtc; + + + + + + + + center.xy -= offset*0.5; + vec4 size = vec4(offset + 1.0, 2.0 - offset); + return (1.0/9.0)*dot(size.zxzx*size.wwyy, + vec4(shadowval(center, -0.5, -0.5), + shadowval(center, 1.0, -0.5), + shadowval(center, -0.5, 1.0), + shadowval(center, 1.0, 1.0))); + } + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define glowscale normal.a + + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + float fogcoord = length(camera - pos.xyz); + + + #define distbias -8.0 + + + vec3 shadow0tc = getshadowtc(light0dir, shadowparams[0], shadowoffset[0], distbias * lightpos[0].w); + light0atten *= filtershadow(shadow0tc); + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + + diffuse.rgb *= glowscale; + + + + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + light *= foglerp; + + + + } + } + + + accumlight(light); + accumalpha(0.0); + + + + } + diff --git a/shaders/tesseract/36.shader_test b/shaders/tesseract/36.shader_test new file mode 100644 index 0000000..4a9b619 --- /dev/null +++ b/shaders/tesseract/36.shader_test @@ -0,0 +1,40 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vcolor; + attribute vec2 vtexcoord0; + uniform mat4 hudmatrix; + varying vec2 texcoord0; + varying vec4 colorscale; + void main(void) + { + gl_Position = hudmatrix * vvertex; + texcoord0 = vtexcoord0; + colorscale = vcolor; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2D tex0; + varying vec2 texcoord0; + varying vec4 colorscale; + fragdata(0, fragcolor, vec4) + void main(void) + { + vec4 color = texture2D(tex0, texcoord0); + #pragma CUBE2_swizzle color + fragcolor = colorscale * color; + } + diff --git a/shaders/tesseract/363.shader_test b/shaders/tesseract/363.shader_test new file mode 100644 index 0000000..5be825e --- /dev/null +++ b/shaders/tesseract/363.shader_test @@ -0,0 +1,224 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 ; + + + uniform sampler2DRectShadow tex4; + + + uniform vec4 lightpos[2]; + uniform vec3 lightcolor[2]; + + + uniform vec4 shadowparams[2]; + uniform vec2 shadowoffset[2]; + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + vec3 getshadowtc(vec3 dir, vec4 shadowparams, vec2 shadowoffset, float distbias) + { + vec3 adir = abs(dir); + float m = max(adir.x, adir.y), mz = max(adir.z, m); + vec2 mparams = shadowparams.xy / max(mz + distbias, 1e-5); + vec4 proj; + if(adir.x > adir.y) proj = vec4(dir.zyx, 0.0); else proj = vec4(dir.xzy, 1.0); + if(adir.z > m) proj = vec4(dir, 2.0); + return vec3(proj.xy * mparams.x + vec2(proj.w, step(proj.z, 0.0)) * shadowparams.z + shadowoffset, mparams.y + shadowparams.w); + } + + + + #define shadowval(center, xoff, yoff) float(shadow2DRect(tex4, center + vec3(xoff, yoff, 0.0))) + float filtershadow(vec3 shadowtc) + { + vec2 offset = fract(shadowtc.xy - 0.5); + vec3 center = shadowtc; + + + + + + + + center.xy -= offset*0.5; + vec4 size = vec4(offset + 1.0, 2.0 - offset); + return (1.0/9.0)*dot(size.zxzx*size.wwyy, + vec4(shadowval(center, -0.5, -0.5), + shadowval(center, 1.0, -0.5), + shadowval(center, -0.5, 1.0), + shadowval(center, 1.0, 1.0))); + } + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + #define alpha 1.0 + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define glowscale normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + diffuse.rgb *= glowscale; + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + #define distbias 0.0 + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + vec3 shadow0tc = getshadowtc(light0dir, shadowparams[0], shadowoffset[0], distbias * lightpos[0].w); + light0atten *= filtershadow(shadow0tc); + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + vec3 shadow1tc = getshadowtc(light1dir, shadowparams[1], shadowoffset[1], distbias * lightpos[1].w); + light1atten *= filtershadow(shadow1tc); + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/365.shader_test b/shaders/tesseract/365.shader_test new file mode 100644 index 0000000..66df615 --- /dev/null +++ b/shaders/tesseract/365.shader_test @@ -0,0 +1,176 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 , tex2; + + + + uniform vec4 lightpos[2]; + uniform vec3 lightcolor[2]; + + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define alpha normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/367.shader_test b/shaders/tesseract/367.shader_test new file mode 100644 index 0000000..7267681 --- /dev/null +++ b/shaders/tesseract/367.shader_test @@ -0,0 +1,221 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 , tex2; + + + uniform sampler2DRectShadow tex4; + + + uniform vec4 lightpos[2]; + uniform vec3 lightcolor[2]; + + + uniform vec4 shadowparams[2]; + uniform vec2 shadowoffset[2]; + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + vec3 getshadowtc(vec3 dir, vec4 shadowparams, vec2 shadowoffset, float distbias) + { + vec3 adir = abs(dir); + float m = max(adir.x, adir.y), mz = max(adir.z, m); + vec2 mparams = shadowparams.xy / max(mz + distbias, 1e-5); + vec4 proj; + if(adir.x > adir.y) proj = vec4(dir.zyx, 0.0); else proj = vec4(dir.xzy, 1.0); + if(adir.z > m) proj = vec4(dir, 2.0); + return vec3(proj.xy * mparams.x + vec2(proj.w, step(proj.z, 0.0)) * shadowparams.z + shadowoffset, mparams.y + shadowparams.w); + } + + + + #define shadowval(center, xoff, yoff) float(shadow2DRect(tex4, center + vec3(xoff, yoff, 0.0))) + float filtershadow(vec3 shadowtc) + { + vec2 offset = fract(shadowtc.xy - 0.5); + vec3 center = shadowtc; + + + + + + + + center.xy -= offset*0.5; + vec4 size = vec4(offset + 1.0, 2.0 - offset); + return (1.0/9.0)*dot(size.zxzx*size.wwyy, + vec4(shadowval(center, -0.5, -0.5), + shadowval(center, 1.0, -0.5), + shadowval(center, -0.5, 1.0), + shadowval(center, 1.0, 1.0))); + } + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define alpha normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + #define distbias 0.0 + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + vec3 shadow0tc = getshadowtc(light0dir, shadowparams[0], shadowoffset[0], distbias * lightpos[0].w); + light0atten *= filtershadow(shadow0tc); + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + vec3 shadow1tc = getshadowtc(light1dir, shadowparams[1], shadowoffset[1], distbias * lightpos[1].w); + light1atten *= filtershadow(shadow1tc); + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/369.shader_test b/shaders/tesseract/369.shader_test new file mode 100644 index 0000000..6a50ebd --- /dev/null +++ b/shaders/tesseract/369.shader_test @@ -0,0 +1,179 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 ; + + + + uniform vec4 lightpos[2]; + uniform vec3 lightcolor[2]; + + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + #define alpha 1.0 + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define glowscale normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + diffuse.rgb *= glowscale; + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/371.shader_test b/shaders/tesseract/371.shader_test new file mode 100644 index 0000000..0f24126 --- /dev/null +++ b/shaders/tesseract/371.shader_test @@ -0,0 +1,224 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 ; + + + uniform sampler2DRectShadow tex4; + + + uniform vec4 lightpos[2]; + uniform vec3 lightcolor[2]; + + + uniform vec4 shadowparams[2]; + uniform vec2 shadowoffset[2]; + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + vec3 getshadowtc(vec3 dir, vec4 shadowparams, vec2 shadowoffset, float distbias) + { + vec3 adir = abs(dir); + float m = max(adir.x, adir.y), mz = max(adir.z, m); + vec2 mparams = shadowparams.xy / max(mz + distbias, 1e-5); + vec4 proj; + if(adir.x > adir.y) proj = vec4(dir.zyx, 0.0); else proj = vec4(dir.xzy, 1.0); + if(adir.z > m) proj = vec4(dir, 2.0); + return vec3(proj.xy * mparams.x + vec2(proj.w, step(proj.z, 0.0)) * shadowparams.z + shadowoffset, mparams.y + shadowparams.w); + } + + + + #define shadowval(center, xoff, yoff) float(shadow2DRect(tex4, center + vec3(xoff, yoff, 0.0))) + float filtershadow(vec3 shadowtc) + { + vec2 offset = fract(shadowtc.xy - 0.5); + vec3 center = shadowtc; + + + + + + + + center.xy -= offset*0.5; + vec4 size = vec4(offset + 1.0, 2.0 - offset); + return (1.0/9.0)*dot(size.zxzx*size.wwyy, + vec4(shadowval(center, -0.5, -0.5), + shadowval(center, 1.0, -0.5), + shadowval(center, -0.5, 1.0), + shadowval(center, 1.0, 1.0))); + } + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + #define alpha 1.0 + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define glowscale normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + diffuse.rgb *= glowscale; + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + #define distbias -8.0 + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + vec3 shadow0tc = getshadowtc(light0dir, shadowparams[0], shadowoffset[0], distbias * lightpos[0].w); + light0atten *= filtershadow(shadow0tc); + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + vec3 shadow1tc = getshadowtc(light1dir, shadowparams[1], shadowoffset[1], distbias * lightpos[1].w); + light1atten *= filtershadow(shadow1tc); + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/375.shader_test b/shaders/tesseract/375.shader_test new file mode 100644 index 0000000..8a385aa --- /dev/null +++ b/shaders/tesseract/375.shader_test @@ -0,0 +1,252 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 ; + + + uniform sampler2DRectShadow tex4; + + + uniform vec4 lightpos[3]; + uniform vec3 lightcolor[3]; + + + uniform vec4 shadowparams[3]; + uniform vec2 shadowoffset[3]; + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + vec3 getshadowtc(vec3 dir, vec4 shadowparams, vec2 shadowoffset, float distbias) + { + vec3 adir = abs(dir); + float m = max(adir.x, adir.y), mz = max(adir.z, m); + vec2 mparams = shadowparams.xy / max(mz + distbias, 1e-5); + vec4 proj; + if(adir.x > adir.y) proj = vec4(dir.zyx, 0.0); else proj = vec4(dir.xzy, 1.0); + if(adir.z > m) proj = vec4(dir, 2.0); + return vec3(proj.xy * mparams.x + vec2(proj.w, step(proj.z, 0.0)) * shadowparams.z + shadowoffset, mparams.y + shadowparams.w); + } + + + + #define shadowval(center, xoff, yoff) float(shadow2DRect(tex4, center + vec3(xoff, yoff, 0.0))) + float filtershadow(vec3 shadowtc) + { + vec2 offset = fract(shadowtc.xy - 0.5); + vec3 center = shadowtc; + + + + + + + + center.xy -= offset*0.5; + vec4 size = vec4(offset + 1.0, 2.0 - offset); + return (1.0/9.0)*dot(size.zxzx*size.wwyy, + vec4(shadowval(center, -0.5, -0.5), + shadowval(center, 1.0, -0.5), + shadowval(center, -0.5, 1.0), + shadowval(center, 1.0, 1.0))); + } + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + #define alpha 1.0 + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define glowscale normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + diffuse.rgb *= glowscale; + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + #define distbias 0.0 + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + vec3 shadow0tc = getshadowtc(light0dir, shadowparams[0], shadowoffset[0], distbias * lightpos[0].w); + light0atten *= filtershadow(shadow0tc); + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + vec3 shadow1tc = getshadowtc(light1dir, shadowparams[1], shadowoffset[1], distbias * lightpos[1].w); + light1atten *= filtershadow(shadow1tc); + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + vec3 light2dir = pos.xyz * lightpos[2].w - lightpos[2].xyz; + float light2dist2 = dot(light2dir, light2dir); + if(light2dist2 < 1.0) + { + + float light2facing = dot(light2dir, normal.xyz); + if(light2facing < 0.0) + { + float light2invdist = inversesqrt(light2dist2); + + float light2atten = light2facing * (1.0 - light2invdist); + + + + vec3 shadow2tc = getshadowtc(light2dir, shadowparams[2], shadowoffset[2], distbias * lightpos[2].w); + light2atten *= filtershadow(shadow2tc); + + + + + float light2spec = pow(clamp(light2invdist*(dot(camdir, light2dir) - light2facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light2spec) * lightcolor[2] * light2atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/377.shader_test b/shaders/tesseract/377.shader_test new file mode 100644 index 0000000..ea1f873 --- /dev/null +++ b/shaders/tesseract/377.shader_test @@ -0,0 +1,201 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 , tex2; + + + + uniform vec4 lightpos[3]; + uniform vec3 lightcolor[3]; + + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define alpha normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + vec3 light2dir = pos.xyz * lightpos[2].w - lightpos[2].xyz; + float light2dist2 = dot(light2dir, light2dir); + if(light2dist2 < 1.0) + { + + float light2facing = dot(light2dir, normal.xyz); + if(light2facing < 0.0) + { + float light2invdist = inversesqrt(light2dist2); + + float light2atten = light2facing * (1.0 - light2invdist); + + + + + + + float light2spec = pow(clamp(light2invdist*(dot(camdir, light2dir) - light2facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light2spec) * lightcolor[2] * light2atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/379.shader_test b/shaders/tesseract/379.shader_test new file mode 100644 index 0000000..506fafe --- /dev/null +++ b/shaders/tesseract/379.shader_test @@ -0,0 +1,249 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 , tex2; + + + uniform sampler2DRectShadow tex4; + + + uniform vec4 lightpos[3]; + uniform vec3 lightcolor[3]; + + + uniform vec4 shadowparams[3]; + uniform vec2 shadowoffset[3]; + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + vec3 getshadowtc(vec3 dir, vec4 shadowparams, vec2 shadowoffset, float distbias) + { + vec3 adir = abs(dir); + float m = max(adir.x, adir.y), mz = max(adir.z, m); + vec2 mparams = shadowparams.xy / max(mz + distbias, 1e-5); + vec4 proj; + if(adir.x > adir.y) proj = vec4(dir.zyx, 0.0); else proj = vec4(dir.xzy, 1.0); + if(adir.z > m) proj = vec4(dir, 2.0); + return vec3(proj.xy * mparams.x + vec2(proj.w, step(proj.z, 0.0)) * shadowparams.z + shadowoffset, mparams.y + shadowparams.w); + } + + + + #define shadowval(center, xoff, yoff) float(shadow2DRect(tex4, center + vec3(xoff, yoff, 0.0))) + float filtershadow(vec3 shadowtc) + { + vec2 offset = fract(shadowtc.xy - 0.5); + vec3 center = shadowtc; + + + + + + + + center.xy -= offset*0.5; + vec4 size = vec4(offset + 1.0, 2.0 - offset); + return (1.0/9.0)*dot(size.zxzx*size.wwyy, + vec4(shadowval(center, -0.5, -0.5), + shadowval(center, 1.0, -0.5), + shadowval(center, -0.5, 1.0), + shadowval(center, 1.0, 1.0))); + } + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define alpha normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + #define distbias 0.0 + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + vec3 shadow0tc = getshadowtc(light0dir, shadowparams[0], shadowoffset[0], distbias * lightpos[0].w); + light0atten *= filtershadow(shadow0tc); + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + vec3 shadow1tc = getshadowtc(light1dir, shadowparams[1], shadowoffset[1], distbias * lightpos[1].w); + light1atten *= filtershadow(shadow1tc); + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + vec3 light2dir = pos.xyz * lightpos[2].w - lightpos[2].xyz; + float light2dist2 = dot(light2dir, light2dir); + if(light2dist2 < 1.0) + { + + float light2facing = dot(light2dir, normal.xyz); + if(light2facing < 0.0) + { + float light2invdist = inversesqrt(light2dist2); + + float light2atten = light2facing * (1.0 - light2invdist); + + + + vec3 shadow2tc = getshadowtc(light2dir, shadowparams[2], shadowoffset[2], distbias * lightpos[2].w); + light2atten *= filtershadow(shadow2tc); + + + + + float light2spec = pow(clamp(light2invdist*(dot(camdir, light2dir) - light2facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light2spec) * lightcolor[2] * light2atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/381.shader_test b/shaders/tesseract/381.shader_test new file mode 100644 index 0000000..1e87754 --- /dev/null +++ b/shaders/tesseract/381.shader_test @@ -0,0 +1,204 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 ; + + + + uniform vec4 lightpos[3]; + uniform vec3 lightcolor[3]; + + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + #define alpha 1.0 + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define glowscale normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + diffuse.rgb *= glowscale; + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + vec3 light2dir = pos.xyz * lightpos[2].w - lightpos[2].xyz; + float light2dist2 = dot(light2dir, light2dir); + if(light2dist2 < 1.0) + { + + float light2facing = dot(light2dir, normal.xyz); + if(light2facing < 0.0) + { + float light2invdist = inversesqrt(light2dist2); + + float light2atten = light2facing * (1.0 - light2invdist); + + + + + + + float light2spec = pow(clamp(light2invdist*(dot(camdir, light2dir) - light2facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light2spec) * lightcolor[2] * light2atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/383.shader_test b/shaders/tesseract/383.shader_test new file mode 100644 index 0000000..c69d70f --- /dev/null +++ b/shaders/tesseract/383.shader_test @@ -0,0 +1,252 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 ; + + + uniform sampler2DRectShadow tex4; + + + uniform vec4 lightpos[3]; + uniform vec3 lightcolor[3]; + + + uniform vec4 shadowparams[3]; + uniform vec2 shadowoffset[3]; + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + vec3 getshadowtc(vec3 dir, vec4 shadowparams, vec2 shadowoffset, float distbias) + { + vec3 adir = abs(dir); + float m = max(adir.x, adir.y), mz = max(adir.z, m); + vec2 mparams = shadowparams.xy / max(mz + distbias, 1e-5); + vec4 proj; + if(adir.x > adir.y) proj = vec4(dir.zyx, 0.0); else proj = vec4(dir.xzy, 1.0); + if(adir.z > m) proj = vec4(dir, 2.0); + return vec3(proj.xy * mparams.x + vec2(proj.w, step(proj.z, 0.0)) * shadowparams.z + shadowoffset, mparams.y + shadowparams.w); + } + + + + #define shadowval(center, xoff, yoff) float(shadow2DRect(tex4, center + vec3(xoff, yoff, 0.0))) + float filtershadow(vec3 shadowtc) + { + vec2 offset = fract(shadowtc.xy - 0.5); + vec3 center = shadowtc; + + + + + + + + center.xy -= offset*0.5; + vec4 size = vec4(offset + 1.0, 2.0 - offset); + return (1.0/9.0)*dot(size.zxzx*size.wwyy, + vec4(shadowval(center, -0.5, -0.5), + shadowval(center, 1.0, -0.5), + shadowval(center, -0.5, 1.0), + shadowval(center, 1.0, 1.0))); + } + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + #define alpha 1.0 + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define glowscale normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + diffuse.rgb *= glowscale; + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + #define distbias -8.0 + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + vec3 shadow0tc = getshadowtc(light0dir, shadowparams[0], shadowoffset[0], distbias * lightpos[0].w); + light0atten *= filtershadow(shadow0tc); + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + vec3 shadow1tc = getshadowtc(light1dir, shadowparams[1], shadowoffset[1], distbias * lightpos[1].w); + light1atten *= filtershadow(shadow1tc); + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + vec3 light2dir = pos.xyz * lightpos[2].w - lightpos[2].xyz; + float light2dist2 = dot(light2dir, light2dir); + if(light2dist2 < 1.0) + { + + float light2facing = dot(light2dir, normal.xyz); + if(light2facing < 0.0) + { + float light2invdist = inversesqrt(light2dist2); + + float light2atten = light2facing * (1.0 - light2invdist); + + + + vec3 shadow2tc = getshadowtc(light2dir, shadowparams[2], shadowoffset[2], distbias * lightpos[2].w); + light2atten *= filtershadow(shadow2tc); + + + + + float light2spec = pow(clamp(light2invdist*(dot(camdir, light2dir) - light2facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light2spec) * lightcolor[2] * light2atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/387.shader_test b/shaders/tesseract/387.shader_test new file mode 100644 index 0000000..690d03f --- /dev/null +++ b/shaders/tesseract/387.shader_test @@ -0,0 +1,280 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 ; + + + uniform sampler2DRectShadow tex4; + + + uniform vec4 lightpos[4]; + uniform vec3 lightcolor[4]; + + + uniform vec4 shadowparams[4]; + uniform vec2 shadowoffset[4]; + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + vec3 getshadowtc(vec3 dir, vec4 shadowparams, vec2 shadowoffset, float distbias) + { + vec3 adir = abs(dir); + float m = max(adir.x, adir.y), mz = max(adir.z, m); + vec2 mparams = shadowparams.xy / max(mz + distbias, 1e-5); + vec4 proj; + if(adir.x > adir.y) proj = vec4(dir.zyx, 0.0); else proj = vec4(dir.xzy, 1.0); + if(adir.z > m) proj = vec4(dir, 2.0); + return vec3(proj.xy * mparams.x + vec2(proj.w, step(proj.z, 0.0)) * shadowparams.z + shadowoffset, mparams.y + shadowparams.w); + } + + + + #define shadowval(center, xoff, yoff) float(shadow2DRect(tex4, center + vec3(xoff, yoff, 0.0))) + float filtershadow(vec3 shadowtc) + { + vec2 offset = fract(shadowtc.xy - 0.5); + vec3 center = shadowtc; + + + + + + + + center.xy -= offset*0.5; + vec4 size = vec4(offset + 1.0, 2.0 - offset); + return (1.0/9.0)*dot(size.zxzx*size.wwyy, + vec4(shadowval(center, -0.5, -0.5), + shadowval(center, 1.0, -0.5), + shadowval(center, -0.5, 1.0), + shadowval(center, 1.0, 1.0))); + } + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + #define alpha 1.0 + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define glowscale normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + diffuse.rgb *= glowscale; + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + #define distbias 0.0 + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + vec3 shadow0tc = getshadowtc(light0dir, shadowparams[0], shadowoffset[0], distbias * lightpos[0].w); + light0atten *= filtershadow(shadow0tc); + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + vec3 shadow1tc = getshadowtc(light1dir, shadowparams[1], shadowoffset[1], distbias * lightpos[1].w); + light1atten *= filtershadow(shadow1tc); + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + vec3 light2dir = pos.xyz * lightpos[2].w - lightpos[2].xyz; + float light2dist2 = dot(light2dir, light2dir); + if(light2dist2 < 1.0) + { + + float light2facing = dot(light2dir, normal.xyz); + if(light2facing < 0.0) + { + float light2invdist = inversesqrt(light2dist2); + + float light2atten = light2facing * (1.0 - light2invdist); + + + + vec3 shadow2tc = getshadowtc(light2dir, shadowparams[2], shadowoffset[2], distbias * lightpos[2].w); + light2atten *= filtershadow(shadow2tc); + + + + + float light2spec = pow(clamp(light2invdist*(dot(camdir, light2dir) - light2facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light2spec) * lightcolor[2] * light2atten; + + + + } + } + + vec3 light3dir = pos.xyz * lightpos[3].w - lightpos[3].xyz; + float light3dist2 = dot(light3dir, light3dir); + if(light3dist2 < 1.0) + { + + float light3facing = dot(light3dir, normal.xyz); + if(light3facing < 0.0) + { + float light3invdist = inversesqrt(light3dist2); + + float light3atten = light3facing * (1.0 - light3invdist); + + + + vec3 shadow3tc = getshadowtc(light3dir, shadowparams[3], shadowoffset[3], distbias * lightpos[3].w); + light3atten *= filtershadow(shadow3tc); + + + + + float light3spec = pow(clamp(light3invdist*(dot(camdir, light3dir) - light3facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light3spec) * lightcolor[3] * light3atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/389.shader_test b/shaders/tesseract/389.shader_test new file mode 100644 index 0000000..0c46dc7 --- /dev/null +++ b/shaders/tesseract/389.shader_test @@ -0,0 +1,226 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 , tex2; + + + + uniform vec4 lightpos[4]; + uniform vec3 lightcolor[4]; + + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define alpha normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + vec3 light2dir = pos.xyz * lightpos[2].w - lightpos[2].xyz; + float light2dist2 = dot(light2dir, light2dir); + if(light2dist2 < 1.0) + { + + float light2facing = dot(light2dir, normal.xyz); + if(light2facing < 0.0) + { + float light2invdist = inversesqrt(light2dist2); + + float light2atten = light2facing * (1.0 - light2invdist); + + + + + + + float light2spec = pow(clamp(light2invdist*(dot(camdir, light2dir) - light2facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light2spec) * lightcolor[2] * light2atten; + + + + } + } + + vec3 light3dir = pos.xyz * lightpos[3].w - lightpos[3].xyz; + float light3dist2 = dot(light3dir, light3dir); + if(light3dist2 < 1.0) + { + + float light3facing = dot(light3dir, normal.xyz); + if(light3facing < 0.0) + { + float light3invdist = inversesqrt(light3dist2); + + float light3atten = light3facing * (1.0 - light3invdist); + + + + + + + float light3spec = pow(clamp(light3invdist*(dot(camdir, light3dir) - light3facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light3spec) * lightcolor[3] * light3atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/39.shader_test b/shaders/tesseract/39.shader_test new file mode 100644 index 0000000..6536b83 --- /dev/null +++ b/shaders/tesseract/39.shader_test @@ -0,0 +1,42 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vcolor; + attribute vec2 vtexcoord0; + uniform mat4 hudmatrix; + varying vec2 texcoord0; + varying vec4 colorscale; + void main(void) + { + gl_Position = hudmatrix * vvertex; + texcoord0 = vtexcoord0; + colorscale = vcolor; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2D tex0; + uniform vec4 textparams; + varying vec2 texcoord0; + varying vec4 colorscale; + fragdata(0, fragcolor, vec4) + void main(void) + { + float dist = texture2D(tex0, texcoord0).r; + float border = smoothstep(textparams.x, textparams.y, dist); + float outline = smoothstep(textparams.z, textparams.w, dist); + fragcolor = vec4(colorscale.rgb * outline, colorscale.a * border); + } + diff --git a/shaders/tesseract/391.shader_test b/shaders/tesseract/391.shader_test new file mode 100644 index 0000000..b74fd1c --- /dev/null +++ b/shaders/tesseract/391.shader_test @@ -0,0 +1,277 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 , tex2; + + + uniform sampler2DRectShadow tex4; + + + uniform vec4 lightpos[4]; + uniform vec3 lightcolor[4]; + + + uniform vec4 shadowparams[4]; + uniform vec2 shadowoffset[4]; + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + vec3 getshadowtc(vec3 dir, vec4 shadowparams, vec2 shadowoffset, float distbias) + { + vec3 adir = abs(dir); + float m = max(adir.x, adir.y), mz = max(adir.z, m); + vec2 mparams = shadowparams.xy / max(mz + distbias, 1e-5); + vec4 proj; + if(adir.x > adir.y) proj = vec4(dir.zyx, 0.0); else proj = vec4(dir.xzy, 1.0); + if(adir.z > m) proj = vec4(dir, 2.0); + return vec3(proj.xy * mparams.x + vec2(proj.w, step(proj.z, 0.0)) * shadowparams.z + shadowoffset, mparams.y + shadowparams.w); + } + + + + #define shadowval(center, xoff, yoff) float(shadow2DRect(tex4, center + vec3(xoff, yoff, 0.0))) + float filtershadow(vec3 shadowtc) + { + vec2 offset = fract(shadowtc.xy - 0.5); + vec3 center = shadowtc; + + + + + + + + center.xy -= offset*0.5; + vec4 size = vec4(offset + 1.0, 2.0 - offset); + return (1.0/9.0)*dot(size.zxzx*size.wwyy, + vec4(shadowval(center, -0.5, -0.5), + shadowval(center, 1.0, -0.5), + shadowval(center, -0.5, 1.0), + shadowval(center, 1.0, 1.0))); + } + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define alpha normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + #define distbias 0.0 + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + vec3 shadow0tc = getshadowtc(light0dir, shadowparams[0], shadowoffset[0], distbias * lightpos[0].w); + light0atten *= filtershadow(shadow0tc); + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + vec3 shadow1tc = getshadowtc(light1dir, shadowparams[1], shadowoffset[1], distbias * lightpos[1].w); + light1atten *= filtershadow(shadow1tc); + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + vec3 light2dir = pos.xyz * lightpos[2].w - lightpos[2].xyz; + float light2dist2 = dot(light2dir, light2dir); + if(light2dist2 < 1.0) + { + + float light2facing = dot(light2dir, normal.xyz); + if(light2facing < 0.0) + { + float light2invdist = inversesqrt(light2dist2); + + float light2atten = light2facing * (1.0 - light2invdist); + + + + vec3 shadow2tc = getshadowtc(light2dir, shadowparams[2], shadowoffset[2], distbias * lightpos[2].w); + light2atten *= filtershadow(shadow2tc); + + + + + float light2spec = pow(clamp(light2invdist*(dot(camdir, light2dir) - light2facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light2spec) * lightcolor[2] * light2atten; + + + + } + } + + vec3 light3dir = pos.xyz * lightpos[3].w - lightpos[3].xyz; + float light3dist2 = dot(light3dir, light3dir); + if(light3dist2 < 1.0) + { + + float light3facing = dot(light3dir, normal.xyz); + if(light3facing < 0.0) + { + float light3invdist = inversesqrt(light3dist2); + + float light3atten = light3facing * (1.0 - light3invdist); + + + + vec3 shadow3tc = getshadowtc(light3dir, shadowparams[3], shadowoffset[3], distbias * lightpos[3].w); + light3atten *= filtershadow(shadow3tc); + + + + + float light3spec = pow(clamp(light3invdist*(dot(camdir, light3dir) - light3facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light3spec) * lightcolor[3] * light3atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/393.shader_test b/shaders/tesseract/393.shader_test new file mode 100644 index 0000000..371d96c --- /dev/null +++ b/shaders/tesseract/393.shader_test @@ -0,0 +1,229 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 ; + + + + uniform vec4 lightpos[4]; + uniform vec3 lightcolor[4]; + + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + #define alpha 1.0 + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define glowscale normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + diffuse.rgb *= glowscale; + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + vec3 light2dir = pos.xyz * lightpos[2].w - lightpos[2].xyz; + float light2dist2 = dot(light2dir, light2dir); + if(light2dist2 < 1.0) + { + + float light2facing = dot(light2dir, normal.xyz); + if(light2facing < 0.0) + { + float light2invdist = inversesqrt(light2dist2); + + float light2atten = light2facing * (1.0 - light2invdist); + + + + + + + float light2spec = pow(clamp(light2invdist*(dot(camdir, light2dir) - light2facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light2spec) * lightcolor[2] * light2atten; + + + + } + } + + vec3 light3dir = pos.xyz * lightpos[3].w - lightpos[3].xyz; + float light3dist2 = dot(light3dir, light3dir); + if(light3dist2 < 1.0) + { + + float light3facing = dot(light3dir, normal.xyz); + if(light3facing < 0.0) + { + float light3invdist = inversesqrt(light3dist2); + + float light3atten = light3facing * (1.0 - light3invdist); + + + + + + + float light3spec = pow(clamp(light3invdist*(dot(camdir, light3dir) - light3facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light3spec) * lightcolor[3] * light3atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/395.shader_test b/shaders/tesseract/395.shader_test new file mode 100644 index 0000000..8496a28 --- /dev/null +++ b/shaders/tesseract/395.shader_test @@ -0,0 +1,280 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 ; + + + uniform sampler2DRectShadow tex4; + + + uniform vec4 lightpos[4]; + uniform vec3 lightcolor[4]; + + + uniform vec4 shadowparams[4]; + uniform vec2 shadowoffset[4]; + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + vec3 getshadowtc(vec3 dir, vec4 shadowparams, vec2 shadowoffset, float distbias) + { + vec3 adir = abs(dir); + float m = max(adir.x, adir.y), mz = max(adir.z, m); + vec2 mparams = shadowparams.xy / max(mz + distbias, 1e-5); + vec4 proj; + if(adir.x > adir.y) proj = vec4(dir.zyx, 0.0); else proj = vec4(dir.xzy, 1.0); + if(adir.z > m) proj = vec4(dir, 2.0); + return vec3(proj.xy * mparams.x + vec2(proj.w, step(proj.z, 0.0)) * shadowparams.z + shadowoffset, mparams.y + shadowparams.w); + } + + + + #define shadowval(center, xoff, yoff) float(shadow2DRect(tex4, center + vec3(xoff, yoff, 0.0))) + float filtershadow(vec3 shadowtc) + { + vec2 offset = fract(shadowtc.xy - 0.5); + vec3 center = shadowtc; + + + + + + + + center.xy -= offset*0.5; + vec4 size = vec4(offset + 1.0, 2.0 - offset); + return (1.0/9.0)*dot(size.zxzx*size.wwyy, + vec4(shadowval(center, -0.5, -0.5), + shadowval(center, 1.0, -0.5), + shadowval(center, -0.5, 1.0), + shadowval(center, 1.0, 1.0))); + } + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + #define alpha 1.0 + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define glowscale normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + diffuse.rgb *= glowscale; + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + #define distbias -8.0 + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + vec3 shadow0tc = getshadowtc(light0dir, shadowparams[0], shadowoffset[0], distbias * lightpos[0].w); + light0atten *= filtershadow(shadow0tc); + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + vec3 shadow1tc = getshadowtc(light1dir, shadowparams[1], shadowoffset[1], distbias * lightpos[1].w); + light1atten *= filtershadow(shadow1tc); + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + vec3 light2dir = pos.xyz * lightpos[2].w - lightpos[2].xyz; + float light2dist2 = dot(light2dir, light2dir); + if(light2dist2 < 1.0) + { + + float light2facing = dot(light2dir, normal.xyz); + if(light2facing < 0.0) + { + float light2invdist = inversesqrt(light2dist2); + + float light2atten = light2facing * (1.0 - light2invdist); + + + + vec3 shadow2tc = getshadowtc(light2dir, shadowparams[2], shadowoffset[2], distbias * lightpos[2].w); + light2atten *= filtershadow(shadow2tc); + + + + + float light2spec = pow(clamp(light2invdist*(dot(camdir, light2dir) - light2facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light2spec) * lightcolor[2] * light2atten; + + + + } + } + + vec3 light3dir = pos.xyz * lightpos[3].w - lightpos[3].xyz; + float light3dist2 = dot(light3dir, light3dir); + if(light3dist2 < 1.0) + { + + float light3facing = dot(light3dir, normal.xyz); + if(light3facing < 0.0) + { + float light3invdist = inversesqrt(light3dist2); + + float light3atten = light3facing * (1.0 - light3invdist); + + + + vec3 shadow3tc = getshadowtc(light3dir, shadowparams[3], shadowoffset[3], distbias * lightpos[3].w); + light3atten *= filtershadow(shadow3tc); + + + + + float light3spec = pow(clamp(light3invdist*(dot(camdir, light3dir) - light3facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light3spec) * lightcolor[3] * light3atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/399.shader_test b/shaders/tesseract/399.shader_test new file mode 100644 index 0000000..d8d438d --- /dev/null +++ b/shaders/tesseract/399.shader_test @@ -0,0 +1,308 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 ; + + + uniform sampler2DRectShadow tex4; + + + uniform vec4 lightpos[5]; + uniform vec3 lightcolor[5]; + + + uniform vec4 shadowparams[5]; + uniform vec2 shadowoffset[5]; + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + vec3 getshadowtc(vec3 dir, vec4 shadowparams, vec2 shadowoffset, float distbias) + { + vec3 adir = abs(dir); + float m = max(adir.x, adir.y), mz = max(adir.z, m); + vec2 mparams = shadowparams.xy / max(mz + distbias, 1e-5); + vec4 proj; + if(adir.x > adir.y) proj = vec4(dir.zyx, 0.0); else proj = vec4(dir.xzy, 1.0); + if(adir.z > m) proj = vec4(dir, 2.0); + return vec3(proj.xy * mparams.x + vec2(proj.w, step(proj.z, 0.0)) * shadowparams.z + shadowoffset, mparams.y + shadowparams.w); + } + + + + #define shadowval(center, xoff, yoff) float(shadow2DRect(tex4, center + vec3(xoff, yoff, 0.0))) + float filtershadow(vec3 shadowtc) + { + vec2 offset = fract(shadowtc.xy - 0.5); + vec3 center = shadowtc; + + + + + + + + center.xy -= offset*0.5; + vec4 size = vec4(offset + 1.0, 2.0 - offset); + return (1.0/9.0)*dot(size.zxzx*size.wwyy, + vec4(shadowval(center, -0.5, -0.5), + shadowval(center, 1.0, -0.5), + shadowval(center, -0.5, 1.0), + shadowval(center, 1.0, 1.0))); + } + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + #define alpha 1.0 + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define glowscale normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + diffuse.rgb *= glowscale; + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + #define distbias 0.0 + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + vec3 shadow0tc = getshadowtc(light0dir, shadowparams[0], shadowoffset[0], distbias * lightpos[0].w); + light0atten *= filtershadow(shadow0tc); + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + vec3 shadow1tc = getshadowtc(light1dir, shadowparams[1], shadowoffset[1], distbias * lightpos[1].w); + light1atten *= filtershadow(shadow1tc); + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + vec3 light2dir = pos.xyz * lightpos[2].w - lightpos[2].xyz; + float light2dist2 = dot(light2dir, light2dir); + if(light2dist2 < 1.0) + { + + float light2facing = dot(light2dir, normal.xyz); + if(light2facing < 0.0) + { + float light2invdist = inversesqrt(light2dist2); + + float light2atten = light2facing * (1.0 - light2invdist); + + + + vec3 shadow2tc = getshadowtc(light2dir, shadowparams[2], shadowoffset[2], distbias * lightpos[2].w); + light2atten *= filtershadow(shadow2tc); + + + + + float light2spec = pow(clamp(light2invdist*(dot(camdir, light2dir) - light2facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light2spec) * lightcolor[2] * light2atten; + + + + } + } + + vec3 light3dir = pos.xyz * lightpos[3].w - lightpos[3].xyz; + float light3dist2 = dot(light3dir, light3dir); + if(light3dist2 < 1.0) + { + + float light3facing = dot(light3dir, normal.xyz); + if(light3facing < 0.0) + { + float light3invdist = inversesqrt(light3dist2); + + float light3atten = light3facing * (1.0 - light3invdist); + + + + vec3 shadow3tc = getshadowtc(light3dir, shadowparams[3], shadowoffset[3], distbias * lightpos[3].w); + light3atten *= filtershadow(shadow3tc); + + + + + float light3spec = pow(clamp(light3invdist*(dot(camdir, light3dir) - light3facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light3spec) * lightcolor[3] * light3atten; + + + + } + } + + vec3 light4dir = pos.xyz * lightpos[4].w - lightpos[4].xyz; + float light4dist2 = dot(light4dir, light4dir); + if(light4dist2 < 1.0) + { + + float light4facing = dot(light4dir, normal.xyz); + if(light4facing < 0.0) + { + float light4invdist = inversesqrt(light4dist2); + + float light4atten = light4facing * (1.0 - light4invdist); + + + + vec3 shadow4tc = getshadowtc(light4dir, shadowparams[4], shadowoffset[4], distbias * lightpos[4].w); + light4atten *= filtershadow(shadow4tc); + + + + + float light4spec = pow(clamp(light4invdist*(dot(camdir, light4dir) - light4facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light4spec) * lightcolor[4] * light4atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/401.shader_test b/shaders/tesseract/401.shader_test new file mode 100644 index 0000000..a12b9ba --- /dev/null +++ b/shaders/tesseract/401.shader_test @@ -0,0 +1,251 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 , tex2; + + + + uniform vec4 lightpos[5]; + uniform vec3 lightcolor[5]; + + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define alpha normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + vec3 light2dir = pos.xyz * lightpos[2].w - lightpos[2].xyz; + float light2dist2 = dot(light2dir, light2dir); + if(light2dist2 < 1.0) + { + + float light2facing = dot(light2dir, normal.xyz); + if(light2facing < 0.0) + { + float light2invdist = inversesqrt(light2dist2); + + float light2atten = light2facing * (1.0 - light2invdist); + + + + + + + float light2spec = pow(clamp(light2invdist*(dot(camdir, light2dir) - light2facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light2spec) * lightcolor[2] * light2atten; + + + + } + } + + vec3 light3dir = pos.xyz * lightpos[3].w - lightpos[3].xyz; + float light3dist2 = dot(light3dir, light3dir); + if(light3dist2 < 1.0) + { + + float light3facing = dot(light3dir, normal.xyz); + if(light3facing < 0.0) + { + float light3invdist = inversesqrt(light3dist2); + + float light3atten = light3facing * (1.0 - light3invdist); + + + + + + + float light3spec = pow(clamp(light3invdist*(dot(camdir, light3dir) - light3facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light3spec) * lightcolor[3] * light3atten; + + + + } + } + + vec3 light4dir = pos.xyz * lightpos[4].w - lightpos[4].xyz; + float light4dist2 = dot(light4dir, light4dir); + if(light4dist2 < 1.0) + { + + float light4facing = dot(light4dir, normal.xyz); + if(light4facing < 0.0) + { + float light4invdist = inversesqrt(light4dist2); + + float light4atten = light4facing * (1.0 - light4invdist); + + + + + + + float light4spec = pow(clamp(light4invdist*(dot(camdir, light4dir) - light4facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light4spec) * lightcolor[4] * light4atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/403.shader_test b/shaders/tesseract/403.shader_test new file mode 100644 index 0000000..94f6972 --- /dev/null +++ b/shaders/tesseract/403.shader_test @@ -0,0 +1,305 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 , tex2; + + + uniform sampler2DRectShadow tex4; + + + uniform vec4 lightpos[5]; + uniform vec3 lightcolor[5]; + + + uniform vec4 shadowparams[5]; + uniform vec2 shadowoffset[5]; + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + vec3 getshadowtc(vec3 dir, vec4 shadowparams, vec2 shadowoffset, float distbias) + { + vec3 adir = abs(dir); + float m = max(adir.x, adir.y), mz = max(adir.z, m); + vec2 mparams = shadowparams.xy / max(mz + distbias, 1e-5); + vec4 proj; + if(adir.x > adir.y) proj = vec4(dir.zyx, 0.0); else proj = vec4(dir.xzy, 1.0); + if(adir.z > m) proj = vec4(dir, 2.0); + return vec3(proj.xy * mparams.x + vec2(proj.w, step(proj.z, 0.0)) * shadowparams.z + shadowoffset, mparams.y + shadowparams.w); + } + + + + #define shadowval(center, xoff, yoff) float(shadow2DRect(tex4, center + vec3(xoff, yoff, 0.0))) + float filtershadow(vec3 shadowtc) + { + vec2 offset = fract(shadowtc.xy - 0.5); + vec3 center = shadowtc; + + + + + + + + center.xy -= offset*0.5; + vec4 size = vec4(offset + 1.0, 2.0 - offset); + return (1.0/9.0)*dot(size.zxzx*size.wwyy, + vec4(shadowval(center, -0.5, -0.5), + shadowval(center, 1.0, -0.5), + shadowval(center, -0.5, 1.0), + shadowval(center, 1.0, 1.0))); + } + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define alpha normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + #define distbias 0.0 + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + vec3 shadow0tc = getshadowtc(light0dir, shadowparams[0], shadowoffset[0], distbias * lightpos[0].w); + light0atten *= filtershadow(shadow0tc); + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + vec3 shadow1tc = getshadowtc(light1dir, shadowparams[1], shadowoffset[1], distbias * lightpos[1].w); + light1atten *= filtershadow(shadow1tc); + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + vec3 light2dir = pos.xyz * lightpos[2].w - lightpos[2].xyz; + float light2dist2 = dot(light2dir, light2dir); + if(light2dist2 < 1.0) + { + + float light2facing = dot(light2dir, normal.xyz); + if(light2facing < 0.0) + { + float light2invdist = inversesqrt(light2dist2); + + float light2atten = light2facing * (1.0 - light2invdist); + + + + vec3 shadow2tc = getshadowtc(light2dir, shadowparams[2], shadowoffset[2], distbias * lightpos[2].w); + light2atten *= filtershadow(shadow2tc); + + + + + float light2spec = pow(clamp(light2invdist*(dot(camdir, light2dir) - light2facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light2spec) * lightcolor[2] * light2atten; + + + + } + } + + vec3 light3dir = pos.xyz * lightpos[3].w - lightpos[3].xyz; + float light3dist2 = dot(light3dir, light3dir); + if(light3dist2 < 1.0) + { + + float light3facing = dot(light3dir, normal.xyz); + if(light3facing < 0.0) + { + float light3invdist = inversesqrt(light3dist2); + + float light3atten = light3facing * (1.0 - light3invdist); + + + + vec3 shadow3tc = getshadowtc(light3dir, shadowparams[3], shadowoffset[3], distbias * lightpos[3].w); + light3atten *= filtershadow(shadow3tc); + + + + + float light3spec = pow(clamp(light3invdist*(dot(camdir, light3dir) - light3facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light3spec) * lightcolor[3] * light3atten; + + + + } + } + + vec3 light4dir = pos.xyz * lightpos[4].w - lightpos[4].xyz; + float light4dist2 = dot(light4dir, light4dir); + if(light4dist2 < 1.0) + { + + float light4facing = dot(light4dir, normal.xyz); + if(light4facing < 0.0) + { + float light4invdist = inversesqrt(light4dist2); + + float light4atten = light4facing * (1.0 - light4invdist); + + + + vec3 shadow4tc = getshadowtc(light4dir, shadowparams[4], shadowoffset[4], distbias * lightpos[4].w); + light4atten *= filtershadow(shadow4tc); + + + + + float light4spec = pow(clamp(light4invdist*(dot(camdir, light4dir) - light4facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light4spec) * lightcolor[4] * light4atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/405.shader_test b/shaders/tesseract/405.shader_test new file mode 100644 index 0000000..39840fd --- /dev/null +++ b/shaders/tesseract/405.shader_test @@ -0,0 +1,254 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 ; + + + + uniform vec4 lightpos[5]; + uniform vec3 lightcolor[5]; + + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + #define alpha 1.0 + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define glowscale normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + diffuse.rgb *= glowscale; + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + vec3 light2dir = pos.xyz * lightpos[2].w - lightpos[2].xyz; + float light2dist2 = dot(light2dir, light2dir); + if(light2dist2 < 1.0) + { + + float light2facing = dot(light2dir, normal.xyz); + if(light2facing < 0.0) + { + float light2invdist = inversesqrt(light2dist2); + + float light2atten = light2facing * (1.0 - light2invdist); + + + + + + + float light2spec = pow(clamp(light2invdist*(dot(camdir, light2dir) - light2facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light2spec) * lightcolor[2] * light2atten; + + + + } + } + + vec3 light3dir = pos.xyz * lightpos[3].w - lightpos[3].xyz; + float light3dist2 = dot(light3dir, light3dir); + if(light3dist2 < 1.0) + { + + float light3facing = dot(light3dir, normal.xyz); + if(light3facing < 0.0) + { + float light3invdist = inversesqrt(light3dist2); + + float light3atten = light3facing * (1.0 - light3invdist); + + + + + + + float light3spec = pow(clamp(light3invdist*(dot(camdir, light3dir) - light3facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light3spec) * lightcolor[3] * light3atten; + + + + } + } + + vec3 light4dir = pos.xyz * lightpos[4].w - lightpos[4].xyz; + float light4dist2 = dot(light4dir, light4dir); + if(light4dist2 < 1.0) + { + + float light4facing = dot(light4dir, normal.xyz); + if(light4facing < 0.0) + { + float light4invdist = inversesqrt(light4dist2); + + float light4atten = light4facing * (1.0 - light4invdist); + + + + + + + float light4spec = pow(clamp(light4invdist*(dot(camdir, light4dir) - light4facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light4spec) * lightcolor[4] * light4atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/407.shader_test b/shaders/tesseract/407.shader_test new file mode 100644 index 0000000..1e89639 --- /dev/null +++ b/shaders/tesseract/407.shader_test @@ -0,0 +1,308 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 ; + + + uniform sampler2DRectShadow tex4; + + + uniform vec4 lightpos[5]; + uniform vec3 lightcolor[5]; + + + uniform vec4 shadowparams[5]; + uniform vec2 shadowoffset[5]; + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + vec3 getshadowtc(vec3 dir, vec4 shadowparams, vec2 shadowoffset, float distbias) + { + vec3 adir = abs(dir); + float m = max(adir.x, adir.y), mz = max(adir.z, m); + vec2 mparams = shadowparams.xy / max(mz + distbias, 1e-5); + vec4 proj; + if(adir.x > adir.y) proj = vec4(dir.zyx, 0.0); else proj = vec4(dir.xzy, 1.0); + if(adir.z > m) proj = vec4(dir, 2.0); + return vec3(proj.xy * mparams.x + vec2(proj.w, step(proj.z, 0.0)) * shadowparams.z + shadowoffset, mparams.y + shadowparams.w); + } + + + + #define shadowval(center, xoff, yoff) float(shadow2DRect(tex4, center + vec3(xoff, yoff, 0.0))) + float filtershadow(vec3 shadowtc) + { + vec2 offset = fract(shadowtc.xy - 0.5); + vec3 center = shadowtc; + + + + + + + + center.xy -= offset*0.5; + vec4 size = vec4(offset + 1.0, 2.0 - offset); + return (1.0/9.0)*dot(size.zxzx*size.wwyy, + vec4(shadowval(center, -0.5, -0.5), + shadowval(center, 1.0, -0.5), + shadowval(center, -0.5, 1.0), + shadowval(center, 1.0, 1.0))); + } + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + #define alpha 1.0 + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define glowscale normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + diffuse.rgb *= glowscale; + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + #define distbias -8.0 + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + vec3 shadow0tc = getshadowtc(light0dir, shadowparams[0], shadowoffset[0], distbias * lightpos[0].w); + light0atten *= filtershadow(shadow0tc); + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + vec3 shadow1tc = getshadowtc(light1dir, shadowparams[1], shadowoffset[1], distbias * lightpos[1].w); + light1atten *= filtershadow(shadow1tc); + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + vec3 light2dir = pos.xyz * lightpos[2].w - lightpos[2].xyz; + float light2dist2 = dot(light2dir, light2dir); + if(light2dist2 < 1.0) + { + + float light2facing = dot(light2dir, normal.xyz); + if(light2facing < 0.0) + { + float light2invdist = inversesqrt(light2dist2); + + float light2atten = light2facing * (1.0 - light2invdist); + + + + vec3 shadow2tc = getshadowtc(light2dir, shadowparams[2], shadowoffset[2], distbias * lightpos[2].w); + light2atten *= filtershadow(shadow2tc); + + + + + float light2spec = pow(clamp(light2invdist*(dot(camdir, light2dir) - light2facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light2spec) * lightcolor[2] * light2atten; + + + + } + } + + vec3 light3dir = pos.xyz * lightpos[3].w - lightpos[3].xyz; + float light3dist2 = dot(light3dir, light3dir); + if(light3dist2 < 1.0) + { + + float light3facing = dot(light3dir, normal.xyz); + if(light3facing < 0.0) + { + float light3invdist = inversesqrt(light3dist2); + + float light3atten = light3facing * (1.0 - light3invdist); + + + + vec3 shadow3tc = getshadowtc(light3dir, shadowparams[3], shadowoffset[3], distbias * lightpos[3].w); + light3atten *= filtershadow(shadow3tc); + + + + + float light3spec = pow(clamp(light3invdist*(dot(camdir, light3dir) - light3facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light3spec) * lightcolor[3] * light3atten; + + + + } + } + + vec3 light4dir = pos.xyz * lightpos[4].w - lightpos[4].xyz; + float light4dist2 = dot(light4dir, light4dir); + if(light4dist2 < 1.0) + { + + float light4facing = dot(light4dir, normal.xyz); + if(light4facing < 0.0) + { + float light4invdist = inversesqrt(light4dist2); + + float light4atten = light4facing * (1.0 - light4invdist); + + + + vec3 shadow4tc = getshadowtc(light4dir, shadowparams[4], shadowoffset[4], distbias * lightpos[4].w); + light4atten *= filtershadow(shadow4tc); + + + + + float light4spec = pow(clamp(light4invdist*(dot(camdir, light4dir) - light4facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light4spec) * lightcolor[4] * light4atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/411.shader_test b/shaders/tesseract/411.shader_test new file mode 100644 index 0000000..c5441f5 --- /dev/null +++ b/shaders/tesseract/411.shader_test @@ -0,0 +1,336 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 ; + + + uniform sampler2DRectShadow tex4; + + + uniform vec4 lightpos[6]; + uniform vec3 lightcolor[6]; + + + uniform vec4 shadowparams[6]; + uniform vec2 shadowoffset[6]; + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + vec3 getshadowtc(vec3 dir, vec4 shadowparams, vec2 shadowoffset, float distbias) + { + vec3 adir = abs(dir); + float m = max(adir.x, adir.y), mz = max(adir.z, m); + vec2 mparams = shadowparams.xy / max(mz + distbias, 1e-5); + vec4 proj; + if(adir.x > adir.y) proj = vec4(dir.zyx, 0.0); else proj = vec4(dir.xzy, 1.0); + if(adir.z > m) proj = vec4(dir, 2.0); + return vec3(proj.xy * mparams.x + vec2(proj.w, step(proj.z, 0.0)) * shadowparams.z + shadowoffset, mparams.y + shadowparams.w); + } + + + + #define shadowval(center, xoff, yoff) float(shadow2DRect(tex4, center + vec3(xoff, yoff, 0.0))) + float filtershadow(vec3 shadowtc) + { + vec2 offset = fract(shadowtc.xy - 0.5); + vec3 center = shadowtc; + + + + + + + + center.xy -= offset*0.5; + vec4 size = vec4(offset + 1.0, 2.0 - offset); + return (1.0/9.0)*dot(size.zxzx*size.wwyy, + vec4(shadowval(center, -0.5, -0.5), + shadowval(center, 1.0, -0.5), + shadowval(center, -0.5, 1.0), + shadowval(center, 1.0, 1.0))); + } + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + #define alpha 1.0 + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define glowscale normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + diffuse.rgb *= glowscale; + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + #define distbias 0.0 + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + vec3 shadow0tc = getshadowtc(light0dir, shadowparams[0], shadowoffset[0], distbias * lightpos[0].w); + light0atten *= filtershadow(shadow0tc); + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + vec3 shadow1tc = getshadowtc(light1dir, shadowparams[1], shadowoffset[1], distbias * lightpos[1].w); + light1atten *= filtershadow(shadow1tc); + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + vec3 light2dir = pos.xyz * lightpos[2].w - lightpos[2].xyz; + float light2dist2 = dot(light2dir, light2dir); + if(light2dist2 < 1.0) + { + + float light2facing = dot(light2dir, normal.xyz); + if(light2facing < 0.0) + { + float light2invdist = inversesqrt(light2dist2); + + float light2atten = light2facing * (1.0 - light2invdist); + + + + vec3 shadow2tc = getshadowtc(light2dir, shadowparams[2], shadowoffset[2], distbias * lightpos[2].w); + light2atten *= filtershadow(shadow2tc); + + + + + float light2spec = pow(clamp(light2invdist*(dot(camdir, light2dir) - light2facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light2spec) * lightcolor[2] * light2atten; + + + + } + } + + vec3 light3dir = pos.xyz * lightpos[3].w - lightpos[3].xyz; + float light3dist2 = dot(light3dir, light3dir); + if(light3dist2 < 1.0) + { + + float light3facing = dot(light3dir, normal.xyz); + if(light3facing < 0.0) + { + float light3invdist = inversesqrt(light3dist2); + + float light3atten = light3facing * (1.0 - light3invdist); + + + + vec3 shadow3tc = getshadowtc(light3dir, shadowparams[3], shadowoffset[3], distbias * lightpos[3].w); + light3atten *= filtershadow(shadow3tc); + + + + + float light3spec = pow(clamp(light3invdist*(dot(camdir, light3dir) - light3facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light3spec) * lightcolor[3] * light3atten; + + + + } + } + + vec3 light4dir = pos.xyz * lightpos[4].w - lightpos[4].xyz; + float light4dist2 = dot(light4dir, light4dir); + if(light4dist2 < 1.0) + { + + float light4facing = dot(light4dir, normal.xyz); + if(light4facing < 0.0) + { + float light4invdist = inversesqrt(light4dist2); + + float light4atten = light4facing * (1.0 - light4invdist); + + + + vec3 shadow4tc = getshadowtc(light4dir, shadowparams[4], shadowoffset[4], distbias * lightpos[4].w); + light4atten *= filtershadow(shadow4tc); + + + + + float light4spec = pow(clamp(light4invdist*(dot(camdir, light4dir) - light4facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light4spec) * lightcolor[4] * light4atten; + + + + } + } + + vec3 light5dir = pos.xyz * lightpos[5].w - lightpos[5].xyz; + float light5dist2 = dot(light5dir, light5dir); + if(light5dist2 < 1.0) + { + + float light5facing = dot(light5dir, normal.xyz); + if(light5facing < 0.0) + { + float light5invdist = inversesqrt(light5dist2); + + float light5atten = light5facing * (1.0 - light5invdist); + + + + vec3 shadow5tc = getshadowtc(light5dir, shadowparams[5], shadowoffset[5], distbias * lightpos[5].w); + light5atten *= filtershadow(shadow5tc); + + + + + float light5spec = pow(clamp(light5invdist*(dot(camdir, light5dir) - light5facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light5spec) * lightcolor[5] * light5atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/413.shader_test b/shaders/tesseract/413.shader_test new file mode 100644 index 0000000..57c67bb --- /dev/null +++ b/shaders/tesseract/413.shader_test @@ -0,0 +1,276 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 , tex2; + + + + uniform vec4 lightpos[6]; + uniform vec3 lightcolor[6]; + + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define alpha normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + vec3 light2dir = pos.xyz * lightpos[2].w - lightpos[2].xyz; + float light2dist2 = dot(light2dir, light2dir); + if(light2dist2 < 1.0) + { + + float light2facing = dot(light2dir, normal.xyz); + if(light2facing < 0.0) + { + float light2invdist = inversesqrt(light2dist2); + + float light2atten = light2facing * (1.0 - light2invdist); + + + + + + + float light2spec = pow(clamp(light2invdist*(dot(camdir, light2dir) - light2facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light2spec) * lightcolor[2] * light2atten; + + + + } + } + + vec3 light3dir = pos.xyz * lightpos[3].w - lightpos[3].xyz; + float light3dist2 = dot(light3dir, light3dir); + if(light3dist2 < 1.0) + { + + float light3facing = dot(light3dir, normal.xyz); + if(light3facing < 0.0) + { + float light3invdist = inversesqrt(light3dist2); + + float light3atten = light3facing * (1.0 - light3invdist); + + + + + + + float light3spec = pow(clamp(light3invdist*(dot(camdir, light3dir) - light3facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light3spec) * lightcolor[3] * light3atten; + + + + } + } + + vec3 light4dir = pos.xyz * lightpos[4].w - lightpos[4].xyz; + float light4dist2 = dot(light4dir, light4dir); + if(light4dist2 < 1.0) + { + + float light4facing = dot(light4dir, normal.xyz); + if(light4facing < 0.0) + { + float light4invdist = inversesqrt(light4dist2); + + float light4atten = light4facing * (1.0 - light4invdist); + + + + + + + float light4spec = pow(clamp(light4invdist*(dot(camdir, light4dir) - light4facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light4spec) * lightcolor[4] * light4atten; + + + + } + } + + vec3 light5dir = pos.xyz * lightpos[5].w - lightpos[5].xyz; + float light5dist2 = dot(light5dir, light5dir); + if(light5dist2 < 1.0) + { + + float light5facing = dot(light5dir, normal.xyz); + if(light5facing < 0.0) + { + float light5invdist = inversesqrt(light5dist2); + + float light5atten = light5facing * (1.0 - light5invdist); + + + + + + + float light5spec = pow(clamp(light5invdist*(dot(camdir, light5dir) - light5facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light5spec) * lightcolor[5] * light5atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/415.shader_test b/shaders/tesseract/415.shader_test new file mode 100644 index 0000000..4ff520a --- /dev/null +++ b/shaders/tesseract/415.shader_test @@ -0,0 +1,333 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 , tex2; + + + uniform sampler2DRectShadow tex4; + + + uniform vec4 lightpos[6]; + uniform vec3 lightcolor[6]; + + + uniform vec4 shadowparams[6]; + uniform vec2 shadowoffset[6]; + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + vec3 getshadowtc(vec3 dir, vec4 shadowparams, vec2 shadowoffset, float distbias) + { + vec3 adir = abs(dir); + float m = max(adir.x, adir.y), mz = max(adir.z, m); + vec2 mparams = shadowparams.xy / max(mz + distbias, 1e-5); + vec4 proj; + if(adir.x > adir.y) proj = vec4(dir.zyx, 0.0); else proj = vec4(dir.xzy, 1.0); + if(adir.z > m) proj = vec4(dir, 2.0); + return vec3(proj.xy * mparams.x + vec2(proj.w, step(proj.z, 0.0)) * shadowparams.z + shadowoffset, mparams.y + shadowparams.w); + } + + + + #define shadowval(center, xoff, yoff) float(shadow2DRect(tex4, center + vec3(xoff, yoff, 0.0))) + float filtershadow(vec3 shadowtc) + { + vec2 offset = fract(shadowtc.xy - 0.5); + vec3 center = shadowtc; + + + + + + + + center.xy -= offset*0.5; + vec4 size = vec4(offset + 1.0, 2.0 - offset); + return (1.0/9.0)*dot(size.zxzx*size.wwyy, + vec4(shadowval(center, -0.5, -0.5), + shadowval(center, 1.0, -0.5), + shadowval(center, -0.5, 1.0), + shadowval(center, 1.0, 1.0))); + } + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define alpha normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + #define distbias 0.0 + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + vec3 shadow0tc = getshadowtc(light0dir, shadowparams[0], shadowoffset[0], distbias * lightpos[0].w); + light0atten *= filtershadow(shadow0tc); + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + vec3 shadow1tc = getshadowtc(light1dir, shadowparams[1], shadowoffset[1], distbias * lightpos[1].w); + light1atten *= filtershadow(shadow1tc); + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + vec3 light2dir = pos.xyz * lightpos[2].w - lightpos[2].xyz; + float light2dist2 = dot(light2dir, light2dir); + if(light2dist2 < 1.0) + { + + float light2facing = dot(light2dir, normal.xyz); + if(light2facing < 0.0) + { + float light2invdist = inversesqrt(light2dist2); + + float light2atten = light2facing * (1.0 - light2invdist); + + + + vec3 shadow2tc = getshadowtc(light2dir, shadowparams[2], shadowoffset[2], distbias * lightpos[2].w); + light2atten *= filtershadow(shadow2tc); + + + + + float light2spec = pow(clamp(light2invdist*(dot(camdir, light2dir) - light2facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light2spec) * lightcolor[2] * light2atten; + + + + } + } + + vec3 light3dir = pos.xyz * lightpos[3].w - lightpos[3].xyz; + float light3dist2 = dot(light3dir, light3dir); + if(light3dist2 < 1.0) + { + + float light3facing = dot(light3dir, normal.xyz); + if(light3facing < 0.0) + { + float light3invdist = inversesqrt(light3dist2); + + float light3atten = light3facing * (1.0 - light3invdist); + + + + vec3 shadow3tc = getshadowtc(light3dir, shadowparams[3], shadowoffset[3], distbias * lightpos[3].w); + light3atten *= filtershadow(shadow3tc); + + + + + float light3spec = pow(clamp(light3invdist*(dot(camdir, light3dir) - light3facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light3spec) * lightcolor[3] * light3atten; + + + + } + } + + vec3 light4dir = pos.xyz * lightpos[4].w - lightpos[4].xyz; + float light4dist2 = dot(light4dir, light4dir); + if(light4dist2 < 1.0) + { + + float light4facing = dot(light4dir, normal.xyz); + if(light4facing < 0.0) + { + float light4invdist = inversesqrt(light4dist2); + + float light4atten = light4facing * (1.0 - light4invdist); + + + + vec3 shadow4tc = getshadowtc(light4dir, shadowparams[4], shadowoffset[4], distbias * lightpos[4].w); + light4atten *= filtershadow(shadow4tc); + + + + + float light4spec = pow(clamp(light4invdist*(dot(camdir, light4dir) - light4facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light4spec) * lightcolor[4] * light4atten; + + + + } + } + + vec3 light5dir = pos.xyz * lightpos[5].w - lightpos[5].xyz; + float light5dist2 = dot(light5dir, light5dir); + if(light5dist2 < 1.0) + { + + float light5facing = dot(light5dir, normal.xyz); + if(light5facing < 0.0) + { + float light5invdist = inversesqrt(light5dist2); + + float light5atten = light5facing * (1.0 - light5invdist); + + + + vec3 shadow5tc = getshadowtc(light5dir, shadowparams[5], shadowoffset[5], distbias * lightpos[5].w); + light5atten *= filtershadow(shadow5tc); + + + + + float light5spec = pow(clamp(light5invdist*(dot(camdir, light5dir) - light5facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light5spec) * lightcolor[5] * light5atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/417.shader_test b/shaders/tesseract/417.shader_test new file mode 100644 index 0000000..cf328f0 --- /dev/null +++ b/shaders/tesseract/417.shader_test @@ -0,0 +1,279 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 ; + + + + uniform vec4 lightpos[6]; + uniform vec3 lightcolor[6]; + + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + #define alpha 1.0 + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define glowscale normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + diffuse.rgb *= glowscale; + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + vec3 light2dir = pos.xyz * lightpos[2].w - lightpos[2].xyz; + float light2dist2 = dot(light2dir, light2dir); + if(light2dist2 < 1.0) + { + + float light2facing = dot(light2dir, normal.xyz); + if(light2facing < 0.0) + { + float light2invdist = inversesqrt(light2dist2); + + float light2atten = light2facing * (1.0 - light2invdist); + + + + + + + float light2spec = pow(clamp(light2invdist*(dot(camdir, light2dir) - light2facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light2spec) * lightcolor[2] * light2atten; + + + + } + } + + vec3 light3dir = pos.xyz * lightpos[3].w - lightpos[3].xyz; + float light3dist2 = dot(light3dir, light3dir); + if(light3dist2 < 1.0) + { + + float light3facing = dot(light3dir, normal.xyz); + if(light3facing < 0.0) + { + float light3invdist = inversesqrt(light3dist2); + + float light3atten = light3facing * (1.0 - light3invdist); + + + + + + + float light3spec = pow(clamp(light3invdist*(dot(camdir, light3dir) - light3facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light3spec) * lightcolor[3] * light3atten; + + + + } + } + + vec3 light4dir = pos.xyz * lightpos[4].w - lightpos[4].xyz; + float light4dist2 = dot(light4dir, light4dir); + if(light4dist2 < 1.0) + { + + float light4facing = dot(light4dir, normal.xyz); + if(light4facing < 0.0) + { + float light4invdist = inversesqrt(light4dist2); + + float light4atten = light4facing * (1.0 - light4invdist); + + + + + + + float light4spec = pow(clamp(light4invdist*(dot(camdir, light4dir) - light4facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light4spec) * lightcolor[4] * light4atten; + + + + } + } + + vec3 light5dir = pos.xyz * lightpos[5].w - lightpos[5].xyz; + float light5dist2 = dot(light5dir, light5dir); + if(light5dist2 < 1.0) + { + + float light5facing = dot(light5dir, normal.xyz); + if(light5facing < 0.0) + { + float light5invdist = inversesqrt(light5dist2); + + float light5atten = light5facing * (1.0 - light5invdist); + + + + + + + float light5spec = pow(clamp(light5invdist*(dot(camdir, light5dir) - light5facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light5spec) * lightcolor[5] * light5atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/419.shader_test b/shaders/tesseract/419.shader_test new file mode 100644 index 0000000..2e1f44b --- /dev/null +++ b/shaders/tesseract/419.shader_test @@ -0,0 +1,336 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 ; + + + uniform sampler2DRectShadow tex4; + + + uniform vec4 lightpos[6]; + uniform vec3 lightcolor[6]; + + + uniform vec4 shadowparams[6]; + uniform vec2 shadowoffset[6]; + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + vec3 getshadowtc(vec3 dir, vec4 shadowparams, vec2 shadowoffset, float distbias) + { + vec3 adir = abs(dir); + float m = max(adir.x, adir.y), mz = max(adir.z, m); + vec2 mparams = shadowparams.xy / max(mz + distbias, 1e-5); + vec4 proj; + if(adir.x > adir.y) proj = vec4(dir.zyx, 0.0); else proj = vec4(dir.xzy, 1.0); + if(adir.z > m) proj = vec4(dir, 2.0); + return vec3(proj.xy * mparams.x + vec2(proj.w, step(proj.z, 0.0)) * shadowparams.z + shadowoffset, mparams.y + shadowparams.w); + } + + + + #define shadowval(center, xoff, yoff) float(shadow2DRect(tex4, center + vec3(xoff, yoff, 0.0))) + float filtershadow(vec3 shadowtc) + { + vec2 offset = fract(shadowtc.xy - 0.5); + vec3 center = shadowtc; + + + + + + + + center.xy -= offset*0.5; + vec4 size = vec4(offset + 1.0, 2.0 - offset); + return (1.0/9.0)*dot(size.zxzx*size.wwyy, + vec4(shadowval(center, -0.5, -0.5), + shadowval(center, 1.0, -0.5), + shadowval(center, -0.5, 1.0), + shadowval(center, 1.0, 1.0))); + } + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + #define alpha 1.0 + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define glowscale normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + diffuse.rgb *= glowscale; + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + #define distbias -8.0 + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + vec3 shadow0tc = getshadowtc(light0dir, shadowparams[0], shadowoffset[0], distbias * lightpos[0].w); + light0atten *= filtershadow(shadow0tc); + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + vec3 shadow1tc = getshadowtc(light1dir, shadowparams[1], shadowoffset[1], distbias * lightpos[1].w); + light1atten *= filtershadow(shadow1tc); + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + vec3 light2dir = pos.xyz * lightpos[2].w - lightpos[2].xyz; + float light2dist2 = dot(light2dir, light2dir); + if(light2dist2 < 1.0) + { + + float light2facing = dot(light2dir, normal.xyz); + if(light2facing < 0.0) + { + float light2invdist = inversesqrt(light2dist2); + + float light2atten = light2facing * (1.0 - light2invdist); + + + + vec3 shadow2tc = getshadowtc(light2dir, shadowparams[2], shadowoffset[2], distbias * lightpos[2].w); + light2atten *= filtershadow(shadow2tc); + + + + + float light2spec = pow(clamp(light2invdist*(dot(camdir, light2dir) - light2facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light2spec) * lightcolor[2] * light2atten; + + + + } + } + + vec3 light3dir = pos.xyz * lightpos[3].w - lightpos[3].xyz; + float light3dist2 = dot(light3dir, light3dir); + if(light3dist2 < 1.0) + { + + float light3facing = dot(light3dir, normal.xyz); + if(light3facing < 0.0) + { + float light3invdist = inversesqrt(light3dist2); + + float light3atten = light3facing * (1.0 - light3invdist); + + + + vec3 shadow3tc = getshadowtc(light3dir, shadowparams[3], shadowoffset[3], distbias * lightpos[3].w); + light3atten *= filtershadow(shadow3tc); + + + + + float light3spec = pow(clamp(light3invdist*(dot(camdir, light3dir) - light3facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light3spec) * lightcolor[3] * light3atten; + + + + } + } + + vec3 light4dir = pos.xyz * lightpos[4].w - lightpos[4].xyz; + float light4dist2 = dot(light4dir, light4dir); + if(light4dist2 < 1.0) + { + + float light4facing = dot(light4dir, normal.xyz); + if(light4facing < 0.0) + { + float light4invdist = inversesqrt(light4dist2); + + float light4atten = light4facing * (1.0 - light4invdist); + + + + vec3 shadow4tc = getshadowtc(light4dir, shadowparams[4], shadowoffset[4], distbias * lightpos[4].w); + light4atten *= filtershadow(shadow4tc); + + + + + float light4spec = pow(clamp(light4invdist*(dot(camdir, light4dir) - light4facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light4spec) * lightcolor[4] * light4atten; + + + + } + } + + vec3 light5dir = pos.xyz * lightpos[5].w - lightpos[5].xyz; + float light5dist2 = dot(light5dir, light5dir); + if(light5dist2 < 1.0) + { + + float light5facing = dot(light5dir, normal.xyz); + if(light5facing < 0.0) + { + float light5invdist = inversesqrt(light5dist2); + + float light5atten = light5facing * (1.0 - light5invdist); + + + + vec3 shadow5tc = getshadowtc(light5dir, shadowparams[5], shadowoffset[5], distbias * lightpos[5].w); + light5atten *= filtershadow(shadow5tc); + + + + + float light5spec = pow(clamp(light5invdist*(dot(camdir, light5dir) - light5facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light5spec) * lightcolor[5] * light5atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/42.shader_test b/shaders/tesseract/42.shader_test new file mode 100644 index 0000000..6a9c976 --- /dev/null +++ b/shaders/tesseract/42.shader_test @@ -0,0 +1,41 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vcolor; + attribute vec2 vtexcoord0; + uniform mat4 hudmatrix; + varying vec2 texcoord0; + varying vec4 colorscale; + void main(void) + { + gl_Position = hudmatrix * vvertex; + texcoord0 = vtexcoord0; + colorscale = vcolor; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2D tex0; + varying vec2 texcoord0; + varying vec4 colorscale; + fragdata(0, fragcolor, vec4) + void main(void) + { + vec4 color = texture2D(tex0, texcoord0); + #pragma CUBE2_swizzle color + fragcolor.rgb = colorscale.rgb * color.rgb; + fragcolor.a = colorscale.a; + } + diff --git a/shaders/tesseract/423.shader_test b/shaders/tesseract/423.shader_test new file mode 100644 index 0000000..2561bf5 --- /dev/null +++ b/shaders/tesseract/423.shader_test @@ -0,0 +1,364 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 ; + + + uniform sampler2DRectShadow tex4; + + + uniform vec4 lightpos[7]; + uniform vec3 lightcolor[7]; + + + uniform vec4 shadowparams[7]; + uniform vec2 shadowoffset[7]; + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + vec3 getshadowtc(vec3 dir, vec4 shadowparams, vec2 shadowoffset, float distbias) + { + vec3 adir = abs(dir); + float m = max(adir.x, adir.y), mz = max(adir.z, m); + vec2 mparams = shadowparams.xy / max(mz + distbias, 1e-5); + vec4 proj; + if(adir.x > adir.y) proj = vec4(dir.zyx, 0.0); else proj = vec4(dir.xzy, 1.0); + if(adir.z > m) proj = vec4(dir, 2.0); + return vec3(proj.xy * mparams.x + vec2(proj.w, step(proj.z, 0.0)) * shadowparams.z + shadowoffset, mparams.y + shadowparams.w); + } + + + + #define shadowval(center, xoff, yoff) float(shadow2DRect(tex4, center + vec3(xoff, yoff, 0.0))) + float filtershadow(vec3 shadowtc) + { + vec2 offset = fract(shadowtc.xy - 0.5); + vec3 center = shadowtc; + + + + + + + + center.xy -= offset*0.5; + vec4 size = vec4(offset + 1.0, 2.0 - offset); + return (1.0/9.0)*dot(size.zxzx*size.wwyy, + vec4(shadowval(center, -0.5, -0.5), + shadowval(center, 1.0, -0.5), + shadowval(center, -0.5, 1.0), + shadowval(center, 1.0, 1.0))); + } + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + #define alpha 1.0 + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define glowscale normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + diffuse.rgb *= glowscale; + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + #define distbias 0.0 + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + vec3 shadow0tc = getshadowtc(light0dir, shadowparams[0], shadowoffset[0], distbias * lightpos[0].w); + light0atten *= filtershadow(shadow0tc); + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + vec3 shadow1tc = getshadowtc(light1dir, shadowparams[1], shadowoffset[1], distbias * lightpos[1].w); + light1atten *= filtershadow(shadow1tc); + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + vec3 light2dir = pos.xyz * lightpos[2].w - lightpos[2].xyz; + float light2dist2 = dot(light2dir, light2dir); + if(light2dist2 < 1.0) + { + + float light2facing = dot(light2dir, normal.xyz); + if(light2facing < 0.0) + { + float light2invdist = inversesqrt(light2dist2); + + float light2atten = light2facing * (1.0 - light2invdist); + + + + vec3 shadow2tc = getshadowtc(light2dir, shadowparams[2], shadowoffset[2], distbias * lightpos[2].w); + light2atten *= filtershadow(shadow2tc); + + + + + float light2spec = pow(clamp(light2invdist*(dot(camdir, light2dir) - light2facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light2spec) * lightcolor[2] * light2atten; + + + + } + } + + vec3 light3dir = pos.xyz * lightpos[3].w - lightpos[3].xyz; + float light3dist2 = dot(light3dir, light3dir); + if(light3dist2 < 1.0) + { + + float light3facing = dot(light3dir, normal.xyz); + if(light3facing < 0.0) + { + float light3invdist = inversesqrt(light3dist2); + + float light3atten = light3facing * (1.0 - light3invdist); + + + + vec3 shadow3tc = getshadowtc(light3dir, shadowparams[3], shadowoffset[3], distbias * lightpos[3].w); + light3atten *= filtershadow(shadow3tc); + + + + + float light3spec = pow(clamp(light3invdist*(dot(camdir, light3dir) - light3facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light3spec) * lightcolor[3] * light3atten; + + + + } + } + + vec3 light4dir = pos.xyz * lightpos[4].w - lightpos[4].xyz; + float light4dist2 = dot(light4dir, light4dir); + if(light4dist2 < 1.0) + { + + float light4facing = dot(light4dir, normal.xyz); + if(light4facing < 0.0) + { + float light4invdist = inversesqrt(light4dist2); + + float light4atten = light4facing * (1.0 - light4invdist); + + + + vec3 shadow4tc = getshadowtc(light4dir, shadowparams[4], shadowoffset[4], distbias * lightpos[4].w); + light4atten *= filtershadow(shadow4tc); + + + + + float light4spec = pow(clamp(light4invdist*(dot(camdir, light4dir) - light4facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light4spec) * lightcolor[4] * light4atten; + + + + } + } + + vec3 light5dir = pos.xyz * lightpos[5].w - lightpos[5].xyz; + float light5dist2 = dot(light5dir, light5dir); + if(light5dist2 < 1.0) + { + + float light5facing = dot(light5dir, normal.xyz); + if(light5facing < 0.0) + { + float light5invdist = inversesqrt(light5dist2); + + float light5atten = light5facing * (1.0 - light5invdist); + + + + vec3 shadow5tc = getshadowtc(light5dir, shadowparams[5], shadowoffset[5], distbias * lightpos[5].w); + light5atten *= filtershadow(shadow5tc); + + + + + float light5spec = pow(clamp(light5invdist*(dot(camdir, light5dir) - light5facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light5spec) * lightcolor[5] * light5atten; + + + + } + } + + vec3 light6dir = pos.xyz * lightpos[6].w - lightpos[6].xyz; + float light6dist2 = dot(light6dir, light6dir); + if(light6dist2 < 1.0) + { + + float light6facing = dot(light6dir, normal.xyz); + if(light6facing < 0.0) + { + float light6invdist = inversesqrt(light6dist2); + + float light6atten = light6facing * (1.0 - light6invdist); + + + + vec3 shadow6tc = getshadowtc(light6dir, shadowparams[6], shadowoffset[6], distbias * lightpos[6].w); + light6atten *= filtershadow(shadow6tc); + + + + + float light6spec = pow(clamp(light6invdist*(dot(camdir, light6dir) - light6facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light6spec) * lightcolor[6] * light6atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/425.shader_test b/shaders/tesseract/425.shader_test new file mode 100644 index 0000000..5407757 --- /dev/null +++ b/shaders/tesseract/425.shader_test @@ -0,0 +1,301 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 , tex2; + + + + uniform vec4 lightpos[7]; + uniform vec3 lightcolor[7]; + + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define alpha normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + vec3 light2dir = pos.xyz * lightpos[2].w - lightpos[2].xyz; + float light2dist2 = dot(light2dir, light2dir); + if(light2dist2 < 1.0) + { + + float light2facing = dot(light2dir, normal.xyz); + if(light2facing < 0.0) + { + float light2invdist = inversesqrt(light2dist2); + + float light2atten = light2facing * (1.0 - light2invdist); + + + + + + + float light2spec = pow(clamp(light2invdist*(dot(camdir, light2dir) - light2facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light2spec) * lightcolor[2] * light2atten; + + + + } + } + + vec3 light3dir = pos.xyz * lightpos[3].w - lightpos[3].xyz; + float light3dist2 = dot(light3dir, light3dir); + if(light3dist2 < 1.0) + { + + float light3facing = dot(light3dir, normal.xyz); + if(light3facing < 0.0) + { + float light3invdist = inversesqrt(light3dist2); + + float light3atten = light3facing * (1.0 - light3invdist); + + + + + + + float light3spec = pow(clamp(light3invdist*(dot(camdir, light3dir) - light3facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light3spec) * lightcolor[3] * light3atten; + + + + } + } + + vec3 light4dir = pos.xyz * lightpos[4].w - lightpos[4].xyz; + float light4dist2 = dot(light4dir, light4dir); + if(light4dist2 < 1.0) + { + + float light4facing = dot(light4dir, normal.xyz); + if(light4facing < 0.0) + { + float light4invdist = inversesqrt(light4dist2); + + float light4atten = light4facing * (1.0 - light4invdist); + + + + + + + float light4spec = pow(clamp(light4invdist*(dot(camdir, light4dir) - light4facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light4spec) * lightcolor[4] * light4atten; + + + + } + } + + vec3 light5dir = pos.xyz * lightpos[5].w - lightpos[5].xyz; + float light5dist2 = dot(light5dir, light5dir); + if(light5dist2 < 1.0) + { + + float light5facing = dot(light5dir, normal.xyz); + if(light5facing < 0.0) + { + float light5invdist = inversesqrt(light5dist2); + + float light5atten = light5facing * (1.0 - light5invdist); + + + + + + + float light5spec = pow(clamp(light5invdist*(dot(camdir, light5dir) - light5facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light5spec) * lightcolor[5] * light5atten; + + + + } + } + + vec3 light6dir = pos.xyz * lightpos[6].w - lightpos[6].xyz; + float light6dist2 = dot(light6dir, light6dir); + if(light6dist2 < 1.0) + { + + float light6facing = dot(light6dir, normal.xyz); + if(light6facing < 0.0) + { + float light6invdist = inversesqrt(light6dist2); + + float light6atten = light6facing * (1.0 - light6invdist); + + + + + + + float light6spec = pow(clamp(light6invdist*(dot(camdir, light6dir) - light6facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light6spec) * lightcolor[6] * light6atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/427.shader_test b/shaders/tesseract/427.shader_test new file mode 100644 index 0000000..274ddcf --- /dev/null +++ b/shaders/tesseract/427.shader_test @@ -0,0 +1,361 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 , tex2; + + + uniform sampler2DRectShadow tex4; + + + uniform vec4 lightpos[7]; + uniform vec3 lightcolor[7]; + + + uniform vec4 shadowparams[7]; + uniform vec2 shadowoffset[7]; + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + vec3 getshadowtc(vec3 dir, vec4 shadowparams, vec2 shadowoffset, float distbias) + { + vec3 adir = abs(dir); + float m = max(adir.x, adir.y), mz = max(adir.z, m); + vec2 mparams = shadowparams.xy / max(mz + distbias, 1e-5); + vec4 proj; + if(adir.x > adir.y) proj = vec4(dir.zyx, 0.0); else proj = vec4(dir.xzy, 1.0); + if(adir.z > m) proj = vec4(dir, 2.0); + return vec3(proj.xy * mparams.x + vec2(proj.w, step(proj.z, 0.0)) * shadowparams.z + shadowoffset, mparams.y + shadowparams.w); + } + + + + #define shadowval(center, xoff, yoff) float(shadow2DRect(tex4, center + vec3(xoff, yoff, 0.0))) + float filtershadow(vec3 shadowtc) + { + vec2 offset = fract(shadowtc.xy - 0.5); + vec3 center = shadowtc; + + + + + + + + center.xy -= offset*0.5; + vec4 size = vec4(offset + 1.0, 2.0 - offset); + return (1.0/9.0)*dot(size.zxzx*size.wwyy, + vec4(shadowval(center, -0.5, -0.5), + shadowval(center, 1.0, -0.5), + shadowval(center, -0.5, 1.0), + shadowval(center, 1.0, 1.0))); + } + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define alpha normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + #define distbias 0.0 + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + vec3 shadow0tc = getshadowtc(light0dir, shadowparams[0], shadowoffset[0], distbias * lightpos[0].w); + light0atten *= filtershadow(shadow0tc); + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + vec3 shadow1tc = getshadowtc(light1dir, shadowparams[1], shadowoffset[1], distbias * lightpos[1].w); + light1atten *= filtershadow(shadow1tc); + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + vec3 light2dir = pos.xyz * lightpos[2].w - lightpos[2].xyz; + float light2dist2 = dot(light2dir, light2dir); + if(light2dist2 < 1.0) + { + + float light2facing = dot(light2dir, normal.xyz); + if(light2facing < 0.0) + { + float light2invdist = inversesqrt(light2dist2); + + float light2atten = light2facing * (1.0 - light2invdist); + + + + vec3 shadow2tc = getshadowtc(light2dir, shadowparams[2], shadowoffset[2], distbias * lightpos[2].w); + light2atten *= filtershadow(shadow2tc); + + + + + float light2spec = pow(clamp(light2invdist*(dot(camdir, light2dir) - light2facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light2spec) * lightcolor[2] * light2atten; + + + + } + } + + vec3 light3dir = pos.xyz * lightpos[3].w - lightpos[3].xyz; + float light3dist2 = dot(light3dir, light3dir); + if(light3dist2 < 1.0) + { + + float light3facing = dot(light3dir, normal.xyz); + if(light3facing < 0.0) + { + float light3invdist = inversesqrt(light3dist2); + + float light3atten = light3facing * (1.0 - light3invdist); + + + + vec3 shadow3tc = getshadowtc(light3dir, shadowparams[3], shadowoffset[3], distbias * lightpos[3].w); + light3atten *= filtershadow(shadow3tc); + + + + + float light3spec = pow(clamp(light3invdist*(dot(camdir, light3dir) - light3facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light3spec) * lightcolor[3] * light3atten; + + + + } + } + + vec3 light4dir = pos.xyz * lightpos[4].w - lightpos[4].xyz; + float light4dist2 = dot(light4dir, light4dir); + if(light4dist2 < 1.0) + { + + float light4facing = dot(light4dir, normal.xyz); + if(light4facing < 0.0) + { + float light4invdist = inversesqrt(light4dist2); + + float light4atten = light4facing * (1.0 - light4invdist); + + + + vec3 shadow4tc = getshadowtc(light4dir, shadowparams[4], shadowoffset[4], distbias * lightpos[4].w); + light4atten *= filtershadow(shadow4tc); + + + + + float light4spec = pow(clamp(light4invdist*(dot(camdir, light4dir) - light4facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light4spec) * lightcolor[4] * light4atten; + + + + } + } + + vec3 light5dir = pos.xyz * lightpos[5].w - lightpos[5].xyz; + float light5dist2 = dot(light5dir, light5dir); + if(light5dist2 < 1.0) + { + + float light5facing = dot(light5dir, normal.xyz); + if(light5facing < 0.0) + { + float light5invdist = inversesqrt(light5dist2); + + float light5atten = light5facing * (1.0 - light5invdist); + + + + vec3 shadow5tc = getshadowtc(light5dir, shadowparams[5], shadowoffset[5], distbias * lightpos[5].w); + light5atten *= filtershadow(shadow5tc); + + + + + float light5spec = pow(clamp(light5invdist*(dot(camdir, light5dir) - light5facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light5spec) * lightcolor[5] * light5atten; + + + + } + } + + vec3 light6dir = pos.xyz * lightpos[6].w - lightpos[6].xyz; + float light6dist2 = dot(light6dir, light6dir); + if(light6dist2 < 1.0) + { + + float light6facing = dot(light6dir, normal.xyz); + if(light6facing < 0.0) + { + float light6invdist = inversesqrt(light6dist2); + + float light6atten = light6facing * (1.0 - light6invdist); + + + + vec3 shadow6tc = getshadowtc(light6dir, shadowparams[6], shadowoffset[6], distbias * lightpos[6].w); + light6atten *= filtershadow(shadow6tc); + + + + + float light6spec = pow(clamp(light6invdist*(dot(camdir, light6dir) - light6facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light6spec) * lightcolor[6] * light6atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/429.shader_test b/shaders/tesseract/429.shader_test new file mode 100644 index 0000000..4a86ec9 --- /dev/null +++ b/shaders/tesseract/429.shader_test @@ -0,0 +1,304 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 ; + + + + uniform vec4 lightpos[7]; + uniform vec3 lightcolor[7]; + + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + #define alpha 1.0 + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define glowscale normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + diffuse.rgb *= glowscale; + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + vec3 light2dir = pos.xyz * lightpos[2].w - lightpos[2].xyz; + float light2dist2 = dot(light2dir, light2dir); + if(light2dist2 < 1.0) + { + + float light2facing = dot(light2dir, normal.xyz); + if(light2facing < 0.0) + { + float light2invdist = inversesqrt(light2dist2); + + float light2atten = light2facing * (1.0 - light2invdist); + + + + + + + float light2spec = pow(clamp(light2invdist*(dot(camdir, light2dir) - light2facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light2spec) * lightcolor[2] * light2atten; + + + + } + } + + vec3 light3dir = pos.xyz * lightpos[3].w - lightpos[3].xyz; + float light3dist2 = dot(light3dir, light3dir); + if(light3dist2 < 1.0) + { + + float light3facing = dot(light3dir, normal.xyz); + if(light3facing < 0.0) + { + float light3invdist = inversesqrt(light3dist2); + + float light3atten = light3facing * (1.0 - light3invdist); + + + + + + + float light3spec = pow(clamp(light3invdist*(dot(camdir, light3dir) - light3facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light3spec) * lightcolor[3] * light3atten; + + + + } + } + + vec3 light4dir = pos.xyz * lightpos[4].w - lightpos[4].xyz; + float light4dist2 = dot(light4dir, light4dir); + if(light4dist2 < 1.0) + { + + float light4facing = dot(light4dir, normal.xyz); + if(light4facing < 0.0) + { + float light4invdist = inversesqrt(light4dist2); + + float light4atten = light4facing * (1.0 - light4invdist); + + + + + + + float light4spec = pow(clamp(light4invdist*(dot(camdir, light4dir) - light4facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light4spec) * lightcolor[4] * light4atten; + + + + } + } + + vec3 light5dir = pos.xyz * lightpos[5].w - lightpos[5].xyz; + float light5dist2 = dot(light5dir, light5dir); + if(light5dist2 < 1.0) + { + + float light5facing = dot(light5dir, normal.xyz); + if(light5facing < 0.0) + { + float light5invdist = inversesqrt(light5dist2); + + float light5atten = light5facing * (1.0 - light5invdist); + + + + + + + float light5spec = pow(clamp(light5invdist*(dot(camdir, light5dir) - light5facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light5spec) * lightcolor[5] * light5atten; + + + + } + } + + vec3 light6dir = pos.xyz * lightpos[6].w - lightpos[6].xyz; + float light6dist2 = dot(light6dir, light6dir); + if(light6dist2 < 1.0) + { + + float light6facing = dot(light6dir, normal.xyz); + if(light6facing < 0.0) + { + float light6invdist = inversesqrt(light6dist2); + + float light6atten = light6facing * (1.0 - light6invdist); + + + + + + + float light6spec = pow(clamp(light6invdist*(dot(camdir, light6dir) - light6facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light6spec) * lightcolor[6] * light6atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/431.shader_test b/shaders/tesseract/431.shader_test new file mode 100644 index 0000000..47e9812 --- /dev/null +++ b/shaders/tesseract/431.shader_test @@ -0,0 +1,364 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 ; + + + uniform sampler2DRectShadow tex4; + + + uniform vec4 lightpos[7]; + uniform vec3 lightcolor[7]; + + + uniform vec4 shadowparams[7]; + uniform vec2 shadowoffset[7]; + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + vec3 getshadowtc(vec3 dir, vec4 shadowparams, vec2 shadowoffset, float distbias) + { + vec3 adir = abs(dir); + float m = max(adir.x, adir.y), mz = max(adir.z, m); + vec2 mparams = shadowparams.xy / max(mz + distbias, 1e-5); + vec4 proj; + if(adir.x > adir.y) proj = vec4(dir.zyx, 0.0); else proj = vec4(dir.xzy, 1.0); + if(adir.z > m) proj = vec4(dir, 2.0); + return vec3(proj.xy * mparams.x + vec2(proj.w, step(proj.z, 0.0)) * shadowparams.z + shadowoffset, mparams.y + shadowparams.w); + } + + + + #define shadowval(center, xoff, yoff) float(shadow2DRect(tex4, center + vec3(xoff, yoff, 0.0))) + float filtershadow(vec3 shadowtc) + { + vec2 offset = fract(shadowtc.xy - 0.5); + vec3 center = shadowtc; + + + + + + + + center.xy -= offset*0.5; + vec4 size = vec4(offset + 1.0, 2.0 - offset); + return (1.0/9.0)*dot(size.zxzx*size.wwyy, + vec4(shadowval(center, -0.5, -0.5), + shadowval(center, 1.0, -0.5), + shadowval(center, -0.5, 1.0), + shadowval(center, 1.0, 1.0))); + } + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + #define alpha 1.0 + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define glowscale normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + diffuse.rgb *= glowscale; + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + #define distbias -8.0 + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + vec3 shadow0tc = getshadowtc(light0dir, shadowparams[0], shadowoffset[0], distbias * lightpos[0].w); + light0atten *= filtershadow(shadow0tc); + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + vec3 shadow1tc = getshadowtc(light1dir, shadowparams[1], shadowoffset[1], distbias * lightpos[1].w); + light1atten *= filtershadow(shadow1tc); + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + vec3 light2dir = pos.xyz * lightpos[2].w - lightpos[2].xyz; + float light2dist2 = dot(light2dir, light2dir); + if(light2dist2 < 1.0) + { + + float light2facing = dot(light2dir, normal.xyz); + if(light2facing < 0.0) + { + float light2invdist = inversesqrt(light2dist2); + + float light2atten = light2facing * (1.0 - light2invdist); + + + + vec3 shadow2tc = getshadowtc(light2dir, shadowparams[2], shadowoffset[2], distbias * lightpos[2].w); + light2atten *= filtershadow(shadow2tc); + + + + + float light2spec = pow(clamp(light2invdist*(dot(camdir, light2dir) - light2facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light2spec) * lightcolor[2] * light2atten; + + + + } + } + + vec3 light3dir = pos.xyz * lightpos[3].w - lightpos[3].xyz; + float light3dist2 = dot(light3dir, light3dir); + if(light3dist2 < 1.0) + { + + float light3facing = dot(light3dir, normal.xyz); + if(light3facing < 0.0) + { + float light3invdist = inversesqrt(light3dist2); + + float light3atten = light3facing * (1.0 - light3invdist); + + + + vec3 shadow3tc = getshadowtc(light3dir, shadowparams[3], shadowoffset[3], distbias * lightpos[3].w); + light3atten *= filtershadow(shadow3tc); + + + + + float light3spec = pow(clamp(light3invdist*(dot(camdir, light3dir) - light3facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light3spec) * lightcolor[3] * light3atten; + + + + } + } + + vec3 light4dir = pos.xyz * lightpos[4].w - lightpos[4].xyz; + float light4dist2 = dot(light4dir, light4dir); + if(light4dist2 < 1.0) + { + + float light4facing = dot(light4dir, normal.xyz); + if(light4facing < 0.0) + { + float light4invdist = inversesqrt(light4dist2); + + float light4atten = light4facing * (1.0 - light4invdist); + + + + vec3 shadow4tc = getshadowtc(light4dir, shadowparams[4], shadowoffset[4], distbias * lightpos[4].w); + light4atten *= filtershadow(shadow4tc); + + + + + float light4spec = pow(clamp(light4invdist*(dot(camdir, light4dir) - light4facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light4spec) * lightcolor[4] * light4atten; + + + + } + } + + vec3 light5dir = pos.xyz * lightpos[5].w - lightpos[5].xyz; + float light5dist2 = dot(light5dir, light5dir); + if(light5dist2 < 1.0) + { + + float light5facing = dot(light5dir, normal.xyz); + if(light5facing < 0.0) + { + float light5invdist = inversesqrt(light5dist2); + + float light5atten = light5facing * (1.0 - light5invdist); + + + + vec3 shadow5tc = getshadowtc(light5dir, shadowparams[5], shadowoffset[5], distbias * lightpos[5].w); + light5atten *= filtershadow(shadow5tc); + + + + + float light5spec = pow(clamp(light5invdist*(dot(camdir, light5dir) - light5facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light5spec) * lightcolor[5] * light5atten; + + + + } + } + + vec3 light6dir = pos.xyz * lightpos[6].w - lightpos[6].xyz; + float light6dist2 = dot(light6dir, light6dir); + if(light6dist2 < 1.0) + { + + float light6facing = dot(light6dir, normal.xyz); + if(light6facing < 0.0) + { + float light6invdist = inversesqrt(light6dist2); + + float light6atten = light6facing * (1.0 - light6invdist); + + + + vec3 shadow6tc = getshadowtc(light6dir, shadowparams[6], shadowoffset[6], distbias * lightpos[6].w); + light6atten *= filtershadow(shadow6tc); + + + + + float light6spec = pow(clamp(light6invdist*(dot(camdir, light6dir) - light6facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light6spec) * lightcolor[6] * light6atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/435.shader_test b/shaders/tesseract/435.shader_test new file mode 100644 index 0000000..71ab5b4 --- /dev/null +++ b/shaders/tesseract/435.shader_test @@ -0,0 +1,392 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 ; + + + uniform sampler2DRectShadow tex4; + + + uniform vec4 lightpos[8]; + uniform vec3 lightcolor[8]; + + + uniform vec4 shadowparams[8]; + uniform vec2 shadowoffset[8]; + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + vec3 getshadowtc(vec3 dir, vec4 shadowparams, vec2 shadowoffset, float distbias) + { + vec3 adir = abs(dir); + float m = max(adir.x, adir.y), mz = max(adir.z, m); + vec2 mparams = shadowparams.xy / max(mz + distbias, 1e-5); + vec4 proj; + if(adir.x > adir.y) proj = vec4(dir.zyx, 0.0); else proj = vec4(dir.xzy, 1.0); + if(adir.z > m) proj = vec4(dir, 2.0); + return vec3(proj.xy * mparams.x + vec2(proj.w, step(proj.z, 0.0)) * shadowparams.z + shadowoffset, mparams.y + shadowparams.w); + } + + + + #define shadowval(center, xoff, yoff) float(shadow2DRect(tex4, center + vec3(xoff, yoff, 0.0))) + float filtershadow(vec3 shadowtc) + { + vec2 offset = fract(shadowtc.xy - 0.5); + vec3 center = shadowtc; + + + + + + + + center.xy -= offset*0.5; + vec4 size = vec4(offset + 1.0, 2.0 - offset); + return (1.0/9.0)*dot(size.zxzx*size.wwyy, + vec4(shadowval(center, -0.5, -0.5), + shadowval(center, 1.0, -0.5), + shadowval(center, -0.5, 1.0), + shadowval(center, 1.0, 1.0))); + } + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + #define alpha 1.0 + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define glowscale normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + diffuse.rgb *= glowscale; + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + #define distbias 0.0 + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + vec3 shadow0tc = getshadowtc(light0dir, shadowparams[0], shadowoffset[0], distbias * lightpos[0].w); + light0atten *= filtershadow(shadow0tc); + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + vec3 shadow1tc = getshadowtc(light1dir, shadowparams[1], shadowoffset[1], distbias * lightpos[1].w); + light1atten *= filtershadow(shadow1tc); + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + vec3 light2dir = pos.xyz * lightpos[2].w - lightpos[2].xyz; + float light2dist2 = dot(light2dir, light2dir); + if(light2dist2 < 1.0) + { + + float light2facing = dot(light2dir, normal.xyz); + if(light2facing < 0.0) + { + float light2invdist = inversesqrt(light2dist2); + + float light2atten = light2facing * (1.0 - light2invdist); + + + + vec3 shadow2tc = getshadowtc(light2dir, shadowparams[2], shadowoffset[2], distbias * lightpos[2].w); + light2atten *= filtershadow(shadow2tc); + + + + + float light2spec = pow(clamp(light2invdist*(dot(camdir, light2dir) - light2facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light2spec) * lightcolor[2] * light2atten; + + + + } + } + + vec3 light3dir = pos.xyz * lightpos[3].w - lightpos[3].xyz; + float light3dist2 = dot(light3dir, light3dir); + if(light3dist2 < 1.0) + { + + float light3facing = dot(light3dir, normal.xyz); + if(light3facing < 0.0) + { + float light3invdist = inversesqrt(light3dist2); + + float light3atten = light3facing * (1.0 - light3invdist); + + + + vec3 shadow3tc = getshadowtc(light3dir, shadowparams[3], shadowoffset[3], distbias * lightpos[3].w); + light3atten *= filtershadow(shadow3tc); + + + + + float light3spec = pow(clamp(light3invdist*(dot(camdir, light3dir) - light3facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light3spec) * lightcolor[3] * light3atten; + + + + } + } + + vec3 light4dir = pos.xyz * lightpos[4].w - lightpos[4].xyz; + float light4dist2 = dot(light4dir, light4dir); + if(light4dist2 < 1.0) + { + + float light4facing = dot(light4dir, normal.xyz); + if(light4facing < 0.0) + { + float light4invdist = inversesqrt(light4dist2); + + float light4atten = light4facing * (1.0 - light4invdist); + + + + vec3 shadow4tc = getshadowtc(light4dir, shadowparams[4], shadowoffset[4], distbias * lightpos[4].w); + light4atten *= filtershadow(shadow4tc); + + + + + float light4spec = pow(clamp(light4invdist*(dot(camdir, light4dir) - light4facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light4spec) * lightcolor[4] * light4atten; + + + + } + } + + vec3 light5dir = pos.xyz * lightpos[5].w - lightpos[5].xyz; + float light5dist2 = dot(light5dir, light5dir); + if(light5dist2 < 1.0) + { + + float light5facing = dot(light5dir, normal.xyz); + if(light5facing < 0.0) + { + float light5invdist = inversesqrt(light5dist2); + + float light5atten = light5facing * (1.0 - light5invdist); + + + + vec3 shadow5tc = getshadowtc(light5dir, shadowparams[5], shadowoffset[5], distbias * lightpos[5].w); + light5atten *= filtershadow(shadow5tc); + + + + + float light5spec = pow(clamp(light5invdist*(dot(camdir, light5dir) - light5facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light5spec) * lightcolor[5] * light5atten; + + + + } + } + + vec3 light6dir = pos.xyz * lightpos[6].w - lightpos[6].xyz; + float light6dist2 = dot(light6dir, light6dir); + if(light6dist2 < 1.0) + { + + float light6facing = dot(light6dir, normal.xyz); + if(light6facing < 0.0) + { + float light6invdist = inversesqrt(light6dist2); + + float light6atten = light6facing * (1.0 - light6invdist); + + + + vec3 shadow6tc = getshadowtc(light6dir, shadowparams[6], shadowoffset[6], distbias * lightpos[6].w); + light6atten *= filtershadow(shadow6tc); + + + + + float light6spec = pow(clamp(light6invdist*(dot(camdir, light6dir) - light6facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light6spec) * lightcolor[6] * light6atten; + + + + } + } + + vec3 light7dir = pos.xyz * lightpos[7].w - lightpos[7].xyz; + float light7dist2 = dot(light7dir, light7dir); + if(light7dist2 < 1.0) + { + + float light7facing = dot(light7dir, normal.xyz); + if(light7facing < 0.0) + { + float light7invdist = inversesqrt(light7dist2); + + float light7atten = light7facing * (1.0 - light7invdist); + + + + vec3 shadow7tc = getshadowtc(light7dir, shadowparams[7], shadowoffset[7], distbias * lightpos[7].w); + light7atten *= filtershadow(shadow7tc); + + + + + float light7spec = pow(clamp(light7invdist*(dot(camdir, light7dir) - light7facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light7spec) * lightcolor[7] * light7atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/437.shader_test b/shaders/tesseract/437.shader_test new file mode 100644 index 0000000..d327464 --- /dev/null +++ b/shaders/tesseract/437.shader_test @@ -0,0 +1,326 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 , tex2; + + + + uniform vec4 lightpos[8]; + uniform vec3 lightcolor[8]; + + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define alpha normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + vec3 light2dir = pos.xyz * lightpos[2].w - lightpos[2].xyz; + float light2dist2 = dot(light2dir, light2dir); + if(light2dist2 < 1.0) + { + + float light2facing = dot(light2dir, normal.xyz); + if(light2facing < 0.0) + { + float light2invdist = inversesqrt(light2dist2); + + float light2atten = light2facing * (1.0 - light2invdist); + + + + + + + float light2spec = pow(clamp(light2invdist*(dot(camdir, light2dir) - light2facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light2spec) * lightcolor[2] * light2atten; + + + + } + } + + vec3 light3dir = pos.xyz * lightpos[3].w - lightpos[3].xyz; + float light3dist2 = dot(light3dir, light3dir); + if(light3dist2 < 1.0) + { + + float light3facing = dot(light3dir, normal.xyz); + if(light3facing < 0.0) + { + float light3invdist = inversesqrt(light3dist2); + + float light3atten = light3facing * (1.0 - light3invdist); + + + + + + + float light3spec = pow(clamp(light3invdist*(dot(camdir, light3dir) - light3facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light3spec) * lightcolor[3] * light3atten; + + + + } + } + + vec3 light4dir = pos.xyz * lightpos[4].w - lightpos[4].xyz; + float light4dist2 = dot(light4dir, light4dir); + if(light4dist2 < 1.0) + { + + float light4facing = dot(light4dir, normal.xyz); + if(light4facing < 0.0) + { + float light4invdist = inversesqrt(light4dist2); + + float light4atten = light4facing * (1.0 - light4invdist); + + + + + + + float light4spec = pow(clamp(light4invdist*(dot(camdir, light4dir) - light4facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light4spec) * lightcolor[4] * light4atten; + + + + } + } + + vec3 light5dir = pos.xyz * lightpos[5].w - lightpos[5].xyz; + float light5dist2 = dot(light5dir, light5dir); + if(light5dist2 < 1.0) + { + + float light5facing = dot(light5dir, normal.xyz); + if(light5facing < 0.0) + { + float light5invdist = inversesqrt(light5dist2); + + float light5atten = light5facing * (1.0 - light5invdist); + + + + + + + float light5spec = pow(clamp(light5invdist*(dot(camdir, light5dir) - light5facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light5spec) * lightcolor[5] * light5atten; + + + + } + } + + vec3 light6dir = pos.xyz * lightpos[6].w - lightpos[6].xyz; + float light6dist2 = dot(light6dir, light6dir); + if(light6dist2 < 1.0) + { + + float light6facing = dot(light6dir, normal.xyz); + if(light6facing < 0.0) + { + float light6invdist = inversesqrt(light6dist2); + + float light6atten = light6facing * (1.0 - light6invdist); + + + + + + + float light6spec = pow(clamp(light6invdist*(dot(camdir, light6dir) - light6facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light6spec) * lightcolor[6] * light6atten; + + + + } + } + + vec3 light7dir = pos.xyz * lightpos[7].w - lightpos[7].xyz; + float light7dist2 = dot(light7dir, light7dir); + if(light7dist2 < 1.0) + { + + float light7facing = dot(light7dir, normal.xyz); + if(light7facing < 0.0) + { + float light7invdist = inversesqrt(light7dist2); + + float light7atten = light7facing * (1.0 - light7invdist); + + + + + + + float light7spec = pow(clamp(light7invdist*(dot(camdir, light7dir) - light7facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light7spec) * lightcolor[7] * light7atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/439.shader_test b/shaders/tesseract/439.shader_test new file mode 100644 index 0000000..8579f8e --- /dev/null +++ b/shaders/tesseract/439.shader_test @@ -0,0 +1,389 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 , tex2; + + + uniform sampler2DRectShadow tex4; + + + uniform vec4 lightpos[8]; + uniform vec3 lightcolor[8]; + + + uniform vec4 shadowparams[8]; + uniform vec2 shadowoffset[8]; + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + vec3 getshadowtc(vec3 dir, vec4 shadowparams, vec2 shadowoffset, float distbias) + { + vec3 adir = abs(dir); + float m = max(adir.x, adir.y), mz = max(adir.z, m); + vec2 mparams = shadowparams.xy / max(mz + distbias, 1e-5); + vec4 proj; + if(adir.x > adir.y) proj = vec4(dir.zyx, 0.0); else proj = vec4(dir.xzy, 1.0); + if(adir.z > m) proj = vec4(dir, 2.0); + return vec3(proj.xy * mparams.x + vec2(proj.w, step(proj.z, 0.0)) * shadowparams.z + shadowoffset, mparams.y + shadowparams.w); + } + + + + #define shadowval(center, xoff, yoff) float(shadow2DRect(tex4, center + vec3(xoff, yoff, 0.0))) + float filtershadow(vec3 shadowtc) + { + vec2 offset = fract(shadowtc.xy - 0.5); + vec3 center = shadowtc; + + + + + + + + center.xy -= offset*0.5; + vec4 size = vec4(offset + 1.0, 2.0 - offset); + return (1.0/9.0)*dot(size.zxzx*size.wwyy, + vec4(shadowval(center, -0.5, -0.5), + shadowval(center, 1.0, -0.5), + shadowval(center, -0.5, 1.0), + shadowval(center, 1.0, 1.0))); + } + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define alpha normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + #define distbias 0.0 + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + vec3 shadow0tc = getshadowtc(light0dir, shadowparams[0], shadowoffset[0], distbias * lightpos[0].w); + light0atten *= filtershadow(shadow0tc); + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + vec3 shadow1tc = getshadowtc(light1dir, shadowparams[1], shadowoffset[1], distbias * lightpos[1].w); + light1atten *= filtershadow(shadow1tc); + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + vec3 light2dir = pos.xyz * lightpos[2].w - lightpos[2].xyz; + float light2dist2 = dot(light2dir, light2dir); + if(light2dist2 < 1.0) + { + + float light2facing = dot(light2dir, normal.xyz); + if(light2facing < 0.0) + { + float light2invdist = inversesqrt(light2dist2); + + float light2atten = light2facing * (1.0 - light2invdist); + + + + vec3 shadow2tc = getshadowtc(light2dir, shadowparams[2], shadowoffset[2], distbias * lightpos[2].w); + light2atten *= filtershadow(shadow2tc); + + + + + float light2spec = pow(clamp(light2invdist*(dot(camdir, light2dir) - light2facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light2spec) * lightcolor[2] * light2atten; + + + + } + } + + vec3 light3dir = pos.xyz * lightpos[3].w - lightpos[3].xyz; + float light3dist2 = dot(light3dir, light3dir); + if(light3dist2 < 1.0) + { + + float light3facing = dot(light3dir, normal.xyz); + if(light3facing < 0.0) + { + float light3invdist = inversesqrt(light3dist2); + + float light3atten = light3facing * (1.0 - light3invdist); + + + + vec3 shadow3tc = getshadowtc(light3dir, shadowparams[3], shadowoffset[3], distbias * lightpos[3].w); + light3atten *= filtershadow(shadow3tc); + + + + + float light3spec = pow(clamp(light3invdist*(dot(camdir, light3dir) - light3facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light3spec) * lightcolor[3] * light3atten; + + + + } + } + + vec3 light4dir = pos.xyz * lightpos[4].w - lightpos[4].xyz; + float light4dist2 = dot(light4dir, light4dir); + if(light4dist2 < 1.0) + { + + float light4facing = dot(light4dir, normal.xyz); + if(light4facing < 0.0) + { + float light4invdist = inversesqrt(light4dist2); + + float light4atten = light4facing * (1.0 - light4invdist); + + + + vec3 shadow4tc = getshadowtc(light4dir, shadowparams[4], shadowoffset[4], distbias * lightpos[4].w); + light4atten *= filtershadow(shadow4tc); + + + + + float light4spec = pow(clamp(light4invdist*(dot(camdir, light4dir) - light4facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light4spec) * lightcolor[4] * light4atten; + + + + } + } + + vec3 light5dir = pos.xyz * lightpos[5].w - lightpos[5].xyz; + float light5dist2 = dot(light5dir, light5dir); + if(light5dist2 < 1.0) + { + + float light5facing = dot(light5dir, normal.xyz); + if(light5facing < 0.0) + { + float light5invdist = inversesqrt(light5dist2); + + float light5atten = light5facing * (1.0 - light5invdist); + + + + vec3 shadow5tc = getshadowtc(light5dir, shadowparams[5], shadowoffset[5], distbias * lightpos[5].w); + light5atten *= filtershadow(shadow5tc); + + + + + float light5spec = pow(clamp(light5invdist*(dot(camdir, light5dir) - light5facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light5spec) * lightcolor[5] * light5atten; + + + + } + } + + vec3 light6dir = pos.xyz * lightpos[6].w - lightpos[6].xyz; + float light6dist2 = dot(light6dir, light6dir); + if(light6dist2 < 1.0) + { + + float light6facing = dot(light6dir, normal.xyz); + if(light6facing < 0.0) + { + float light6invdist = inversesqrt(light6dist2); + + float light6atten = light6facing * (1.0 - light6invdist); + + + + vec3 shadow6tc = getshadowtc(light6dir, shadowparams[6], shadowoffset[6], distbias * lightpos[6].w); + light6atten *= filtershadow(shadow6tc); + + + + + float light6spec = pow(clamp(light6invdist*(dot(camdir, light6dir) - light6facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light6spec) * lightcolor[6] * light6atten; + + + + } + } + + vec3 light7dir = pos.xyz * lightpos[7].w - lightpos[7].xyz; + float light7dist2 = dot(light7dir, light7dir); + if(light7dist2 < 1.0) + { + + float light7facing = dot(light7dir, normal.xyz); + if(light7facing < 0.0) + { + float light7invdist = inversesqrt(light7dist2); + + float light7atten = light7facing * (1.0 - light7invdist); + + + + vec3 shadow7tc = getshadowtc(light7dir, shadowparams[7], shadowoffset[7], distbias * lightpos[7].w); + light7atten *= filtershadow(shadow7tc); + + + + + float light7spec = pow(clamp(light7invdist*(dot(camdir, light7dir) - light7facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light7spec) * lightcolor[7] * light7atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/441.shader_test b/shaders/tesseract/441.shader_test new file mode 100644 index 0000000..325599a --- /dev/null +++ b/shaders/tesseract/441.shader_test @@ -0,0 +1,329 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 ; + + + + uniform vec4 lightpos[8]; + uniform vec3 lightcolor[8]; + + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + #define alpha 1.0 + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define glowscale normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + diffuse.rgb *= glowscale; + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + vec3 light2dir = pos.xyz * lightpos[2].w - lightpos[2].xyz; + float light2dist2 = dot(light2dir, light2dir); + if(light2dist2 < 1.0) + { + + float light2facing = dot(light2dir, normal.xyz); + if(light2facing < 0.0) + { + float light2invdist = inversesqrt(light2dist2); + + float light2atten = light2facing * (1.0 - light2invdist); + + + + + + + float light2spec = pow(clamp(light2invdist*(dot(camdir, light2dir) - light2facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light2spec) * lightcolor[2] * light2atten; + + + + } + } + + vec3 light3dir = pos.xyz * lightpos[3].w - lightpos[3].xyz; + float light3dist2 = dot(light3dir, light3dir); + if(light3dist2 < 1.0) + { + + float light3facing = dot(light3dir, normal.xyz); + if(light3facing < 0.0) + { + float light3invdist = inversesqrt(light3dist2); + + float light3atten = light3facing * (1.0 - light3invdist); + + + + + + + float light3spec = pow(clamp(light3invdist*(dot(camdir, light3dir) - light3facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light3spec) * lightcolor[3] * light3atten; + + + + } + } + + vec3 light4dir = pos.xyz * lightpos[4].w - lightpos[4].xyz; + float light4dist2 = dot(light4dir, light4dir); + if(light4dist2 < 1.0) + { + + float light4facing = dot(light4dir, normal.xyz); + if(light4facing < 0.0) + { + float light4invdist = inversesqrt(light4dist2); + + float light4atten = light4facing * (1.0 - light4invdist); + + + + + + + float light4spec = pow(clamp(light4invdist*(dot(camdir, light4dir) - light4facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light4spec) * lightcolor[4] * light4atten; + + + + } + } + + vec3 light5dir = pos.xyz * lightpos[5].w - lightpos[5].xyz; + float light5dist2 = dot(light5dir, light5dir); + if(light5dist2 < 1.0) + { + + float light5facing = dot(light5dir, normal.xyz); + if(light5facing < 0.0) + { + float light5invdist = inversesqrt(light5dist2); + + float light5atten = light5facing * (1.0 - light5invdist); + + + + + + + float light5spec = pow(clamp(light5invdist*(dot(camdir, light5dir) - light5facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light5spec) * lightcolor[5] * light5atten; + + + + } + } + + vec3 light6dir = pos.xyz * lightpos[6].w - lightpos[6].xyz; + float light6dist2 = dot(light6dir, light6dir); + if(light6dist2 < 1.0) + { + + float light6facing = dot(light6dir, normal.xyz); + if(light6facing < 0.0) + { + float light6invdist = inversesqrt(light6dist2); + + float light6atten = light6facing * (1.0 - light6invdist); + + + + + + + float light6spec = pow(clamp(light6invdist*(dot(camdir, light6dir) - light6facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light6spec) * lightcolor[6] * light6atten; + + + + } + } + + vec3 light7dir = pos.xyz * lightpos[7].w - lightpos[7].xyz; + float light7dist2 = dot(light7dir, light7dir); + if(light7dist2 < 1.0) + { + + float light7facing = dot(light7dir, normal.xyz); + if(light7facing < 0.0) + { + float light7invdist = inversesqrt(light7dist2); + + float light7atten = light7facing * (1.0 - light7invdist); + + + + + + + float light7spec = pow(clamp(light7invdist*(dot(camdir, light7dir) - light7facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light7spec) * lightcolor[7] * light7atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/443.shader_test b/shaders/tesseract/443.shader_test new file mode 100644 index 0000000..8d1e01e --- /dev/null +++ b/shaders/tesseract/443.shader_test @@ -0,0 +1,392 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 lightmatrix; + void main(void) + { + gl_Position = lightmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0, tex1, tex3 ; + + + uniform sampler2DRectShadow tex4; + + + uniform vec4 lightpos[8]; + uniform vec3 lightcolor[8]; + + + uniform vec4 shadowparams[8]; + uniform vec2 shadowoffset[8]; + + + + uniform vec3 splitcenter[3]; + uniform vec3 splitbounds[3]; + uniform vec3 splitscale[3]; + uniform vec3 splitoffset[3]; + + + uniform vec3 camera; + uniform mat4 worldmatrix; + uniform vec4 fogdir; + uniform vec3 fogcolor; + uniform vec2 fogdensity; + uniform vec4 radialfogscale; + uniform vec2 shadowatlasscale; + uniform vec4 lightscale; + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + fragdata(0, fragcolor, vec4) + + + vec3 getshadowtc(vec3 dir, vec4 shadowparams, vec2 shadowoffset, float distbias) + { + vec3 adir = abs(dir); + float m = max(adir.x, adir.y), mz = max(adir.z, m); + vec2 mparams = shadowparams.xy / max(mz + distbias, 1e-5); + vec4 proj; + if(adir.x > adir.y) proj = vec4(dir.zyx, 0.0); else proj = vec4(dir.xzy, 1.0); + if(adir.z > m) proj = vec4(dir, 2.0); + return vec3(proj.xy * mparams.x + vec2(proj.w, step(proj.z, 0.0)) * shadowparams.z + shadowoffset, mparams.y + shadowparams.w); + } + + + + #define shadowval(center, xoff, yoff) float(shadow2DRect(tex4, center + vec3(xoff, yoff, 0.0))) + float filtershadow(vec3 shadowtc) + { + vec2 offset = fract(shadowtc.xy - 0.5); + vec3 center = shadowtc; + + + + + + + + center.xy -= offset*0.5; + vec4 size = vec4(offset + 1.0, 2.0 - offset); + return (1.0/9.0)*dot(size.zxzx*size.wwyy, + vec4(shadowval(center, -0.5, -0.5), + shadowval(center, 1.0, -0.5), + shadowval(center, -0.5, 1.0), + shadowval(center, 1.0, 1.0))); + } + + + + + void main(void) + { + + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + + #define accumlight(light) fragcolor.rgb = light + #define accumalpha(alpha) fragcolor.a = alpha + + + + vec4 normal = gfetch(tex1, gl_FragCoord.xy); + + + + #define alpha 1.0 + + + normal.xyz = normal.xyz*2.0 - 1.0; + + #define glowscale normal.a + + + vec4 diffuse = gfetch(tex0, gl_FragCoord.xy); + + diffuse.rgb *= glowscale; + + + + + + #define depthvals gfetch(tex3, gl_FragCoord.xy) + + + float depth = depthvals.r; + + vec4 pos = worldmatrix * vec4(gl_FragCoord.xy, depth, 1.0); + pos.xyz /= pos.w; + + + + float fogcoord = length(camera - pos.xyz); + + + + #define distbias -8.0 + + vec3 camdir = normalize(camera - pos.xyz); + float facing = 2.0*dot(normal.xyz, camdir); + + + + + + vec3 light = vec3(0.0); + + + + + + vec3 light0dir = pos.xyz * lightpos[0].w - lightpos[0].xyz; + float light0dist2 = dot(light0dir, light0dir); + if(light0dist2 < 1.0) + { + + float light0facing = dot(light0dir, normal.xyz); + if(light0facing < 0.0) + { + float light0invdist = inversesqrt(light0dist2); + + float light0atten = light0facing * (1.0 - light0invdist); + + + + vec3 shadow0tc = getshadowtc(light0dir, shadowparams[0], shadowoffset[0], distbias * lightpos[0].w); + light0atten *= filtershadow(shadow0tc); + + + + + float light0spec = pow(clamp(light0invdist*(dot(camdir, light0dir) - light0facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light0spec) * lightcolor[0] * light0atten; + + + + } + } + + vec3 light1dir = pos.xyz * lightpos[1].w - lightpos[1].xyz; + float light1dist2 = dot(light1dir, light1dir); + if(light1dist2 < 1.0) + { + + float light1facing = dot(light1dir, normal.xyz); + if(light1facing < 0.0) + { + float light1invdist = inversesqrt(light1dist2); + + float light1atten = light1facing * (1.0 - light1invdist); + + + + vec3 shadow1tc = getshadowtc(light1dir, shadowparams[1], shadowoffset[1], distbias * lightpos[1].w); + light1atten *= filtershadow(shadow1tc); + + + + + float light1spec = pow(clamp(light1invdist*(dot(camdir, light1dir) - light1facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light1spec) * lightcolor[1] * light1atten; + + + + } + } + + vec3 light2dir = pos.xyz * lightpos[2].w - lightpos[2].xyz; + float light2dist2 = dot(light2dir, light2dir); + if(light2dist2 < 1.0) + { + + float light2facing = dot(light2dir, normal.xyz); + if(light2facing < 0.0) + { + float light2invdist = inversesqrt(light2dist2); + + float light2atten = light2facing * (1.0 - light2invdist); + + + + vec3 shadow2tc = getshadowtc(light2dir, shadowparams[2], shadowoffset[2], distbias * lightpos[2].w); + light2atten *= filtershadow(shadow2tc); + + + + + float light2spec = pow(clamp(light2invdist*(dot(camdir, light2dir) - light2facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light2spec) * lightcolor[2] * light2atten; + + + + } + } + + vec3 light3dir = pos.xyz * lightpos[3].w - lightpos[3].xyz; + float light3dist2 = dot(light3dir, light3dir); + if(light3dist2 < 1.0) + { + + float light3facing = dot(light3dir, normal.xyz); + if(light3facing < 0.0) + { + float light3invdist = inversesqrt(light3dist2); + + float light3atten = light3facing * (1.0 - light3invdist); + + + + vec3 shadow3tc = getshadowtc(light3dir, shadowparams[3], shadowoffset[3], distbias * lightpos[3].w); + light3atten *= filtershadow(shadow3tc); + + + + + float light3spec = pow(clamp(light3invdist*(dot(camdir, light3dir) - light3facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light3spec) * lightcolor[3] * light3atten; + + + + } + } + + vec3 light4dir = pos.xyz * lightpos[4].w - lightpos[4].xyz; + float light4dist2 = dot(light4dir, light4dir); + if(light4dist2 < 1.0) + { + + float light4facing = dot(light4dir, normal.xyz); + if(light4facing < 0.0) + { + float light4invdist = inversesqrt(light4dist2); + + float light4atten = light4facing * (1.0 - light4invdist); + + + + vec3 shadow4tc = getshadowtc(light4dir, shadowparams[4], shadowoffset[4], distbias * lightpos[4].w); + light4atten *= filtershadow(shadow4tc); + + + + + float light4spec = pow(clamp(light4invdist*(dot(camdir, light4dir) - light4facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light4spec) * lightcolor[4] * light4atten; + + + + } + } + + vec3 light5dir = pos.xyz * lightpos[5].w - lightpos[5].xyz; + float light5dist2 = dot(light5dir, light5dir); + if(light5dist2 < 1.0) + { + + float light5facing = dot(light5dir, normal.xyz); + if(light5facing < 0.0) + { + float light5invdist = inversesqrt(light5dist2); + + float light5atten = light5facing * (1.0 - light5invdist); + + + + vec3 shadow5tc = getshadowtc(light5dir, shadowparams[5], shadowoffset[5], distbias * lightpos[5].w); + light5atten *= filtershadow(shadow5tc); + + + + + float light5spec = pow(clamp(light5invdist*(dot(camdir, light5dir) - light5facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light5spec) * lightcolor[5] * light5atten; + + + + } + } + + vec3 light6dir = pos.xyz * lightpos[6].w - lightpos[6].xyz; + float light6dist2 = dot(light6dir, light6dir); + if(light6dist2 < 1.0) + { + + float light6facing = dot(light6dir, normal.xyz); + if(light6facing < 0.0) + { + float light6invdist = inversesqrt(light6dist2); + + float light6atten = light6facing * (1.0 - light6invdist); + + + + vec3 shadow6tc = getshadowtc(light6dir, shadowparams[6], shadowoffset[6], distbias * lightpos[6].w); + light6atten *= filtershadow(shadow6tc); + + + + + float light6spec = pow(clamp(light6invdist*(dot(camdir, light6dir) - light6facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light6spec) * lightcolor[6] * light6atten; + + + + } + } + + vec3 light7dir = pos.xyz * lightpos[7].w - lightpos[7].xyz; + float light7dist2 = dot(light7dir, light7dir); + if(light7dist2 < 1.0) + { + + float light7facing = dot(light7dir, normal.xyz); + if(light7facing < 0.0) + { + float light7invdist = inversesqrt(light7dist2); + + float light7atten = light7facing * (1.0 - light7invdist); + + + + vec3 shadow7tc = getshadowtc(light7dir, shadowparams[7], shadowoffset[7], distbias * lightpos[7].w); + light7atten *= filtershadow(shadow7tc); + + + + + float light7spec = pow(clamp(light7invdist*(dot(camdir, light7dir) - light7facing*facing), 0.0, 1.0), 16.0) * diffuse.a; + light += (diffuse.rgb + light7spec) * lightcolor[7] * light7atten; + + + + } + } + + + float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0); + + accumlight(light*foglerp); + accumalpha(0.0); + + + + + } + diff --git a/shaders/tesseract/446.shader_test b/shaders/tesseract/446.shader_test new file mode 100644 index 0000000..8184517 --- /dev/null +++ b/shaders/tesseract/446.shader_test @@ -0,0 +1,140 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec3 vnormal; + attribute vec2 vtexcoord0; + uniform mat4 camprojmatrix; + uniform vec2 texgenscroll; + + + varying vec2 texcoord0; + varying mat3 world; + + + uniform vec3 camera; + varying vec3 camvec; + + + + + +uniform vec4 specscale; + +uniform vec4 envscale; + void main(void) + { + gl_Position = camprojmatrix * vvertex; + + + + + texcoord0 = vtexcoord0 + texgenscroll; + + vec3 bitangent = cross(vnormal, vtangent.xyz) * vtangent.w; + + world = mat3(vtangent.xyz, bitangent, vnormal); + + + + camvec = camera - vvertex.xyz; + + + + + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +uniform vec4 colorparams; + uniform sampler2D diffusemap, normalmap; + + varying mat3 world; + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + + varying vec2 texcoord0; + + varying vec3 camvec; + + + uniform samplerCube envmap; + + + +uniform vec4 specscale; + +uniform vec4 envscale; + void main(void) + { + + vec3 camvecn = normalize(camvec); + + + + + #define dtc texcoord0 + + + vec4 diffuse = texture2D(diffusemap, dtc); + + vec3 bump = texture2D(normalmap, dtc).rgb*2.0 - 1.0; + vec3 bumpw = normalize(world * bump); + + + gcolor.rgb = diffuse.rgb*colorparams.rgb; + + gcolor.a = diffuse.a*specscale.x * 0.5; + + + + float invfresnel = dot(camvecn, bumpw); + vec3 rvec = 2.0*bumpw*invfresnel - camvecn; + vec3 reflect = textureCube(envmap, rvec).rgb; + + vec3 rmod = envscale.xyz*diffuse.a; + + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*clamp(1.0 - invfresnel, 0.0, 1.0)); + + + + + + + + gnormal.rgb = bumpw*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + + + } + diff --git a/shaders/tesseract/449.shader_test b/shaders/tesseract/449.shader_test new file mode 100644 index 0000000..057b2a0 --- /dev/null +++ b/shaders/tesseract/449.shader_test @@ -0,0 +1,154 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec3 vnormal; + attribute vec2 vtexcoord0; + uniform mat4 camprojmatrix; + uniform vec2 texgenscroll; + + + varying vec2 texcoord0; + varying mat3 world; + + + uniform vec3 camera; + varying vec3 camvec; + + + + uniform vec4 blendmapparams; + varying vec2 texcoord1; + + + +uniform vec4 specscale; + +uniform vec4 envscale; + void main(void) + { + gl_Position = camprojmatrix * vvertex; + + + + + texcoord0 = vtexcoord0 + texgenscroll; + + vec3 bitangent = cross(vnormal, vtangent.xyz) * vtangent.w; + + world = mat3(vtangent.xyz, bitangent, vnormal); + + + + camvec = camera - vvertex.xyz; + + + + texcoord1 = (vvertex.xy - blendmapparams.xy)*blendmapparams.zw; + + + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +uniform vec4 colorparams; + uniform sampler2D diffusemap, normalmap; + + varying mat3 world; + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + + varying vec2 texcoord0; + + varying vec3 camvec; + + + uniform samplerCube envmap; + + uniform float blendlayer; + uniform sampler2D blendmap; + varying vec2 texcoord1; + + + +uniform vec4 specscale; + +uniform vec4 envscale; + void main(void) + { + + vec3 camvecn = normalize(camvec); + + + + + #define dtc texcoord0 + + + vec4 diffuse = texture2D(diffusemap, dtc); + + vec3 bump = texture2D(normalmap, dtc).rgb*2.0 - 1.0; + vec3 bumpw = normalize(world * bump); + + + gcolor.rgb = diffuse.rgb*colorparams.rgb; + + gcolor.a = diffuse.a*specscale.x * 0.5; + + + + float invfresnel = dot(camvecn, bumpw); + vec3 rvec = 2.0*bumpw*invfresnel - camvecn; + vec3 reflect = textureCube(envmap, rvec).rgb; + + vec3 rmod = envscale.xyz*diffuse.a; + + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*clamp(1.0 - invfresnel, 0.0, 1.0)); + + + + + + + + gnormal.rgb = bumpw*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + + + float blend = abs(texture2D(blendmap, texcoord1).r - blendlayer); + gcolor *= blend; + gnormal.rgb *= blend; + gnormal.a *= blendlayer; + + } + diff --git a/shaders/tesseract/45.shader_test b/shaders/tesseract/45.shader_test new file mode 100644 index 0000000..22a77d1 --- /dev/null +++ b/shaders/tesseract/45.shader_test @@ -0,0 +1,33 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vcolor; + uniform mat4 hudmatrix; + varying vec4 color; + void main(void) + { + gl_Position = hudmatrix * vvertex; + color = vcolor; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +varying vec4 color; + fragdata(0, fragcolor, vec4) + void main(void) + { + fragcolor = color; + } + diff --git a/shaders/tesseract/452.shader_test b/shaders/tesseract/452.shader_test new file mode 100644 index 0000000..3de476e --- /dev/null +++ b/shaders/tesseract/452.shader_test @@ -0,0 +1,144 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec3 vnormal; + attribute vec2 vtexcoord0; + uniform mat4 camprojmatrix; + uniform vec2 texgenscroll; + + + varying vec2 texcoord0; + varying mat3 world; + + + uniform vec3 camera; + varying vec3 camvec; + + + + + +uniform vec4 specscale; + +uniform vec4 envscale; + void main(void) + { + gl_Position = camprojmatrix * vvertex; + + + + + texcoord0 = vtexcoord0 + texgenscroll; + + vec3 bitangent = cross(vnormal, vtangent.xyz) * vtangent.w; + + world = mat3(vtangent.xyz, bitangent, vnormal); + + + + camvec = camera - vvertex.xyz; + + + + + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +uniform vec4 colorparams; + uniform sampler2D diffusemap, normalmap; + + varying mat3 world; + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + + varying vec2 texcoord0; + + varying vec3 camvec; + + + uniform samplerCube envmap; + + + +uniform vec4 specscale; + +uniform vec4 envscale; + void main(void) + { + + vec3 camvecn = normalize(camvec); + + + + + #define dtc texcoord0 + + + vec4 diffuse = texture2D(diffusemap, dtc); + + vec3 bump = texture2D(normalmap, dtc).rgb*2.0 - 1.0; + vec3 bumpw = normalize(world * bump); + + + gcolor.rgb = diffuse.rgb*colorparams.rgb; + + gcolor.a = diffuse.a*specscale.x * 0.5; + + + + float invfresnel = dot(camvecn, bumpw); + vec3 rvec = 2.0*bumpw*invfresnel - camvecn; + vec3 reflect = textureCube(envmap, rvec).rgb; + + vec3 rmod = envscale.xyz*diffuse.a; + + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*clamp(1.0 - invfresnel, 0.0, 1.0)); + + + + gglow.rgb = vec3(0.0); + + + + #define packnorm colorparams.a + + + + gnormal.rgb = bumpw*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + + + } + diff --git a/shaders/tesseract/455.shader_test b/shaders/tesseract/455.shader_test new file mode 100644 index 0000000..a21edbd --- /dev/null +++ b/shaders/tesseract/455.shader_test @@ -0,0 +1,170 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec3 vnormal; + attribute vec2 vtexcoord0; + uniform mat4 camprojmatrix; + uniform vec2 texgenscroll; + + uniform vec2 lineardepthscale; + uniform vec3 gdepthpackparams; + varying float lineardepth; + + + varying vec2 texcoord0; + varying mat3 world; + + + uniform vec3 camera; + varying vec3 camvec; + + + + + +uniform vec4 specscale; + +uniform vec4 envscale; + void main(void) + { + gl_Position = camprojmatrix * vvertex; + + + lineardepth = dot(lineardepthscale, gl_Position.zw); + + + + texcoord0 = vtexcoord0 + texgenscroll; + + vec3 bitangent = cross(vnormal, vtangent.xyz) * vtangent.w; + + world = mat3(vtangent.xyz, bitangent, vnormal); + + + + camvec = camera - vvertex.xyz; + + + + + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +uniform sampler2DRect refractlight, refractmask; + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + #define gfetchoffset(sampler, coords, offset) texture2DRectOffset(sampler, coords, offset) + #define gfetchproj(sampler, coords) texture2DRectProj(sampler, coords) + #define gfetchclamp(sampler, coords) texture2DRect(sampler, coords) + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + + uniform vec4 refractparams; + uniform float refractdepth; + + uniform vec4 colorparams; + uniform sampler2D diffusemap, normalmap; + + varying mat3 world; + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + uniform vec2 lineardepthscale; + uniform vec3 gdepthpackparams; + varying float lineardepth; + + + + varying vec2 texcoord0; + + varying vec3 camvec; + + + uniform samplerCube envmap; + + + +uniform vec4 specscale; + +uniform vec4 envscale; + void main(void) + { + + vec3 camvecn = normalize(camvec); + + + + + #define dtc texcoord0 + + + vec4 diffuse = texture2D(diffusemap, dtc); + + vec3 bump = texture2D(normalmap, dtc).rgb*2.0 - 1.0; + vec3 bumpw = normalize(world * bump); + + + gcolor.rgb = diffuse.rgb*colorparams.rgb; + + gcolor.a = diffuse.a*specscale.x * 0.5; + + + + float invfresnel = dot(camvecn, bumpw); + vec3 rvec = 2.0*bumpw*invfresnel - camvecn; + vec3 reflect = textureCube(envmap, rvec).rgb; + + vec3 rmod = envscale.xyz*diffuse.a; + + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*clamp(1.0 - invfresnel, 0.0, 1.0)); + + + + gglow.rgb = vec3(0.0); + + + + vec2 rtc = bump.xy*refractparams.w; + float rmask = clamp(refractdepth*(lineardepth - dot(gfetch(refractmask, gl_FragCoord.xy + rtc).rgb, gdepthunpackparams)), 0.0, 1.0); + vec3 rlight = gfetch(refractlight, gl_FragCoord.xy + rtc*rmask).rgb; + gglow.rgb += rlight * refractparams.xyz; + + + + gnormal.rgb = bumpw*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + + + } + diff --git a/shaders/tesseract/458.shader_test b/shaders/tesseract/458.shader_test new file mode 100644 index 0000000..a5b6b96 --- /dev/null +++ b/shaders/tesseract/458.shader_test @@ -0,0 +1,121 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec3 vnormal; + attribute vec2 vtexcoord0; + uniform mat4 camprojmatrix; + uniform vec2 texgenscroll; + + + varying vec2 texcoord0; + varying mat3 world; + + + + + + +uniform vec4 specscale; + void main(void) + { + gl_Position = camprojmatrix * vvertex; + + + + + texcoord0 = vtexcoord0 + texgenscroll; + + vec3 bitangent = cross(vnormal, vtangent.xyz) * vtangent.w; + + world = mat3(vtangent.xyz, bitangent, vnormal); + + + + + + + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +uniform vec4 colorparams; + uniform sampler2D diffusemap, normalmap; + + varying mat3 world; + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + + varying vec2 texcoord0; + + + + + + + + +uniform vec4 specscale; + void main(void) + { + + + + + #define dtc texcoord0 + + + vec4 diffuse = texture2D(diffusemap, dtc); + + vec3 bump = texture2D(normalmap, dtc).rgb*2.0 - 1.0; + vec3 bumpw = normalize(world * bump); + + + gcolor.rgb = diffuse.rgb*colorparams.rgb; + + gcolor.a = diffuse.a*specscale.x * 0.5; + + + + + + + + + + gnormal.rgb = bumpw*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + + + } + diff --git a/shaders/tesseract/461.shader_test b/shaders/tesseract/461.shader_test new file mode 100644 index 0000000..09c8920 --- /dev/null +++ b/shaders/tesseract/461.shader_test @@ -0,0 +1,135 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec3 vnormal; + attribute vec2 vtexcoord0; + uniform mat4 camprojmatrix; + uniform vec2 texgenscroll; + + + varying vec2 texcoord0; + varying mat3 world; + + + + + uniform vec4 blendmapparams; + varying vec2 texcoord1; + + + +uniform vec4 specscale; + void main(void) + { + gl_Position = camprojmatrix * vvertex; + + + + + texcoord0 = vtexcoord0 + texgenscroll; + + vec3 bitangent = cross(vnormal, vtangent.xyz) * vtangent.w; + + world = mat3(vtangent.xyz, bitangent, vnormal); + + + + + + texcoord1 = (vvertex.xy - blendmapparams.xy)*blendmapparams.zw; + + + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +uniform vec4 colorparams; + uniform sampler2D diffusemap, normalmap; + + varying mat3 world; + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + + varying vec2 texcoord0; + + + + + + + uniform float blendlayer; + uniform sampler2D blendmap; + varying vec2 texcoord1; + + + +uniform vec4 specscale; + void main(void) + { + + + + + #define dtc texcoord0 + + + vec4 diffuse = texture2D(diffusemap, dtc); + + vec3 bump = texture2D(normalmap, dtc).rgb*2.0 - 1.0; + vec3 bumpw = normalize(world * bump); + + + gcolor.rgb = diffuse.rgb*colorparams.rgb; + + gcolor.a = diffuse.a*specscale.x * 0.5; + + + + + + + + + + gnormal.rgb = bumpw*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + + + float blend = abs(texture2D(blendmap, texcoord1).r - blendlayer); + gcolor *= blend; + gnormal.rgb *= blend; + gnormal.a *= blendlayer; + + } + diff --git a/shaders/tesseract/464.shader_test b/shaders/tesseract/464.shader_test new file mode 100644 index 0000000..05ad5c6 --- /dev/null +++ b/shaders/tesseract/464.shader_test @@ -0,0 +1,125 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec3 vnormal; + attribute vec2 vtexcoord0; + uniform mat4 camprojmatrix; + uniform vec2 texgenscroll; + + + varying vec2 texcoord0; + varying mat3 world; + + + + + + +uniform vec4 specscale; + void main(void) + { + gl_Position = camprojmatrix * vvertex; + + + + + texcoord0 = vtexcoord0 + texgenscroll; + + vec3 bitangent = cross(vnormal, vtangent.xyz) * vtangent.w; + + world = mat3(vtangent.xyz, bitangent, vnormal); + + + + + + + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +uniform vec4 colorparams; + uniform sampler2D diffusemap, normalmap; + + varying mat3 world; + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + + varying vec2 texcoord0; + + + + + + + + +uniform vec4 specscale; + void main(void) + { + + + + + #define dtc texcoord0 + + + vec4 diffuse = texture2D(diffusemap, dtc); + + vec3 bump = texture2D(normalmap, dtc).rgb*2.0 - 1.0; + vec3 bumpw = normalize(world * bump); + + + gcolor.rgb = diffuse.rgb*colorparams.rgb; + + gcolor.a = diffuse.a*specscale.x * 0.5; + + + + + + gglow.rgb = vec3(0.0); + + + + #define packnorm colorparams.a + + + + gnormal.rgb = bumpw*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + + + } + diff --git a/shaders/tesseract/467.shader_test b/shaders/tesseract/467.shader_test new file mode 100644 index 0000000..1fe5708 --- /dev/null +++ b/shaders/tesseract/467.shader_test @@ -0,0 +1,151 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec3 vnormal; + attribute vec2 vtexcoord0; + uniform mat4 camprojmatrix; + uniform vec2 texgenscroll; + + uniform vec2 lineardepthscale; + uniform vec3 gdepthpackparams; + varying float lineardepth; + + + varying vec2 texcoord0; + varying mat3 world; + + + + + + +uniform vec4 specscale; + void main(void) + { + gl_Position = camprojmatrix * vvertex; + + + lineardepth = dot(lineardepthscale, gl_Position.zw); + + + + texcoord0 = vtexcoord0 + texgenscroll; + + vec3 bitangent = cross(vnormal, vtangent.xyz) * vtangent.w; + + world = mat3(vtangent.xyz, bitangent, vnormal); + + + + + + + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +uniform sampler2DRect refractlight, refractmask; + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + #define gfetchoffset(sampler, coords, offset) texture2DRectOffset(sampler, coords, offset) + #define gfetchproj(sampler, coords) texture2DRectProj(sampler, coords) + #define gfetchclamp(sampler, coords) texture2DRect(sampler, coords) + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + + uniform vec4 refractparams; + uniform float refractdepth; + + uniform vec4 colorparams; + uniform sampler2D diffusemap, normalmap; + + varying mat3 world; + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + uniform vec2 lineardepthscale; + uniform vec3 gdepthpackparams; + varying float lineardepth; + + + + varying vec2 texcoord0; + + + + + + + + +uniform vec4 specscale; + void main(void) + { + + + + + #define dtc texcoord0 + + + vec4 diffuse = texture2D(diffusemap, dtc); + + vec3 bump = texture2D(normalmap, dtc).rgb*2.0 - 1.0; + vec3 bumpw = normalize(world * bump); + + + gcolor.rgb = diffuse.rgb*colorparams.rgb; + + gcolor.a = diffuse.a*specscale.x * 0.5; + + + + + + gglow.rgb = vec3(0.0); + + + + vec2 rtc = bump.xy*refractparams.w; + float rmask = clamp(refractdepth*(lineardepth - dot(gfetch(refractmask, gl_FragCoord.xy + rtc).rgb, gdepthunpackparams)), 0.0, 1.0); + vec3 rlight = gfetch(refractlight, gl_FragCoord.xy + rtc*rmask).rgb; + gglow.rgb += rlight * refractparams.xyz; + + + + gnormal.rgb = bumpw*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + + + } + diff --git a/shaders/tesseract/470.shader_test b/shaders/tesseract/470.shader_test new file mode 100644 index 0000000..39c9dba --- /dev/null +++ b/shaders/tesseract/470.shader_test @@ -0,0 +1,157 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec3 vnormal; + attribute vec2 vtexcoord0; + uniform mat4 camprojmatrix; + uniform vec2 texgenscroll; + + + varying vec2 texcoord0; + varying mat3 world; + + + uniform vec3 camera; + varying vec3 camvec; + + + + + +uniform vec4 glowcolor; + +uniform vec4 specscale; + +uniform vec4 envscale; + void main(void) + { + gl_Position = camprojmatrix * vvertex; + + + + + texcoord0 = vtexcoord0 + texgenscroll; + + vec3 bitangent = cross(vnormal, vtangent.xyz) * vtangent.w; + + world = mat3(vtangent.xyz, bitangent, vnormal); + + + + camvec = camera - vvertex.xyz; + + + + + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +uniform vec4 colorparams; + uniform sampler2D diffusemap, normalmap; + + varying mat3 world; + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + + varying vec2 texcoord0; + + varying vec3 camvec; + uniform sampler2D glowmap; + + uniform samplerCube envmap; + + + +uniform vec4 glowcolor; + +uniform vec4 specscale; + +uniform vec4 envscale; + void main(void) + { + + vec3 camvecn = normalize(camvec); + + + + + #define dtc texcoord0 + + + vec4 diffuse = texture2D(diffusemap, dtc); + + vec3 bump = texture2D(normalmap, dtc).rgb*2.0 - 1.0; + vec3 bumpw = normalize(world * bump); + + + gcolor.rgb = diffuse.rgb*colorparams.rgb; + + gcolor.a = diffuse.a*specscale.x * 0.5; + + + + float invfresnel = dot(camvecn, bumpw); + vec3 rvec = 2.0*bumpw*invfresnel - camvecn; + vec3 reflect = textureCube(envmap, rvec).rgb; + + vec3 rmod = envscale.xyz*diffuse.a; + + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*clamp(1.0 - invfresnel, 0.0, 1.0)); + + + + + vec3 glow = texture2D(glowmap, dtc).rgb; + + glow *= glowcolor.xyz; + + + float colork = max(gcolor.r, max(gcolor.g, gcolor.b)), glowk = max(glow.r, max(glow.g, glow.b)); + + glowk /= glowk + colork + 1.0e-3; + gcolor.rgb = mix(gcolor.rgb, glow, glowk) * (1.0 - 2.0*glowk*(glowk - 1.0)); + #define packnorm 1.0-glowk + + + + + + + gnormal.rgb = bumpw*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + + + } + diff --git a/shaders/tesseract/473.shader_test b/shaders/tesseract/473.shader_test new file mode 100644 index 0000000..d4e2e90 --- /dev/null +++ b/shaders/tesseract/473.shader_test @@ -0,0 +1,171 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec3 vnormal; + attribute vec2 vtexcoord0; + uniform mat4 camprojmatrix; + uniform vec2 texgenscroll; + + + varying vec2 texcoord0; + varying mat3 world; + + + uniform vec3 camera; + varying vec3 camvec; + + + + uniform vec4 blendmapparams; + varying vec2 texcoord1; + + + +uniform vec4 glowcolor; + +uniform vec4 specscale; + +uniform vec4 envscale; + void main(void) + { + gl_Position = camprojmatrix * vvertex; + + + + + texcoord0 = vtexcoord0 + texgenscroll; + + vec3 bitangent = cross(vnormal, vtangent.xyz) * vtangent.w; + + world = mat3(vtangent.xyz, bitangent, vnormal); + + + + camvec = camera - vvertex.xyz; + + + + texcoord1 = (vvertex.xy - blendmapparams.xy)*blendmapparams.zw; + + + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +uniform vec4 colorparams; + uniform sampler2D diffusemap, normalmap; + + varying mat3 world; + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + + varying vec2 texcoord0; + + varying vec3 camvec; + uniform sampler2D glowmap; + + uniform samplerCube envmap; + + uniform float blendlayer; + uniform sampler2D blendmap; + varying vec2 texcoord1; + + + +uniform vec4 glowcolor; + +uniform vec4 specscale; + +uniform vec4 envscale; + void main(void) + { + + vec3 camvecn = normalize(camvec); + + + + + #define dtc texcoord0 + + + vec4 diffuse = texture2D(diffusemap, dtc); + + vec3 bump = texture2D(normalmap, dtc).rgb*2.0 - 1.0; + vec3 bumpw = normalize(world * bump); + + + gcolor.rgb = diffuse.rgb*colorparams.rgb; + + gcolor.a = diffuse.a*specscale.x * 0.5; + + + + float invfresnel = dot(camvecn, bumpw); + vec3 rvec = 2.0*bumpw*invfresnel - camvecn; + vec3 reflect = textureCube(envmap, rvec).rgb; + + vec3 rmod = envscale.xyz*diffuse.a; + + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*clamp(1.0 - invfresnel, 0.0, 1.0)); + + + + + vec3 glow = texture2D(glowmap, dtc).rgb; + + glow *= glowcolor.xyz; + + + float colork = max(gcolor.r, max(gcolor.g, gcolor.b)), glowk = max(glow.r, max(glow.g, glow.b)); + + glowk /= glowk + colork + 1.0e-3; + gcolor.rgb = mix(gcolor.rgb, glow, glowk) * (1.0 - 2.0*glowk*(glowk - 1.0)); + #define packnorm 1.0-glowk + + + + + + + gnormal.rgb = bumpw*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + + + float blend = abs(texture2D(blendmap, texcoord1).r - blendlayer); + gcolor *= blend; + gnormal.rgb *= blend; + gnormal.a *= blendlayer; + + } + diff --git a/shaders/tesseract/476.shader_test b/shaders/tesseract/476.shader_test new file mode 100644 index 0000000..2593ee6 --- /dev/null +++ b/shaders/tesseract/476.shader_test @@ -0,0 +1,154 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec3 vnormal; + attribute vec2 vtexcoord0; + uniform mat4 camprojmatrix; + uniform vec2 texgenscroll; + + + varying vec2 texcoord0; + varying mat3 world; + + + uniform vec3 camera; + varying vec3 camvec; + + + + + +uniform vec4 glowcolor; + +uniform vec4 specscale; + +uniform vec4 envscale; + void main(void) + { + gl_Position = camprojmatrix * vvertex; + + + + + texcoord0 = vtexcoord0 + texgenscroll; + + vec3 bitangent = cross(vnormal, vtangent.xyz) * vtangent.w; + + world = mat3(vtangent.xyz, bitangent, vnormal); + + + + camvec = camera - vvertex.xyz; + + + + + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +uniform vec4 colorparams; + uniform sampler2D diffusemap, normalmap; + + varying mat3 world; + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + + varying vec2 texcoord0; + + varying vec3 camvec; + uniform sampler2D glowmap; + + uniform samplerCube envmap; + + + +uniform vec4 glowcolor; + +uniform vec4 specscale; + +uniform vec4 envscale; + void main(void) + { + + vec3 camvecn = normalize(camvec); + + + + + #define dtc texcoord0 + + + vec4 diffuse = texture2D(diffusemap, dtc); + + vec3 bump = texture2D(normalmap, dtc).rgb*2.0 - 1.0; + vec3 bumpw = normalize(world * bump); + + + gcolor.rgb = diffuse.rgb*colorparams.rgb; + + gcolor.a = diffuse.a*specscale.x * 0.5; + + + + float invfresnel = dot(camvecn, bumpw); + vec3 rvec = 2.0*bumpw*invfresnel - camvecn; + vec3 reflect = textureCube(envmap, rvec).rgb; + + vec3 rmod = envscale.xyz*diffuse.a; + + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*clamp(1.0 - invfresnel, 0.0, 1.0)); + + + + + vec3 glow = texture2D(glowmap, dtc).rgb; + + glow *= glowcolor.xyz; + + gglow.rgb = glow; + + + + + #define packnorm colorparams.a + + + + gnormal.rgb = bumpw*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + + + } + diff --git a/shaders/tesseract/479.shader_test b/shaders/tesseract/479.shader_test new file mode 100644 index 0000000..7d98aa9 --- /dev/null +++ b/shaders/tesseract/479.shader_test @@ -0,0 +1,180 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec3 vnormal; + attribute vec2 vtexcoord0; + uniform mat4 camprojmatrix; + uniform vec2 texgenscroll; + + uniform vec2 lineardepthscale; + uniform vec3 gdepthpackparams; + varying float lineardepth; + + + varying vec2 texcoord0; + varying mat3 world; + + + uniform vec3 camera; + varying vec3 camvec; + + + + + +uniform vec4 glowcolor; + +uniform vec4 specscale; + +uniform vec4 envscale; + void main(void) + { + gl_Position = camprojmatrix * vvertex; + + + lineardepth = dot(lineardepthscale, gl_Position.zw); + + + + texcoord0 = vtexcoord0 + texgenscroll; + + vec3 bitangent = cross(vnormal, vtangent.xyz) * vtangent.w; + + world = mat3(vtangent.xyz, bitangent, vnormal); + + + + camvec = camera - vvertex.xyz; + + + + + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +uniform sampler2DRect refractlight, refractmask; + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + #define gfetchoffset(sampler, coords, offset) texture2DRectOffset(sampler, coords, offset) + #define gfetchproj(sampler, coords) texture2DRectProj(sampler, coords) + #define gfetchclamp(sampler, coords) texture2DRect(sampler, coords) + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + + uniform vec4 refractparams; + uniform float refractdepth; + + uniform vec4 colorparams; + uniform sampler2D diffusemap, normalmap; + + varying mat3 world; + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + uniform vec2 lineardepthscale; + uniform vec3 gdepthpackparams; + varying float lineardepth; + + + + varying vec2 texcoord0; + + varying vec3 camvec; + uniform sampler2D glowmap; + + uniform samplerCube envmap; + + + +uniform vec4 glowcolor; + +uniform vec4 specscale; + +uniform vec4 envscale; + void main(void) + { + + vec3 camvecn = normalize(camvec); + + + + + #define dtc texcoord0 + + + vec4 diffuse = texture2D(diffusemap, dtc); + + vec3 bump = texture2D(normalmap, dtc).rgb*2.0 - 1.0; + vec3 bumpw = normalize(world * bump); + + + gcolor.rgb = diffuse.rgb*colorparams.rgb; + + gcolor.a = diffuse.a*specscale.x * 0.5; + + + + float invfresnel = dot(camvecn, bumpw); + vec3 rvec = 2.0*bumpw*invfresnel - camvecn; + vec3 reflect = textureCube(envmap, rvec).rgb; + + vec3 rmod = envscale.xyz*diffuse.a; + + gcolor.rgb = mix(gcolor.rgb, reflect, rmod*clamp(1.0 - invfresnel, 0.0, 1.0)); + + + + + vec3 glow = texture2D(glowmap, dtc).rgb; + + glow *= glowcolor.xyz; + + gglow.rgb = glow; + + + + + vec2 rtc = bump.xy*refractparams.w; + float rmask = clamp(refractdepth*(lineardepth - dot(gfetch(refractmask, gl_FragCoord.xy + rtc).rgb, gdepthunpackparams)), 0.0, 1.0); + vec3 rlight = gfetch(refractlight, gl_FragCoord.xy + rtc*rmask).rgb; + gglow.rgb += rlight * refractparams.xyz; + + + + gnormal.rgb = bumpw*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + + + } + diff --git a/shaders/tesseract/48.shader_test b/shaders/tesseract/48.shader_test new file mode 100644 index 0000000..d2e2e78 --- /dev/null +++ b/shaders/tesseract/48.shader_test @@ -0,0 +1,38 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vcolor; + attribute vec2 vtexcoord0; + uniform mat4 hudmatrix; + varying vec2 texcoord0; + varying vec4 colorscale; + void main(void) + { + gl_Position = hudmatrix * vvertex; + texcoord0 = vtexcoord0; + colorscale = vcolor; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0; + varying vec2 texcoord0; + varying vec4 colorscale; + fragdata(0, fragcolor, vec4) + void main(void) + { + fragcolor = colorscale * texture2DRect(tex0, texcoord0); + } + diff --git a/shaders/tesseract/482.shader_test b/shaders/tesseract/482.shader_test new file mode 100644 index 0000000..bfbe244 --- /dev/null +++ b/shaders/tesseract/482.shader_test @@ -0,0 +1,111 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + + attribute vec4 vtangent; + varying mat3 world; + + attribute vec3 vnormal, vtexcoord0; + uniform mat4 camprojmatrix; + varying vec3 texcoord0; + + + +uniform vec4 specscale; + void main(void) + { + gl_Position = camprojmatrix * vvertex; + texcoord0 = vtexcoord0; + + + vec3 bitangent = cross(vnormal, vtangent.xyz) * vtangent.w; + + world = mat3(vtangent.xyz, bitangent, vnormal); + + + + + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + + uniform sampler2D diffusemap; + uniform vec4 colorparams; + varying vec3 texcoord0; + + uniform sampler2D normalmap; + varying mat3 world; + + + uniform sampler2D glowmap; + + + +uniform vec4 specscale; + void main(void) + { + + + + + #define dtc texcoord0.xy + + + vec4 diffuse = texture2D(diffusemap, dtc); + + + vec3 bump = texture2D(normalmap, dtc).rgb*2.0 - 1.0; + vec3 bumpw = world * bump; + + + + gcolor.rgb = diffuse.rgb*colorparams.rgb; + + + + + + + + + + bumpw = normalize(bumpw); + + + gnormal.rgb = bumpw*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + float alpha = clamp(texcoord0.z, 0.0, 1.0) * diffuse.a; + + gcolor.a = alpha; + gnormal.a = alpha; + + } + diff --git a/shaders/tesseract/485.shader_test b/shaders/tesseract/485.shader_test new file mode 100644 index 0000000..e898cb0 --- /dev/null +++ b/shaders/tesseract/485.shader_test @@ -0,0 +1,20 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +attribute vec4 position; +void main() +{ + gl_Position = position; +} + +[fragment shader] +#ifdef GL_ES +precision highp float; +#endif +uniform vec4 color; +void main() +{ + gl_FragColor = color; +} + diff --git a/shaders/tesseract/488.shader_test b/shaders/tesseract/488.shader_test new file mode 100644 index 0000000..bf146e9 --- /dev/null +++ b/shaders/tesseract/488.shader_test @@ -0,0 +1,141 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0, vtexcoord1; + varying vec2 texcoord0, texcoord1; + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + texcoord1 = vtexcoord1; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0; + #define gdepthfetch(sampler, coords) texture2DRect(sampler, coords) + #define gdepthfetchoffset(sampler, coords, offset) texture2DRectOffset(sampler, coords, offset) + #define gdepthfetchproj(sampler, coords) texture2DRectProj(sampler, coords) + #define gdepthfetchclamp(sampler, coords) texture2DRect(sampler, coords) + + + + uniform sampler2DRect tex1; + #define gnormfetch(sampler, coords) texture2DRect(sampler, coords) + #define gnormfetchoffset(sampler, coords, offset) texture2DRectOffset(sampler, coords, offset) + #define gnormfetchproj(sampler, coords) texture2DRectProj(sampler, coords) + #define gnormfetchclamp(sampler, coords) texture2DRect(sampler, coords) + + + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + uniform sampler2D tex2; + uniform vec3 tapparams; + uniform vec2 contrastparams; + uniform vec4 offsetscale; + uniform float prefilterdepth; + + uniform mat3 normalmatrix; + + + #define depthtc gl_FragCoord.xy + + uniform vec3 gdepthpackparams; + varying vec2 texcoord0, texcoord1; + fragdata(0, fragcolor, vec4) + void main(void) + { + + + float depth = gdepthfetch(tex0, depthtc).r; + + vec2 tapscale = tapparams.xy/depth; + + + + vec2 dpos = depthtc*offsetscale.xy + offsetscale.zw, pos = depth*dpos; + + vec3 normal = gnormfetch(tex1, texcoord0).rgb*2.0 - 1.0; + float normscale = inversesqrt(dot(normal, normal)); + normal *= normscale > 0.75 ? normscale : 0.0; + normal = normalmatrix * normal; + + vec2 noise = texture2D(tex2, texcoord1).rg*2.0-1.0; + float obscure = 0.0; + + vec2 offset0 = reflect(vec2(-0.933103, 0.025116), noise); + offset0 = depthtc + tapscale * offset0; + + float depth0 = gdepthfetch(tex0, offset0).r; + + + vec3 v0 = vec3(depth0*(offset0*offsetscale.xy + offsetscale.zw) - pos, depth0 - depth); + float dist20 = dot(v0, v0); + obscure += step(dist20, tapparams.z) * max(0.0, dot(v0, normal) + depth*1.0e-2) / (dist20 + 1.0e-5); + + vec2 offset1 = reflect(vec2(-0.432784, -0.989868), noise); + offset1 = depthtc + tapscale * offset1; + + float depth1 = gdepthfetch(tex0, offset1).r; + + + vec3 v1 = vec3(depth1*(offset1*offsetscale.xy + offsetscale.zw) - pos, depth1 - depth); + float dist21 = dot(v1, v1); + obscure += step(dist21, tapparams.z) * max(0.0, dot(v1, normal) + depth*1.0e-2) / (dist21 + 1.0e-5); + + vec2 offset2 = reflect(vec2(0.432416, -0.413800), noise); + offset2 = depthtc + tapscale * offset2; + + float depth2 = gdepthfetch(tex0, offset2).r; + + + vec3 v2 = vec3(depth2*(offset2*offsetscale.xy + offsetscale.zw) - pos, depth2 - depth); + float dist22 = dot(v2, v2); + obscure += step(dist22, tapparams.z) * max(0.0, dot(v2, normal) + depth*1.0e-2) / (dist22 + 1.0e-5); + + vec2 offset3 = reflect(vec2(-0.117770, 0.970336), noise); + offset3 = depthtc + tapscale * offset3; + + float depth3 = gdepthfetch(tex0, offset3).r; + + + vec3 v3 = vec3(depth3*(offset3*offsetscale.xy + offsetscale.zw) - pos, depth3 - depth); + float dist23 = dot(v3, v3); + obscure += step(dist23, tapparams.z) * max(0.0, dot(v3, normal) + depth*1.0e-2) / (dist23 + 1.0e-5); + + vec2 offset4 = reflect(vec2(0.837276, 0.531114), noise); + offset4 = depthtc + tapscale * offset4; + + float depth4 = gdepthfetch(tex0, offset4).r; + + + vec3 v4 = vec3(depth4*(offset4*offsetscale.xy + offsetscale.zw) - pos, depth4 - depth); + float dist24 = dot(v4, v4); + obscure += step(dist24, tapparams.z) * max(0.0, dot(v4, normal) + depth*1.0e-2) / (dist24 + 1.0e-5); + + obscure = pow(clamp(1.0 - contrastparams.x*obscure, 0.0, 1.0), contrastparams.y); + + vec2 weights = step(fwidth(depth), prefilterdepth) * (2.0*fract((gl_FragCoord.xy - 0.5)*0.5) - 0.5); + + obscure -= dFdx(obscure) * weights.x; + obscure -= dFdy(obscure) * weights.y; + + fragcolor.rg = vec2(obscure, depth); + + } + diff --git a/shaders/tesseract/491.shader_test b/shaders/tesseract/491.shader_test new file mode 100644 index 0000000..6a63ec5 --- /dev/null +++ b/shaders/tesseract/491.shader_test @@ -0,0 +1,126 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + + + void main(void) + { + gl_Position = vvertex; + + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex1; + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + #define gfetchoffset(sampler, coords, offset) texture2DRectOffset(sampler, coords, offset) + #define gfetchproj(sampler, coords) texture2DRectProj(sampler, coords) + #define gfetchclamp(sampler, coords) texture2DRect(sampler, coords) + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + + uniform sampler2DRect tex0; + uniform vec2 bilateralparams; + uniform vec3 gdepthpackparams; + + + fragdata(0, fragcolor, vec4) + void main(void) + { + #define tc gl_FragCoord.xy + #define depthtc gl_FragCoord.xy + #define tapvec(type, i) type(i, 0.0) + #define texval(i) texture2DRect(tex0, tc + tapvec(vec2, i)) + #define texvaloffset(i) texture2DRectOffset(tex0, tc, tapvec(ivec2, i)) + #define depthval(i) gfetch(tex1, depthtc + tapvec(vec2, i)) + #define depthvaloffset(i) gfetchoffset(tex1, depthtc, tapvec(ivec2, i)) + + vec2 vals = texture2DRect(tex0, tc).rg; + #define color vals.x + + #define depth vals.y + + + float weights = 1.0; + + + vec2 vals0 = texval(-6.0).rg; + #define color0 vals0.x + #define depth0 vals0.y + + depth0 -= depth; + float weight0 = exp2(-9.0*bilateralparams.x - depth0*depth0*bilateralparams.y); + weights += weight0; + color += weight0 * color0; + + + vec2 vals1 = texval(-4.0).rg; + #define color1 vals1.x + #define depth1 vals1.y + + depth1 -= depth; + float weight1 = exp2(-4.0*bilateralparams.x - depth1*depth1*bilateralparams.y); + weights += weight1; + color += weight1 * color1; + + + vec2 vals2 = texval(-2.0).rg; + #define color2 vals2.x + #define depth2 vals2.y + + depth2 -= depth; + float weight2 = exp2(-1.0*bilateralparams.x - depth2*depth2*bilateralparams.y); + weights += weight2; + color += weight2 * color2; + + + vec2 vals3 = texval(2.0).rg; + #define color3 vals3.x + #define depth3 vals3.y + + depth3 -= depth; + float weight3 = exp2(-1.0*bilateralparams.x - depth3*depth3*bilateralparams.y); + weights += weight3; + color += weight3 * color3; + + + vec2 vals4 = texval(4.0).rg; + #define color4 vals4.x + #define depth4 vals4.y + + depth4 -= depth; + float weight4 = exp2(-4.0*bilateralparams.x - depth4*depth4*bilateralparams.y); + weights += weight4; + color += weight4 * color4; + + + vec2 vals5 = texval(6.0).rg; + #define color5 vals5.x + #define depth5 vals5.y + + depth5 -= depth; + float weight5 = exp2(-9.0*bilateralparams.x - depth5*depth5*bilateralparams.y); + weights += weight5; + color += weight5 * color5; + + + fragcolor.rg = vec2(color / weights, depth); + + } + diff --git a/shaders/tesseract/494.shader_test b/shaders/tesseract/494.shader_test new file mode 100644 index 0000000..2989ac7 --- /dev/null +++ b/shaders/tesseract/494.shader_test @@ -0,0 +1,126 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + + + void main(void) + { + gl_Position = vvertex; + + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex1; + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + #define gfetchoffset(sampler, coords, offset) texture2DRectOffset(sampler, coords, offset) + #define gfetchproj(sampler, coords) texture2DRectProj(sampler, coords) + #define gfetchclamp(sampler, coords) texture2DRect(sampler, coords) + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + + uniform sampler2DRect tex0; + uniform vec2 bilateralparams; + uniform vec3 gdepthpackparams; + + + fragdata(0, fragcolor, vec4) + void main(void) + { + #define tc gl_FragCoord.xy + #define depthtc gl_FragCoord.xy + #define tapvec(type, i) type(0.0, i) + #define texval(i) texture2DRect(tex0, tc + tapvec(vec2, i)) + #define texvaloffset(i) texture2DRectOffset(tex0, tc, tapvec(ivec2, i)) + #define depthval(i) gfetch(tex1, depthtc + tapvec(vec2, i)) + #define depthvaloffset(i) gfetchoffset(tex1, depthtc, tapvec(ivec2, i)) + + vec2 vals = texture2DRect(tex0, tc).rg; + #define color vals.x + + #define depth vals.y + + + float weights = 1.0; + + + vec2 vals0 = texval(-6.0).rg; + #define color0 vals0.x + #define depth0 vals0.y + + depth0 -= depth; + float weight0 = exp2(-9.0*bilateralparams.x - depth0*depth0*bilateralparams.y); + weights += weight0; + color += weight0 * color0; + + + vec2 vals1 = texval(-4.0).rg; + #define color1 vals1.x + #define depth1 vals1.y + + depth1 -= depth; + float weight1 = exp2(-4.0*bilateralparams.x - depth1*depth1*bilateralparams.y); + weights += weight1; + color += weight1 * color1; + + + vec2 vals2 = texval(-2.0).rg; + #define color2 vals2.x + #define depth2 vals2.y + + depth2 -= depth; + float weight2 = exp2(-1.0*bilateralparams.x - depth2*depth2*bilateralparams.y); + weights += weight2; + color += weight2 * color2; + + + vec2 vals3 = texval(2.0).rg; + #define color3 vals3.x + #define depth3 vals3.y + + depth3 -= depth; + float weight3 = exp2(-1.0*bilateralparams.x - depth3*depth3*bilateralparams.y); + weights += weight3; + color += weight3 * color3; + + + vec2 vals4 = texval(4.0).rg; + #define color4 vals4.x + #define depth4 vals4.y + + depth4 -= depth; + float weight4 = exp2(-4.0*bilateralparams.x - depth4*depth4*bilateralparams.y); + weights += weight4; + color += weight4 * color4; + + + vec2 vals5 = texval(6.0).rg; + #define color5 vals5.x + #define depth5 vals5.y + + depth5 -= depth; + float weight5 = exp2(-9.0*bilateralparams.x - depth5*depth5*bilateralparams.y); + weights += weight5; + color += weight5 * color5; + + + fragcolor = vec4(color / weights, 0.0, 0.0, 1.0); + + } + diff --git a/shaders/tesseract/497.shader_test b/shaders/tesseract/497.shader_test new file mode 100644 index 0000000..43269af --- /dev/null +++ b/shaders/tesseract/497.shader_test @@ -0,0 +1,47 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec3 vtexcoord0; + varying vec3 texcoord0; + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define rhr gl_FragData[0] +#define rhg gl_FragData[1] +#define rhb gl_FragData[2] +#define rha gl_FragData[3] +uniform sampler3D tex3, tex4, tex5, tex6; + uniform vec3 bordercenter, borderrange, borderscale; + varying vec3 texcoord0; + fragdata(0, rhr, vec4) + fragdata(1, rhg, vec4) + fragdata(2, rhb, vec4) + fragdata(3, rha, vec4) + + void main(void) + { + float outside = clamp(borderscale.z*(abs(texcoord0.z - bordercenter.z) - borderrange.z), 0.0, 1.0); + vec3 tc = vec3(texcoord0.xy, clamp(texcoord0.z, bordercenter.z - borderrange.z, bordercenter.z + borderrange.z)); + rhr = mix(texture3D(tex3, tc), vec4(0.5, 0.5, 0.5, 0.0), outside); + rhg = mix(texture3D(tex4, tc), vec4(0.5, 0.5, 0.5, 0.0), outside); + rhb = mix(texture3D(tex5, tc), vec4(0.5, 0.5, 0.5, 0.0), outside); + rha = mix(texture3D(tex6, tc), vec4(0.5, 0.5, 0.5, 0.0), outside); + } + diff --git a/shaders/tesseract/500.shader_test b/shaders/tesseract/500.shader_test new file mode 100644 index 0000000..d678f59 --- /dev/null +++ b/shaders/tesseract/500.shader_test @@ -0,0 +1,44 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec3 vtexcoord0; + varying vec3 texcoord0; + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define rhr gl_FragData[0] +#define rhg gl_FragData[1] +#define rhb gl_FragData[2] +#define rha gl_FragData[3] +uniform sampler3D tex7, tex8, tex9, tex10; + varying vec3 texcoord0; + fragdata(0, rhr, vec4) + fragdata(1, rhg, vec4) + fragdata(2, rhb, vec4) + fragdata(3, rha, vec4) + + void main(void) + { + rhr = texture3D(tex7, texcoord0); + rhg = texture3D(tex8, texcoord0); + rhb = texture3D(tex9, texcoord0); + rha = texture3D(tex10, texcoord0); + } + diff --git a/shaders/tesseract/503.shader_test b/shaders/tesseract/503.shader_test new file mode 100644 index 0000000..1d14bef --- /dev/null +++ b/shaders/tesseract/503.shader_test @@ -0,0 +1,41 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform vec3 rhcenter; + uniform float rhbounds; + void main(void) + { + gl_Position = vec4((vvertex.xy - rhcenter.xy)/rhbounds, vvertex.zw); + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define rhr gl_FragData[0] +#define rhg gl_FragData[1] +#define rhb gl_FragData[2] +#define rha gl_FragData[3] +fragdata(0, rhr, vec4) + fragdata(1, rhg, vec4) + fragdata(2, rhb, vec4) + fragdata(3, rha, vec4) + + void main(void) + { + rhr = vec4(0.5, 0.5, 0.5, 0.0); + rhg = vec4(0.5, 0.5, 0.5, 0.0); + rhb = vec4(0.5, 0.5, 0.5, 0.0); + rha = vec4(0.5, 0.5, 0.5, 0.0); + } + diff --git a/shaders/tesseract/506.shader_test b/shaders/tesseract/506.shader_test new file mode 100644 index 0000000..67c45d1 --- /dev/null +++ b/shaders/tesseract/506.shader_test @@ -0,0 +1,119 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec3 vtexcoord0; + uniform mat4 rsmtcmatrix; + varying vec3 rhcenter; + varying vec2 rsmcenter; + void main(void) + { + gl_Position = vvertex; + rhcenter = vtexcoord0; + rsmcenter = (rsmtcmatrix * vec4(vtexcoord0, 1.0)).xy; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define rhr gl_FragData[0] +#define rhg gl_FragData[1] +#define rhb gl_FragData[2] +#define rha gl_FragData[3] +uniform sampler2DRect tex0, tex1, tex2; + uniform mat4 rsmworldmatrix; + uniform vec2 rsmspread; + uniform float rhatten, rhspread, rhaothreshold, rhaoatten, rhaoheight; + uniform vec3 rsmdir; + varying vec3 rhcenter; + varying vec2 rsmcenter; + fragdata(0, rhr, vec4) + fragdata(1, rhg, vec4) + fragdata(2, rhb, vec4) + fragdata(3, rha, vec4) + + void calcrhsample(vec3 rhtap, vec2 rsmtap, inout vec4 shr, inout vec4 shg, inout vec4 shb, inout vec4 sha) + { + vec3 rhpos = rhcenter + rhtap*rhspread; + vec2 rsmtc = rsmcenter + rsmtap*rsmspread; + float rsmdepth = texture2DRect(tex0, rsmtc).x; + vec3 rsmcolor = texture2DRect(tex1, rsmtc).rgb; + vec3 rsmnormal = texture2DRect(tex2, rsmtc).xyz*2.0 - 1.0; + vec3 rsmpos = (rsmworldmatrix * vec4(rsmtc, rsmdepth, 1.0)).xyz; + + vec3 dir = rhpos - rsmpos; + + sha += step(rhaothreshold, dir.z) * vec4(normalize(vec3(dir.xy, min(dot(dir.xy, dir.xy) * rhaoatten - rhaoheight, 0.0))), 1.0); + + float dist = dot(dir, dir); + if(dist > 0.000049) dir = normalize(dir); + float atten = clamp(dot(dir, rsmnormal), 0.0, 1.0) / (0.1 + dist*rhatten); + rsmcolor *= atten; + + shr += vec4(rsmcolor.r*dir, rsmcolor.r); + shg += vec4(rsmcolor.g*dir, rsmcolor.g); + shb += vec4(rsmcolor.b*dir, rsmcolor.b); + } + + void main(void) + { + vec4 shr = vec4(0.0), shg = vec4(0.0), shb = vec4(0.0), sha = vec4(0.0); + + + calcrhsample(vec3(0.0540788, 0.411725, 0.134068)*2.0 - 1.0, vec2(0.00240055, 0.643992)*2.0 - 1.0, shr, shg, shb, sha); + + calcrhsample(vec3(0.0163579, 0.416211, 0.992035)*2.0 - 1.0, vec2(0.0356464, 0.851616)*2.0 - 1.0, shr, shg, shb, sha); + + calcrhsample(vec3(0.692068, 0.549272, 0.886502)*2.0 - 1.0, vec2(0.101733, 0.21876)*2.0 - 1.0, shr, shg, shb, sha); + + calcrhsample(vec3(0.305795, 0.781854, 0.571337)*2.0 - 1.0, vec2(0.166119, 0.0278085)*2.0 - 1.0, shr, shg, shb, sha); + + calcrhsample(vec3(0.791681, 0.139042, 0.247047)*2.0 - 1.0, vec2(0.166438, 0.474999)*2.0 - 1.0, shr, shg, shb, sha); + + calcrhsample(vec3(0.83929, 0.973663, 0.460982)*2.0 - 1.0, vec2(0.24991, 0.766405)*2.0 - 1.0, shr, shg, shb, sha); + + calcrhsample(vec3(0.0336314, 0.0867641, 0.582324)*2.0 - 1.0, vec2(0.333714, 0.130407)*2.0 - 1.0, shr, shg, shb, sha); + + calcrhsample(vec3(0.148198, 0.961974, 0.0378124)*2.0 - 1.0, vec2(0.400681, 0.374781)*2.0 - 1.0, shr, shg, shb, sha); + + calcrhsample(vec3(0.948729, 0.0713828, 0.916379)*2.0 - 1.0, vec2(0.424067, 0.888211)*2.0 - 1.0, shr, shg, shb, sha); + + calcrhsample(vec3(0.586413, 0.591845, 0.031251)*2.0 - 1.0, vec2(0.448511, 0.678962)*2.0 - 1.0, shr, shg, shb, sha); + + calcrhsample(vec3(0.00189215, 0.973968, 0.932981)*2.0 - 1.0, vec2(0.529383, 0.213568)*2.0 - 1.0, shr, shg, shb, sha); + + calcrhsample(vec3(0.435865, 0.0853603, 0.995148)*2.0 - 1.0, vec2(0.608569, 0.47715)*2.0 - 1.0, shr, shg, shb, sha); + + calcrhsample(vec3(0.36848, 0.820612, 0.942717)*2.0 - 1.0, vec2(0.617996, 0.862528)*2.0 - 1.0, shr, shg, shb, sha); + + calcrhsample(vec3(0.500107, 0.0658284, 0.623005)*2.0 - 1.0, vec2(0.631784, 0.0515881)*2.0 - 1.0, shr, shg, shb, sha); + + calcrhsample(vec3(0.580187, 0.4485, 0.379223)*2.0 - 1.0, vec2(0.740969, 0.20753)*2.0 - 1.0, shr, shg, shb, sha); + + calcrhsample(vec3(0.258614, 0.0201422, 0.241005)*2.0 - 1.0, vec2(0.788203, 0.41923)*2.0 - 1.0, shr, shg, shb, sha); + + calcrhsample(vec3(0.987152, 0.441664, 0.43318)*2.0 - 1.0, vec2(0.794066, 0.615141)*2.0 - 1.0, shr, shg, shb, sha); + + calcrhsample(vec3(0.925108, 0.917203, 0.921506)*2.0 - 1.0, vec2(0.834504, 0.836612)*2.0 - 1.0, shr, shg, shb, sha); + + calcrhsample(vec3(0.988372, 0.822047, 0.12479)*2.0 - 1.0, vec2(0.89446, 0.0677863)*2.0 - 1.0, shr, shg, shb, sha); + + calcrhsample(vec3(0.330393, 0.43611, 0.762566)*2.0 - 1.0, vec2(0.975609, 0.446056)*2.0 - 1.0, shr, shg, shb, sha); + + + rhr = shr * (vec4(0.5, 0.5, 0.5, 1.0)/20.0) + vec4(0.5, 0.5, 0.5, 0.0); + rhg = shg * (vec4(0.5, 0.5, 0.5, 1.0)/20.0) + vec4(0.5, 0.5, 0.5, 0.0); + rhb = shb * (vec4(0.5, 0.5, 0.5, 1.0)/20.0) + vec4(0.5, 0.5, 0.5, 0.0); + rha = sha * (vec4(0.5, 0.5, 0.5, 1.0)/20.0) + vec4(0.5, 0.5, 0.5, 0.0); + } + diff --git a/shaders/tesseract/509.shader_test b/shaders/tesseract/509.shader_test new file mode 100644 index 0000000..09db6f2 --- /dev/null +++ b/shaders/tesseract/509.shader_test @@ -0,0 +1,59 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec3 vnormal; + attribute vec2 vtexcoord0; + uniform mat4 rsmmatrix; + uniform vec2 texgenscroll; + uniform vec4 colorparams; + uniform vec3 rsmdir; + varying vec4 normal; + varying vec2 texcoord0; + + void main(void) + { + gl_Position = rsmmatrix * vvertex; + texcoord0 = vtexcoord0 + texgenscroll; + + normal = vec4(vnormal, dot(vnormal, rsmdir)); + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +uniform vec4 colorparams; + uniform sampler2D diffusemap; + varying vec4 normal; + varying vec2 texcoord0; + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + void main(void) + { + vec4 diffuse = texture2D(diffusemap, texcoord0); + + + #define alpha colorparams.a + + + gcolor.rgb = normal.w*diffuse.rgb*colorparams.rgb; + gnormal = vec4(normal.xyz*0.5+0.5, 0.0); + + + gcolor.a = alpha; + + } + diff --git a/shaders/tesseract/51.shader_test b/shaders/tesseract/51.shader_test new file mode 100644 index 0000000..41b8481 --- /dev/null +++ b/shaders/tesseract/51.shader_test @@ -0,0 +1,38 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vcolor; + attribute vec3 vtexcoord0; + uniform mat4 hudmatrix; + varying vec3 texcoord0; + varying vec4 color; + void main(void) + { + gl_Position = hudmatrix * vvertex; + texcoord0 = vtexcoord0; + color = vcolor; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler3D tex0; + varying vec3 texcoord0; + varying vec4 color; + fragdata(0, fragcolor, vec4) + void main(void) + { + fragcolor = color * texture3D(tex0, texcoord0); + } + diff --git a/shaders/tesseract/512.shader_test b/shaders/tesseract/512.shader_test new file mode 100644 index 0000000..709ac5e --- /dev/null +++ b/shaders/tesseract/512.shader_test @@ -0,0 +1,71 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec3 vnormal; + attribute vec2 vtexcoord0; + uniform mat4 rsmmatrix; + uniform vec2 texgenscroll; + uniform vec4 colorparams; + uniform vec3 rsmdir; + varying vec4 normal; + varying vec2 texcoord0; + + uniform vec4 blendmapparams; + varying vec2 texcoord1; + + void main(void) + { + gl_Position = rsmmatrix * vvertex; + texcoord0 = vtexcoord0 + texgenscroll; + + texcoord1 = (vvertex.xy - blendmapparams.xy)*blendmapparams.zw; + + normal = vec4(vnormal, dot(vnormal, rsmdir)); + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +uniform vec4 colorparams; + uniform sampler2D diffusemap; + varying vec4 normal; + varying vec2 texcoord0; + + uniform float blendlayer; + uniform sampler2D blendmap; + varying vec2 texcoord1; + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + void main(void) + { + vec4 diffuse = texture2D(diffusemap, texcoord0); + + + #define alpha colorparams.a + + + gcolor.rgb = normal.w*diffuse.rgb*colorparams.rgb; + gnormal = vec4(normal.xyz*0.5+0.5, 0.0); + + + float blend = abs(texture2D(blendmap, texcoord1).r - blendlayer); + gcolor.rgb *= blend; + gcolor.a = blendlayer; + gnormal *= blend; + + } + diff --git a/shaders/tesseract/515.shader_test b/shaders/tesseract/515.shader_test new file mode 100644 index 0000000..42f2bf7 --- /dev/null +++ b/shaders/tesseract/515.shader_test @@ -0,0 +1,34 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 rsmmatrix; + void main(void) + { + gl_Position = rsmmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + void main(void) + { + gcolor = vec4(0.0, 0.0, 0.0, 1.0); + gnormal = vec4(0.5, 0.5, 0.5, 0.0); + } + + diff --git a/shaders/tesseract/518.shader_test b/shaders/tesseract/518.shader_test new file mode 100644 index 0000000..5774de6 --- /dev/null +++ b/shaders/tesseract/518.shader_test @@ -0,0 +1,25 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +attribute vec2 position; +attribute vec2 textureCoords; +varying vec2 texCoords; +void main() +{ + texCoords = textureCoords; + gl_Position = vec4(position, 0.0, 1.0); +} + +[fragment shader] +#ifdef GL_ES +precision highp float; +#endif +uniform sampler2DRect texSampler; +varying vec2 texCoords; +void main() +{ + gl_FragColor = texture2DRect(texSampler, texCoords); + gl_FragDepth = gl_FragColor.r; +} + diff --git a/shaders/tesseract/521.shader_test b/shaders/tesseract/521.shader_test new file mode 100644 index 0000000..9b7d22f --- /dev/null +++ b/shaders/tesseract/521.shader_test @@ -0,0 +1,61 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec2 texscroll; + varying vec2 texcoord0; + varying vec3 nvec; + void main(void) + { + + #define mpos vvertex + #define mquat vtangent + + vec3 mnormal = cross(mquat.xyz, vec3(mquat.y, -mquat.x, mquat.w))*2.0 + vec3(0.0, 0.0, 1.0); + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + nvec = modelworld * mnormal; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +varying vec2 texcoord0; + varying vec3 nvec; + uniform vec4 colorscale; + + uniform vec3 rsmdir; + uniform sampler2D tex0; + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + vec3 normal = normalize(nvec); + + gcolor = vec4(dot(normal, rsmdir)*diffuse.rgb*colorscale.rgb, 1.0); + gnormal = vec4(normal*0.5+0.5, 0.0); + } + diff --git a/shaders/tesseract/523.shader_test b/shaders/tesseract/523.shader_test new file mode 100644 index 0000000..9e7ce66 --- /dev/null +++ b/shaders/tesseract/523.shader_test @@ -0,0 +1,74 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec2 texscroll; + varying vec2 texcoord0; + varying vec3 nvec; + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index]; + vec4 dqdual = animdata[index+1]; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec3 mnormal = cross(mquat.xyz, vec3(mquat.y, -mquat.x, mquat.w))*2.0 + vec3(0.0, 0.0, 1.0); + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + nvec = modelworld * mnormal; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +varying vec2 texcoord0; + varying vec3 nvec; + uniform vec4 colorscale; + + uniform vec3 rsmdir; + uniform sampler2D tex0; + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + vec3 normal = normalize(nvec); + + gcolor = vec4(dot(normal, rsmdir)*diffuse.rgb*colorscale.rgb, 1.0); + gnormal = vec4(normal*0.5+0.5, 0.0); + } + diff --git a/shaders/tesseract/525.shader_test b/shaders/tesseract/525.shader_test new file mode 100644 index 0000000..1f8965d --- /dev/null +++ b/shaders/tesseract/525.shader_test @@ -0,0 +1,82 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec2 texscroll; + varying vec2 texcoord0; + varying vec3 nvec; + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec3 mnormal = cross(mquat.xyz, vec3(mquat.y, -mquat.x, mquat.w))*2.0 + vec3(0.0, 0.0, 1.0); + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + nvec = modelworld * mnormal; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +varying vec2 texcoord0; + varying vec3 nvec; + uniform vec4 colorscale; + + uniform vec3 rsmdir; + uniform sampler2D tex0; + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + vec3 normal = normalize(nvec); + + gcolor = vec4(dot(normal, rsmdir)*diffuse.rgb*colorscale.rgb, 1.0); + gnormal = vec4(normal*0.5+0.5, 0.0); + } + diff --git a/shaders/tesseract/527.shader_test b/shaders/tesseract/527.shader_test new file mode 100644 index 0000000..10037eb --- /dev/null +++ b/shaders/tesseract/527.shader_test @@ -0,0 +1,86 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec2 texscroll; + varying vec2 texcoord0; + varying vec3 nvec; + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + index = int(vboneindex.z); + dqreal += animdata[index] * vboneweight.z; + dqdual += animdata[index+1] * vboneweight.z; + + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec3 mnormal = cross(mquat.xyz, vec3(mquat.y, -mquat.x, mquat.w))*2.0 + vec3(0.0, 0.0, 1.0); + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + nvec = modelworld * mnormal; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +varying vec2 texcoord0; + varying vec3 nvec; + uniform vec4 colorscale; + + uniform vec3 rsmdir; + uniform sampler2D tex0; + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + vec3 normal = normalize(nvec); + + gcolor = vec4(dot(normal, rsmdir)*diffuse.rgb*colorscale.rgb, 1.0); + gnormal = vec4(normal*0.5+0.5, 0.0); + } + diff --git a/shaders/tesseract/529.shader_test b/shaders/tesseract/529.shader_test new file mode 100644 index 0000000..0028167 --- /dev/null +++ b/shaders/tesseract/529.shader_test @@ -0,0 +1,90 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec2 texscroll; + varying vec2 texcoord0; + varying vec3 nvec; + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + index = int(vboneindex.z); + dqreal += animdata[index] * vboneweight.z; + dqdual += animdata[index+1] * vboneweight.z; + + + index = int(vboneindex.w); + dqreal += animdata[index] * vboneweight.w; + dqdual += animdata[index+1] * vboneweight.w; + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec3 mnormal = cross(mquat.xyz, vec3(mquat.y, -mquat.x, mquat.w))*2.0 + vec3(0.0, 0.0, 1.0); + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + nvec = modelworld * mnormal; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +varying vec2 texcoord0; + varying vec3 nvec; + uniform vec4 colorscale; + + uniform vec3 rsmdir; + uniform sampler2D tex0; + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + vec3 normal = normalize(nvec); + + gcolor = vec4(dot(normal, rsmdir)*diffuse.rgb*colorscale.rgb, 1.0); + gnormal = vec4(normal*0.5+0.5, 0.0); + } + diff --git a/shaders/tesseract/532.shader_test b/shaders/tesseract/532.shader_test new file mode 100644 index 0000000..931c850 --- /dev/null +++ b/shaders/tesseract/532.shader_test @@ -0,0 +1,64 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec2 texscroll; + varying vec2 texcoord0; + varying vec3 nvec; + void main(void) + { + + #define mpos vvertex + #define mquat vtangent + + vec3 mnormal = cross(mquat.xyz, vec3(mquat.y, -mquat.x, mquat.w))*2.0 + vec3(0.0, 0.0, 1.0); + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + nvec = modelworld * mnormal; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +varying vec2 texcoord0; + varying vec3 nvec; + uniform vec4 colorscale; + uniform float alphatest; + uniform vec3 rsmdir; + uniform sampler2D tex0; + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + if(diffuse.a <= alphatest) + discard; + + vec3 normal = normalize(nvec); + + gcolor = vec4(dot(normal, rsmdir)*diffuse.rgb*colorscale.rgb, 1.0); + gnormal = vec4(normal*0.5+0.5, 0.0); + } + diff --git a/shaders/tesseract/534.shader_test b/shaders/tesseract/534.shader_test new file mode 100644 index 0000000..af76281 --- /dev/null +++ b/shaders/tesseract/534.shader_test @@ -0,0 +1,77 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec2 texscroll; + varying vec2 texcoord0; + varying vec3 nvec; + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index]; + vec4 dqdual = animdata[index+1]; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec3 mnormal = cross(mquat.xyz, vec3(mquat.y, -mquat.x, mquat.w))*2.0 + vec3(0.0, 0.0, 1.0); + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + nvec = modelworld * mnormal; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +varying vec2 texcoord0; + varying vec3 nvec; + uniform vec4 colorscale; + uniform float alphatest; + uniform vec3 rsmdir; + uniform sampler2D tex0; + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + if(diffuse.a <= alphatest) + discard; + + vec3 normal = normalize(nvec); + + gcolor = vec4(dot(normal, rsmdir)*diffuse.rgb*colorscale.rgb, 1.0); + gnormal = vec4(normal*0.5+0.5, 0.0); + } + diff --git a/shaders/tesseract/536.shader_test b/shaders/tesseract/536.shader_test new file mode 100644 index 0000000..37cac98 --- /dev/null +++ b/shaders/tesseract/536.shader_test @@ -0,0 +1,85 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec2 texscroll; + varying vec2 texcoord0; + varying vec3 nvec; + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec3 mnormal = cross(mquat.xyz, vec3(mquat.y, -mquat.x, mquat.w))*2.0 + vec3(0.0, 0.0, 1.0); + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + nvec = modelworld * mnormal; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +varying vec2 texcoord0; + varying vec3 nvec; + uniform vec4 colorscale; + uniform float alphatest; + uniform vec3 rsmdir; + uniform sampler2D tex0; + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + if(diffuse.a <= alphatest) + discard; + + vec3 normal = normalize(nvec); + + gcolor = vec4(dot(normal, rsmdir)*diffuse.rgb*colorscale.rgb, 1.0); + gnormal = vec4(normal*0.5+0.5, 0.0); + } + diff --git a/shaders/tesseract/538.shader_test b/shaders/tesseract/538.shader_test new file mode 100644 index 0000000..daed8fe --- /dev/null +++ b/shaders/tesseract/538.shader_test @@ -0,0 +1,89 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec2 texscroll; + varying vec2 texcoord0; + varying vec3 nvec; + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + index = int(vboneindex.z); + dqreal += animdata[index] * vboneweight.z; + dqdual += animdata[index+1] * vboneweight.z; + + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec3 mnormal = cross(mquat.xyz, vec3(mquat.y, -mquat.x, mquat.w))*2.0 + vec3(0.0, 0.0, 1.0); + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + nvec = modelworld * mnormal; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +varying vec2 texcoord0; + varying vec3 nvec; + uniform vec4 colorscale; + uniform float alphatest; + uniform vec3 rsmdir; + uniform sampler2D tex0; + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + if(diffuse.a <= alphatest) + discard; + + vec3 normal = normalize(nvec); + + gcolor = vec4(dot(normal, rsmdir)*diffuse.rgb*colorscale.rgb, 1.0); + gnormal = vec4(normal*0.5+0.5, 0.0); + } + diff --git a/shaders/tesseract/54.shader_test b/shaders/tesseract/54.shader_test new file mode 100644 index 0000000..efa1ad1 --- /dev/null +++ b/shaders/tesseract/54.shader_test @@ -0,0 +1,38 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vcolor; + attribute vec3 vtexcoord0; + uniform mat4 hudmatrix; + varying vec3 texcoord0; + varying vec4 colorscale; + void main(void) + { + gl_Position = hudmatrix * vvertex; + texcoord0 = vtexcoord0; + colorscale = vcolor; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform samplerCube tex0; + varying vec3 texcoord0; + varying vec4 colorscale; + fragdata(0, fragcolor, vec4) + void main(void) + { + fragcolor = colorscale * textureCube(tex0, texcoord0); + } + diff --git a/shaders/tesseract/540.shader_test b/shaders/tesseract/540.shader_test new file mode 100644 index 0000000..712935f --- /dev/null +++ b/shaders/tesseract/540.shader_test @@ -0,0 +1,93 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vtangent; + attribute vec2 vtexcoord0; + + attribute vec4 vboneweight, vboneindex; + #pragma CUBE2_uniform animdata + uniform vec4 animdata[192]; + + uniform mat4 modelmatrix; + uniform mat3 modelworld; + uniform vec2 texscroll; + varying vec2 texcoord0; + varying vec3 nvec; + void main(void) + { + + int index = int(vboneindex.x); + + vec4 dqreal = animdata[index] * vboneweight.x; + vec4 dqdual = animdata[index+1] * vboneweight.x; + index = int(vboneindex.y); + dqreal += animdata[index] * vboneweight.y; + dqdual += animdata[index+1] * vboneweight.y; + + index = int(vboneindex.z); + dqreal += animdata[index] * vboneweight.z; + dqdual += animdata[index+1] * vboneweight.z; + + + index = int(vboneindex.w); + dqreal += animdata[index] * vboneweight.w; + dqdual += animdata[index+1] * vboneweight.w; + + float len = length(dqreal); + dqreal /= len; + dqdual /= len; + + + vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w); + + + vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz)); + + vec3 mnormal = cross(mquat.xyz, vec3(mquat.y, -mquat.x, mquat.w))*2.0 + vec3(0.0, 0.0, 1.0); + + + + + gl_Position = modelmatrix * mpos; + + texcoord0 = vtexcoord0 + texscroll; + + nvec = modelworld * mnormal; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +varying vec2 texcoord0; + varying vec3 nvec; + uniform vec4 colorscale; + uniform float alphatest; + uniform vec3 rsmdir; + uniform sampler2D tex0; + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + + if(diffuse.a <= alphatest) + discard; + + vec3 normal = normalize(nvec); + + gcolor = vec4(dot(normal, rsmdir)*diffuse.rgb*colorscale.rgb, 1.0); + gnormal = vec4(normal*0.5+0.5, 0.0); + } + diff --git a/shaders/tesseract/57.shader_test b/shaders/tesseract/57.shader_test new file mode 100644 index 0000000..77c2860 --- /dev/null +++ b/shaders/tesseract/57.shader_test @@ -0,0 +1,104 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec3 vnormal; + attribute vec2 vtexcoord0; + uniform mat4 camprojmatrix; + uniform vec2 texgenscroll; + varying vec3 nvec; + + + varying vec2 texcoord0; + + + + + + void main(void) + { + gl_Position = camprojmatrix * vvertex; + + texcoord0 = vtexcoord0 + texgenscroll; + + + nvec = vnormal; + + + + + + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +uniform vec4 colorparams; + uniform sampler2D diffusemap; + + varying vec3 nvec; + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + + varying vec2 texcoord0; + + + + + + + void main(void) + { + vec3 normal = normalize(nvec); + + + vec4 diffuse = texture2D(diffusemap, texcoord0); + + + gcolor.rgb = diffuse.rgb*colorparams.rgb; + + gcolor.a = 0.0; + + + + + + + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + + + } + diff --git a/shaders/tesseract/6.shader_test b/shaders/tesseract/6.shader_test new file mode 100644 index 0000000..4d2f078 --- /dev/null +++ b/shaders/tesseract/6.shader_test @@ -0,0 +1,38 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vcolor; +attribute vec2 vtexcoord0; +uniform mat4 hudmatrix; +varying vec2 texcoord0; +varying vec4 colorscale; +void main(void) { + gl_Position = hudmatrix * vvertex; + texcoord0 = vtexcoord0; + colorscale = vcolor; +} + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2D tex0; +varying vec2 texcoord0; +varying vec4 colorscale; +fragdata(0, fragcolor, vec4) +void main(void) { + vec4 color = texture2D(tex0, texcoord0); + #pragma CUBE2_swizzle color + fragcolor = colorscale * color; +} + diff --git a/shaders/tesseract/60.shader_test b/shaders/tesseract/60.shader_test new file mode 100644 index 0000000..caa6ee0 --- /dev/null +++ b/shaders/tesseract/60.shader_test @@ -0,0 +1,118 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec3 vnormal; + attribute vec2 vtexcoord0; + uniform mat4 camprojmatrix; + uniform vec2 texgenscroll; + varying vec3 nvec; + + + varying vec2 texcoord0; + + + + + uniform vec4 blendmapparams; + varying vec2 texcoord1; + + + void main(void) + { + gl_Position = camprojmatrix * vvertex; + + texcoord0 = vtexcoord0 + texgenscroll; + + + texcoord1 = (vvertex.xy - blendmapparams.xy)*blendmapparams.zw; + + nvec = vnormal; + + + + + + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +uniform vec4 colorparams; + uniform sampler2D diffusemap; + + varying vec3 nvec; + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + + varying vec2 texcoord0; + + + + + + uniform float blendlayer; + uniform sampler2D blendmap; + varying vec2 texcoord1; + + + void main(void) + { + vec3 normal = normalize(nvec); + + + vec4 diffuse = texture2D(diffusemap, texcoord0); + + + gcolor.rgb = diffuse.rgb*colorparams.rgb; + + gcolor.a = 0.0; + + + + + + + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + + + float blend = abs(texture2D(blendmap, texcoord1).r - blendlayer); + gcolor *= blend; + gnormal.rgb *= blend; + gnormal.a *= blendlayer; + + } + diff --git a/shaders/tesseract/63.shader_test b/shaders/tesseract/63.shader_test new file mode 100644 index 0000000..95c2b78 --- /dev/null +++ b/shaders/tesseract/63.shader_test @@ -0,0 +1,108 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec3 vnormal; + attribute vec2 vtexcoord0; + uniform mat4 camprojmatrix; + uniform vec2 texgenscroll; + varying vec3 nvec; + + + varying vec2 texcoord0; + + + + + + void main(void) + { + gl_Position = camprojmatrix * vvertex; + + texcoord0 = vtexcoord0 + texgenscroll; + + + nvec = vnormal; + + + + + + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +uniform vec4 colorparams; + uniform sampler2D diffusemap; + + varying vec3 nvec; + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + + varying vec2 texcoord0; + + + + + + + void main(void) + { + vec3 normal = normalize(nvec); + + + vec4 diffuse = texture2D(diffusemap, texcoord0); + + + gcolor.rgb = diffuse.rgb*colorparams.rgb; + + gcolor.a = 0.0; + + + + + + gglow.rgb = vec3(0.0); + + + + #define packnorm colorparams.a + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + + + } + diff --git a/shaders/tesseract/66.shader_test b/shaders/tesseract/66.shader_test new file mode 100644 index 0000000..83d0e99 --- /dev/null +++ b/shaders/tesseract/66.shader_test @@ -0,0 +1,121 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec3 vnormal; + attribute vec2 vtexcoord0; + uniform mat4 camprojmatrix; + uniform vec2 texgenscroll; + varying vec3 nvec; + + + varying vec2 texcoord0; + + + + + + void main(void) + { + gl_Position = camprojmatrix * vvertex; + + texcoord0 = vtexcoord0 + texgenscroll; + + + nvec = vnormal; + + + + + + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define gcolor gl_FragData[0] +#define gnormal gl_FragData[1] +#define gglow gl_FragData[2] +uniform sampler2DRect refractlight; + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + #define gfetchoffset(sampler, coords, offset) texture2DRectOffset(sampler, coords, offset) + #define gfetchproj(sampler, coords) texture2DRectProj(sampler, coords) + #define gfetchclamp(sampler, coords) texture2DRect(sampler, coords) + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + + uniform vec4 refractparams; + + uniform vec4 colorparams; + uniform sampler2D diffusemap; + + varying vec3 nvec; + + fragdata(0, gcolor, vec4) + fragdata(1, gnormal, vec4) + fragdata(2, gglow, vec4) + + + + + varying vec2 texcoord0; + + + + + + + void main(void) + { + vec3 normal = normalize(nvec); + + + vec4 diffuse = texture2D(diffusemap, texcoord0); + + + gcolor.rgb = diffuse.rgb*colorparams.rgb; + + gcolor.a = 0.0; + + + + + + gglow.rgb = vec3(0.0); + + + + vec3 rlight = gfetch(refractlight, gl_FragCoord.xy).rgb; + gglow.rgb += rlight * refractparams.xyz; + + + + gnormal.rgb = normal*0.5 + 0.5; + #ifdef packnorm + gnormal.a = (packnorm); + #else + gnormal.a = 1.0; + #endif + + + + + + + + + } + diff --git a/shaders/tesseract/69.shader_test b/shaders/tesseract/69.shader_test new file mode 100644 index 0000000..ede252b --- /dev/null +++ b/shaders/tesseract/69.shader_test @@ -0,0 +1,27 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + uniform mat4 shadowmatrix; + void main(void) + { + gl_Position = shadowmatrix * vvertex; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +void main(void) + { + } + diff --git a/shaders/tesseract/72.shader_test b/shaders/tesseract/72.shader_test new file mode 100644 index 0000000..efadd72 --- /dev/null +++ b/shaders/tesseract/72.shader_test @@ -0,0 +1,49 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + varying vec2 texcoord0; + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0; + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + #define gfetchoffset(sampler, coords, offset) texture2DRectOffset(sampler, coords, offset) + #define gfetchproj(sampler, coords) texture2DRectProj(sampler, coords) + #define gfetchclamp(sampler, coords) texture2DRect(sampler, coords) + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + + uniform vec3 gdepthpackparams; + varying vec2 texcoord0; + fragdata(0, fragcolor, vec4) + void main(void) + { + + + float depth = gdepthscale.x / (gfetch(tex0, texcoord0).r*gdepthscale.y + gdepthscale.z); + + fragcolor.r = depth; + + } + diff --git a/shaders/tesseract/75.shader_test b/shaders/tesseract/75.shader_test new file mode 100644 index 0000000..262aaea --- /dev/null +++ b/shaders/tesseract/75.shader_test @@ -0,0 +1,77 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#pragma CUBE2_fog + attribute vec4 vvertex, vcolor; + uniform mat4 explosionmatrix; + uniform vec3 center; + uniform vec4 animstate; + uniform float side; + + + varying vec4 color; + varying vec2 texcoord0, texcoord1; + +uniform vec2 lineardepthscale; +varying float lineardepth; + void main(void) + { + vec4 wobble = vec4(vvertex.xyz*(1.0 + 0.5*abs(fract(dot(vvertex.xyz, center) + animstate.w*2.0) - 0.5)), vvertex.w); + wobble.z *= side; + gl_Position = explosionmatrix * wobble; + + + color = vcolor; + + + + float dtc = 1.768 - animstate.x*1.414; + dtc *= dtc; + texcoord0 = animstate.w*0.4 + dtc*vvertex.xy; + texcoord1 = vvertex.xy*0.5 + 0.5; + + +lineardepth = dot(lineardepthscale, gl_Position.zw); +} + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +varying vec4 color; + varying vec2 texcoord0, texcoord1; + uniform sampler2D tex0, tex1; + fragdata(0, fragcolor, vec4) + +varying float lineardepth; + +uniform vec3 fogcolor; +uniform vec2 fogdensity; +uniform vec4 radialfogscale; +#define fogcoord lineardepth*length(vec3(gl_FragCoord.xy*radialfogscale.xy + radialfogscale.zw, 1.0)) + void main(void) + { + vec2 dtc = texcoord0 + texture2D(tex0, texcoord1).xy*0.1; + vec4 diffuse = texture2D(tex0, dtc); + float blend = texture2D(tex1, texcoord1).r; + diffuse *= blend*4.0; + diffuse.b += 0.5 - blend*0.5; + + + fragcolor = diffuse * color; + + +#define FOG_COLOR fogcolor +fragcolor.rgb = mix((FOG_COLOR).rgb, fragcolor.rgb, clamp(exp2(fogcoord*-fogdensity.x)*fogdensity.y, 0.0, 1.0)); +} + diff --git a/shaders/tesseract/78.shader_test b/shaders/tesseract/78.shader_test new file mode 100644 index 0000000..465c0ee --- /dev/null +++ b/shaders/tesseract/78.shader_test @@ -0,0 +1,93 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#pragma CUBE2_fog + attribute vec4 vvertex, vcolor; + uniform mat4 explosionmatrix; + uniform vec3 center; + uniform vec4 animstate; + uniform float side; + + + uniform vec2 lineardepthscale; + varying float lineardepth; + + varying vec4 color; + varying vec2 texcoord0, texcoord1; + void main(void) + { + vec4 wobble = vec4(vvertex.xyz*(1.0 + 0.5*abs(fract(dot(vvertex.xyz, center) + animstate.w*2.0) - 0.5)), vvertex.w); + wobble.z *= side; + gl_Position = explosionmatrix * wobble; + + lineardepth = dot(lineardepthscale, gl_Position.zw); + + + color = vcolor; + + + + float dtc = 1.768 - animstate.x*1.414; + dtc *= dtc; + texcoord0 = animstate.w*0.4 + dtc*vvertex.xy; + texcoord1 = vvertex.xy*0.5 + 0.5; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex2; + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + #define gfetchoffset(sampler, coords, offset) texture2DRectOffset(sampler, coords, offset) + #define gfetchproj(sampler, coords) texture2DRectProj(sampler, coords) + #define gfetchclamp(sampler, coords) texture2DRect(sampler, coords) + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + + uniform vec3 softparams; + varying float lineardepth; + + varying vec4 color; + varying vec2 texcoord0, texcoord1; + uniform sampler2D tex0, tex1; + fragdata(0, fragcolor, vec4) + +uniform vec3 fogcolor; +uniform vec2 fogdensity; +uniform vec4 radialfogscale; +#define fogcoord lineardepth*length(vec3(gl_FragCoord.xy*radialfogscale.xy + radialfogscale.zw, 1.0)) + void main(void) + { + vec2 dtc = texcoord0 + texture2D(tex0, texcoord1).xy*0.1; + vec4 diffuse = texture2D(tex0, dtc); + float blend = texture2D(tex1, texcoord1).r; + diffuse *= blend*4.0; + diffuse.b += 0.5 - blend*0.5; + + + fragcolor.rgb = diffuse.rgb * color.rgb; + + + float depth = gdepthscale.x / (gfetch(tex2, gl_FragCoord.xy).r*gdepthscale.y + gdepthscale.z); + + fragcolor.a = diffuse.a * max(clamp((depth - lineardepth)*softparams.x - softparams.y, 0.0, 1.0) * color.a, softparams.z); + + +#define FOG_COLOR fogcolor +fragcolor.rgb = mix((FOG_COLOR).rgb, fragcolor.rgb, clamp(exp2(fogcoord*-fogdensity.x)*fogdensity.y, 0.0, 1.0)); +} + diff --git a/shaders/tesseract/81.shader_test b/shaders/tesseract/81.shader_test new file mode 100644 index 0000000..24c6727 --- /dev/null +++ b/shaders/tesseract/81.shader_test @@ -0,0 +1,83 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#pragma CUBE2_fog + attribute vec4 vvertex, vcolor; + uniform mat4 explosionmatrix; + uniform vec3 center; + uniform vec4 animstate; + uniform float side; + + attribute vec2 vtexcoord0; + varying vec2 texcoord2; + uniform vec4 texgenS, texgenT; + + + varying vec4 color; + varying vec2 texcoord0, texcoord1; + +uniform vec2 lineardepthscale; +varying float lineardepth; + void main(void) + { + vec4 wobble = vec4(vvertex.xyz*(1.0 + 0.5*abs(fract(dot(vvertex.xyz, center) + animstate.w*2.0) - 0.5)), vvertex.w); + wobble.z *= side; + gl_Position = explosionmatrix * wobble; + + + color = vcolor; + + + texcoord0 = vtexcoord0; + vec2 texgen = vec2(dot(texgenS, vvertex), dot(texgenT, vvertex)); + texcoord1 = texgen; + texcoord2 = texgen - animstate.w*0.5; + + +lineardepth = dot(lineardepthscale, gl_Position.zw); +} + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +varying vec2 texcoord2; + + + varying vec4 color; + varying vec2 texcoord0, texcoord1; + uniform sampler2D tex0, tex1; + fragdata(0, fragcolor, vec4) + +varying float lineardepth; + +uniform vec3 fogcolor; +uniform vec2 fogdensity; +uniform vec4 radialfogscale; +#define fogcoord lineardepth*length(vec3(gl_FragCoord.xy*radialfogscale.xy + radialfogscale.zw, 1.0)) + void main(void) + { + vec2 dtc = texcoord0 + texture2D(tex0, texcoord2).xy*0.1; + vec4 diffuse = texture2D(tex0, dtc); + float blend = texture2D(tex1, texcoord1).r; + diffuse *= blend*4.0; + diffuse.b += 0.5 - blend*0.5; + + + fragcolor = diffuse * color; + + +#define FOG_COLOR fogcolor +fragcolor.rgb = mix((FOG_COLOR).rgb, fragcolor.rgb, clamp(exp2(fogcoord*-fogdensity.x)*fogdensity.y, 0.0, 1.0)); +} + diff --git a/shaders/tesseract/84.shader_test b/shaders/tesseract/84.shader_test new file mode 100644 index 0000000..84cc458 --- /dev/null +++ b/shaders/tesseract/84.shader_test @@ -0,0 +1,100 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#pragma CUBE2_fog + attribute vec4 vvertex, vcolor; + uniform mat4 explosionmatrix; + uniform vec3 center; + uniform vec4 animstate; + uniform float side; + + attribute vec2 vtexcoord0; + varying vec2 texcoord2; + uniform vec4 texgenS, texgenT; + + + uniform vec2 lineardepthscale; + varying float lineardepth; + + varying vec4 color; + varying vec2 texcoord0, texcoord1; + void main(void) + { + vec4 wobble = vec4(vvertex.xyz*(1.0 + 0.5*abs(fract(dot(vvertex.xyz, center) + animstate.w*2.0) - 0.5)), vvertex.w); + wobble.z *= side; + gl_Position = explosionmatrix * wobble; + + lineardepth = dot(lineardepthscale, gl_Position.zw); + + + color = vcolor; + + + texcoord0 = vtexcoord0; + vec2 texgen = vec2(dot(texgenS, vvertex), dot(texgenT, vvertex)); + texcoord1 = texgen; + texcoord2 = texgen - animstate.w*0.5; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +varying vec2 texcoord2; + + + + uniform sampler2DRect tex2; + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + #define gfetchoffset(sampler, coords, offset) texture2DRectOffset(sampler, coords, offset) + #define gfetchproj(sampler, coords) texture2DRectProj(sampler, coords) + #define gfetchclamp(sampler, coords) texture2DRect(sampler, coords) + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + + uniform vec3 softparams; + varying float lineardepth; + + varying vec4 color; + varying vec2 texcoord0, texcoord1; + uniform sampler2D tex0, tex1; + fragdata(0, fragcolor, vec4) + +uniform vec3 fogcolor; +uniform vec2 fogdensity; +uniform vec4 radialfogscale; +#define fogcoord lineardepth*length(vec3(gl_FragCoord.xy*radialfogscale.xy + radialfogscale.zw, 1.0)) + void main(void) + { + vec2 dtc = texcoord0 + texture2D(tex0, texcoord2).xy*0.1; + vec4 diffuse = texture2D(tex0, dtc); + float blend = texture2D(tex1, texcoord1).r; + diffuse *= blend*4.0; + diffuse.b += 0.5 - blend*0.5; + + + fragcolor.rgb = diffuse.rgb * color.rgb; + + + float depth = gdepthscale.x / (gfetch(tex2, gl_FragCoord.xy).r*gdepthscale.y + gdepthscale.z); + + fragcolor.a = diffuse.a * max(clamp((depth - lineardepth)*softparams.x - softparams.y, 0.0, 1.0) * color.a, softparams.z); + + +#define FOG_COLOR fogcolor +fragcolor.rgb = mix((FOG_COLOR).rgb, fragcolor.rgb, clamp(exp2(fogcoord*-fogdensity.x)*fogdensity.y, 0.0, 1.0)); +} + diff --git a/shaders/tesseract/87.shader_test b/shaders/tesseract/87.shader_test new file mode 100644 index 0000000..d35e721 --- /dev/null +++ b/shaders/tesseract/87.shader_test @@ -0,0 +1,50 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#pragma CUBE2_fog + attribute vec4 vvertex, vcolor; + uniform mat4 camprojmatrix; + uniform vec4 colorscale; + varying vec4 color; + +uniform vec2 lineardepthscale; +varying float lineardepth; + void main(void) + { + gl_Position = camprojmatrix * vvertex; + color = vcolor * colorscale; + +lineardepth = dot(lineardepthscale, gl_Position.zw); +} + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +varying vec4 color; + fragdata(0, fragcolor, vec4) + +varying float lineardepth; + +uniform vec3 fogcolor; +uniform vec2 fogdensity; +uniform vec4 radialfogscale; +#define fogcoord lineardepth*length(vec3(gl_FragCoord.xy*radialfogscale.xy + radialfogscale.zw, 1.0)) + void main(void) + { + fragcolor = color; + +#define FOG_COLOR fogcolor +fragcolor.rgb = mix((FOG_COLOR).rgb, fragcolor.rgb, clamp(exp2(fogcoord*-fogdensity.x)*fogdensity.y, 0.0, 1.0)); +} + diff --git a/shaders/tesseract/9.shader_test b/shaders/tesseract/9.shader_test new file mode 100644 index 0000000..3587b63 --- /dev/null +++ b/shaders/tesseract/9.shader_test @@ -0,0 +1,40 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vcolor; +attribute vec2 vtexcoord0; +uniform mat4 hudmatrix; +varying vec2 texcoord0; +varying vec4 colorscale; +void main(void) { + gl_Position = hudmatrix * vvertex; + texcoord0 = vtexcoord0; + colorscale = vcolor; +} + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2D tex0; +uniform vec4 textparams; +varying vec2 texcoord0; +varying vec4 colorscale; +fragdata(0, fragcolor, vec4) +void main(void) { + float dist = texture2D(tex0, texcoord0).r; + float border = smoothstep(textparams.x, textparams.y, dist); + float outline = smoothstep(textparams.z, textparams.w, dist); + fragcolor = vec4(colorscale.rgb * outline, colorscale.a * border); +} + diff --git a/shaders/tesseract/90.shader_test b/shaders/tesseract/90.shader_test new file mode 100644 index 0000000..f366485 --- /dev/null +++ b/shaders/tesseract/90.shader_test @@ -0,0 +1,59 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#pragma CUBE2_fog + attribute vec4 vvertex, vcolor; + attribute vec2 vtexcoord0; + uniform mat4 camprojmatrix; + uniform float ldrscale; + varying vec4 color; + varying vec2 texcoord0; + +uniform vec2 lineardepthscale; +varying float lineardepth; + void main(void) + { + gl_Position = camprojmatrix * vvertex; + texcoord0 = vtexcoord0; + color = vec4(vcolor.rgb * ldrscale, vcolor.a); + +lineardepth = dot(lineardepthscale, gl_Position.zw); +} + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform vec4 textparams; + uniform sampler2D tex0; + varying vec4 color; + varying vec2 texcoord0; + fragdata(0, fragcolor, vec4) + +varying float lineardepth; + +uniform vec3 fogcolor; +uniform vec2 fogdensity; +uniform vec4 radialfogscale; +#define fogcoord lineardepth*length(vec3(gl_FragCoord.xy*radialfogscale.xy + radialfogscale.zw, 1.0)) + void main(void) + { + float dist = texture2D(tex0, texcoord0).r; + float border = smoothstep(textparams.x, textparams.y, dist); + float outline = smoothstep(textparams.z, textparams.w, dist); + fragcolor = vec4(color.rgb * outline, color.a * border); + +#define FOG_COLOR fogcolor +fragcolor.rgb = mix((FOG_COLOR).rgb, fragcolor.rgb, clamp(exp2(fogcoord*-fogdensity.x)*fogdensity.y, 0.0, 1.0)); +} + diff --git a/shaders/tesseract/93.shader_test b/shaders/tesseract/93.shader_test new file mode 100644 index 0000000..b2ae127 --- /dev/null +++ b/shaders/tesseract/93.shader_test @@ -0,0 +1,63 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#pragma CUBE2_fog + attribute vec4 vvertex, vcolor; + attribute vec2 vtexcoord0; + uniform mat4 camprojmatrix; + uniform vec4 colorscale; + varying vec4 color; + varying vec2 texcoord0; + + +uniform vec2 lineardepthscale; +varying float lineardepth; + void main(void) + { + gl_Position = camprojmatrix * vvertex; + texcoord0 = vtexcoord0; + color = vcolor * colorscale; + + + +lineardepth = dot(lineardepthscale, gl_Position.zw); +} + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2D tex0; + varying vec4 color; + varying vec2 texcoord0; + fragdata(0, fragcolor, vec4) + +varying float lineardepth; + +uniform vec3 fogcolor; +uniform vec2 fogdensity; +uniform vec4 radialfogscale; +#define fogcoord lineardepth*length(vec3(gl_FragCoord.xy*radialfogscale.xy + radialfogscale.zw, 1.0)) + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + #pragma CUBE2_swizzle diffuse + + + + fragcolor = diffuse * color; + +#define FOG_COLOR fogcolor +fragcolor.rgb = mix((FOG_COLOR).rgb, fragcolor.rgb, clamp(exp2(fogcoord*-fogdensity.x)*fogdensity.y, 0.0, 1.0)); +} + diff --git a/shaders/tesseract/96.shader_test b/shaders/tesseract/96.shader_test new file mode 100644 index 0000000..8c1ca2b --- /dev/null +++ b/shaders/tesseract/96.shader_test @@ -0,0 +1,82 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#pragma CUBE2_fog + attribute vec4 vvertex, vcolor; + attribute vec2 vtexcoord0; + uniform mat4 camprojmatrix; + uniform vec4 colorscale; + varying vec4 color; + varying vec2 texcoord0; + + uniform vec2 lineardepthscale; + varying float lineardepth; + varying vec2 surface; + + void main(void) + { + gl_Position = camprojmatrix * vvertex; + texcoord0 = vtexcoord0; + color = vcolor * colorscale; + + + lineardepth = dot(lineardepthscale, gl_Position.zw); + surface = vtexcoord0.xy*2.82842712474619 - 1.4142135623731; + + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex2; + #define gfetch(sampler, coords) texture2DRect(sampler, coords) + #define gfetchoffset(sampler, coords, offset) texture2DRectOffset(sampler, coords, offset) + #define gfetchproj(sampler, coords) texture2DRectProj(sampler, coords) + #define gfetchclamp(sampler, coords) texture2DRect(sampler, coords) + + uniform vec3 gdepthscale; + uniform vec3 gdepthunpackparams; + + + uniform vec3 softparams; + varying float lineardepth; + varying vec2 surface; + + uniform sampler2D tex0; + varying vec4 color; + varying vec2 texcoord0; + fragdata(0, fragcolor, vec4) + +uniform vec3 fogcolor; +uniform vec2 fogdensity; +uniform vec4 radialfogscale; +#define fogcoord lineardepth*length(vec3(gl_FragCoord.xy*radialfogscale.xy + radialfogscale.zw, 1.0)) + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + #pragma CUBE2_swizzle diffuse + + + + float depth = gdepthscale.x / (gfetch(tex2, gl_FragCoord.xy).r*gdepthscale.y + gdepthscale.z); + + diffuse.a *= clamp((depth - lineardepth)*softparams.x - softparams.y - dot(surface, surface), 0.0, 1.0); + + + fragcolor = diffuse * color; + +#define FOG_COLOR fogcolor +fragcolor.rgb = mix((FOG_COLOR).rgb, fragcolor.rgb, clamp(exp2(fogcoord*-fogdensity.x)*fogdensity.y, 0.0, 1.0)); +} + diff --git a/shaders/tesseract/99.shader_test b/shaders/tesseract/99.shader_test new file mode 100644 index 0000000..01216c2 --- /dev/null +++ b/shaders/tesseract/99.shader_test @@ -0,0 +1,46 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex, vcolor; + attribute vec2 vtexcoord0; + uniform mat4 camprojmatrix; + uniform vec4 colorscale; + varying vec4 color; + varying vec2 texcoord0; + void main(void) + { + gl_Position = camprojmatrix * vvertex; + color = vcolor * colorscale; + texcoord0 = vtexcoord0; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2D tex0; + varying vec4 color; + varying vec2 texcoord0; + fragdata(0, fragcolor, vec4) + + void main(void) + { + vec4 diffuse = texture2D(tex0, texcoord0); + #pragma CUBE2_swizzle diffuse + + diffuse *= color; + fragcolor = diffuse; + + + } + |