diff --git a/data/shaders/bloompower.frag b/data/shaders/bloompower.frag deleted file mode 100644 index dc2e1df5b..000000000 --- a/data/shaders/bloompower.frag +++ /dev/null @@ -1,13 +0,0 @@ -uniform float power; -uniform sampler2D tex; - -out vec4 FragColor; - -void main() -{ - vec4 col = texture(tex, gl_TexCoord[0].xy); - if (col.a < 0.5) - discard; - - FragColor = vec4(col.xyz, power); -} diff --git a/data/shaders/check.sh b/data/shaders/check.sh deleted file mode 100644 index 571cadea9..000000000 --- a/data/shaders/check.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -# -# Run a syntax check on all the shaders. -# -# The utility glslopt may be gotten from github.com/clbr/glsl-optimizer. - -out() { - rm -f *.out - echo Failed: $1 - exit 1 -} - - -for vert in *.vert; do - glslopt -v $vert - [ $? -ne 0 ] && out $vert -done - -for frag in *.frag; do - glslopt -f $frag - [ $? -ne 0 ] && out $frag -done - - -rm -f *.out diff --git a/data/shaders/color_levels.frag b/data/shaders/color_levels.frag deleted file mode 100644 index a707690cd..000000000 --- a/data/shaders/color_levels.frag +++ /dev/null @@ -1,243 +0,0 @@ -//#define DOF_ENABLED - -#ifdef DOF_ENABLED - -uniform sampler2D tex; -uniform sampler2D dtex; -uniform vec3 inlevel; -uniform vec2 outlevel; -uniform mat4 invprojm; - -in vec2 uv; -out vec4 FragColor; - -#define PI 3.14159265 - -/* ---------------------------------------------------------------------------------------------- */ -// TEST -/* ---------------------------------------------------------------------------------------------- */ - -float width = 1920; //texture width -float height = 1080; //texture height - -vec2 texel = vec2(1.0/width,1.0/height); - -//------------------------------------------ -//user variables - -int samples = 3; //samples on the first ring -int rings = 5; //ring count - -bool autofocus = false; //use autofocus in shader? disable if you use external focalDepth value -float focalDepth = 0.1; -vec2 focus = vec2(0.5,0.5); // autofocus point on screen (0.0,0.0 - left lower corner, 1.0,1.0 - upper right) -float range = 150.0; //focal range -float maxblur = 1.25; //clamp value of max blur - -float threshold = 0.9; //highlight threshold; -float gain = 10.0; //highlight gain; - -float bias = 0.4; //bokeh edge bias -float fringe = 0.5; //bokeh chromatic aberration/fringing - -bool noise = true; //use noise instead of pattern for sample dithering -float namount = 0.0001; //dither amount - -bool depthblur = false; //blur the depth buffer? -float dbsize = 2.0; //depthblursize - - - -/* ---------------------------------------------------------------------------------------------- */ -// Function -/* ---------------------------------------------------------------------------------------------- */ - -vec3 color(vec2 coords,float blur) //processing the sample -{ - vec3 col = vec3(0.0); - - col.r = texture2D(tex,coords + vec2(0.0,1.0)*texel*fringe*blur).r; - col.g = texture2D(tex,coords + vec2(-0.866,-0.5)*texel*fringe*blur).g; - col.b = texture2D(tex,coords + vec2(0.866,-0.5)*texel*fringe*blur).b; - - vec3 lumcoeff = vec3(0.299,0.587,0.114); - float lum = dot(col.rgb, lumcoeff); - float thresh = max((lum-threshold)*gain, 0.0); - return col+mix(vec3(0.0),col,thresh*blur); -} - -vec2 rand(in vec2 coord) //generating noise/pattern texture for dithering -{ - float noiseX = ((fract(1.0-coord.s*(width/2.0))*0.25)+(fract(coord.t*(height/2.0))*0.75))*2.0-1.0; - float noiseY = ((fract(1.0-coord.s*(width/2.0))*0.75)+(fract(coord.t*(height/2.0))*0.25))*2.0-1.0; - - if (noise) - { - noiseX = clamp(fract(sin(dot(coord ,vec2(12.9898,78.233))) * 43758.5453),0.0,1.0)*2.0-1.0; - noiseY = clamp(fract(sin(dot(coord ,vec2(12.9898,78.233)*2.0)) * 43758.5453),0.0,1.0)*2.0-1.0; - } - return vec2(noiseX,noiseY); -} - - - - - - -void main() -{ - - //float depth = texture2D(dtex,uv).x; - - float curdepth = texture(dtex, uv).x; - vec4 FragPos = invprojm * (2.0f * vec4(uv, curdepth, 1.0f) - 1.0f); - FragPos /= FragPos.w; - - float depth = clamp((FragPos.z/180), 0., 1.); - - - float blur = 0.0; - - - blur = clamp((abs(depth - focalDepth)/range)*100.0,-maxblur,maxblur); - - vec2 noise = rand(uv)*namount*blur; - - float w = (1.0/width)*blur+noise.x; - float h = (1.0/height)*blur+noise.y; - - vec3 col = texture2D(tex, uv).rgb; - vec3 colDof = col; - float s = 1.0; - - int ringsamples; - - for (int i = 1; i <= rings; i += 1) - { - ringsamples = i * samples; - - for (int j = 0 ; j < ringsamples ; j += 1) - { - float step = PI*2.0 / float(ringsamples); - float pw = (cos(float(j)*step)*float(i)); - float ph = (sin(float(j)*step)*float(i)); - float p = 1.0; - - colDof += color(uv + vec2(pw*w,ph*h),blur)*mix(1.0,(float(i))/(float(rings)),bias)*p; - s += 1.0*mix(1.0,(float(i))/(float(rings)),bias)*p; - } - } - colDof /= s; - - // get color correction values - float inBlack = inlevel.x; - float inWhite = inlevel.z; - float inGamma = inlevel.y; - - float outBlack = outlevel.x; - float outWhite = outlevel.y; - - vec3 colOut = (pow(((col.rgb * 255.0) - inBlack) / (inWhite - inBlack), - vec3(1.0 / inGamma)) * (outWhite - outBlack) + outBlack) / 255.0; - - depth = (1 - depth); - vec3 final = colOut * depth + colDof.rgb * (1 - depth); - - vec2 inTex = uv - 0.5; - float vignette = 1 - dot(inTex, inTex); - - vignette = clamp(pow(vignette, 0.8), 0., 1.) ; - vignette = vignette + vignette - 0.5; - final.rgb *= clamp(vignette, 0., 1.15); - - FragColor.rgb = final; - FragColor.a = 1.0; -} - - - -/* -void main() -{ - vec2 texc = uv; - //texc.y = 1.0 - texc.y; - - - vec4 col = texture(tex, texc); - float curdepth = texture(dtex, uv).x; - - vec2 inTex = uv - 0.5; - float vignette = 1 - dot(inTex, inTex); - - vec4 FragPos = invprojm * (2.0f * vec4(uv, curdepth, 1.0f) - 1.0f); - FragPos /= FragPos.w; - - //col = col / (1 - col); - - float inBlack = inlevel.x; - float inWhite = inlevel.z; - float inGamma = inlevel.y; - - float outBlack = outlevel.x; - float outWhite = outlevel.y; - - float depth1 = clamp((FragPos.z/180), 0., 1.); - - vec3 colOut = (pow(((col.rgb * 255.0) - inBlack) / (inWhite - inBlack), - vec3(1.0 / inGamma)) * (outWhite - outBlack) + outBlack) / 255.0; - - depth1 = (1 - depth1); - vec3 final = colOut * depth1 + col.rgb * (1 - depth1); - - vignette = clamp(pow(vignette, 0.8), 0., 1.) ; - vignette = vignette + vignette - 0.5; - final.rgb *= clamp(vignette, 0., 1.15); - FragColor = vec4(final, 1.0); - - -}*/ - -#else - - -uniform sampler2D tex; -uniform sampler2D dtex; -uniform vec3 inlevel; -uniform vec2 outlevel; -uniform mat4 invprojm; - -in vec2 uv; -out vec4 FragColor; - -void main() -{ - vec4 col = texture(tex, uv); - - float curdepth = texture(dtex, uv).x; - vec4 FragPos = invprojm * (2.0 * vec4(uv, curdepth, 1.0f) - 1.0f); - FragPos /= FragPos.w; - float depth = clamp(FragPos.z / 180, 0., 1.); - depth = (1 - depth); - - // Compute the vignette - vec2 inside = uv - 0.5; - float vignette = 1 - dot(inside, inside); - vignette = clamp(pow(vignette, 0.8), 0., 1.); - vignette = clamp(vignette + vignette - 0.5, 0., 1.15); - - float inBlack = inlevel.x; - float inWhite = inlevel.z; - float inGamma = inlevel.y; - - float outBlack = outlevel.x; - float outWhite = outlevel.y; - - vec3 colSat = (pow(((col.rgb * 255.0) - inBlack) / (inWhite - inBlack), - vec3(1.0 / inGamma)) * (outWhite - outBlack) + outBlack) / 255.0; - - vec3 colFinal = colSat * depth + col.rgb * (1 - depth); - - FragColor = vec4(colFinal * vignette, 1.0); - //FragColor = vec4(vec3(depth), 1.0); -} -#endif \ No newline at end of file diff --git a/data/shaders/farplane.vert b/data/shaders/farplane.vert deleted file mode 100644 index 9d3a1b7db..000000000 --- a/data/shaders/farplane.vert +++ /dev/null @@ -1,5 +0,0 @@ -uniform mat4 ModelViewProjectionMatrix; - -void main() { - gl_Position = (ModelViewProjectionMatrix * gl_Vertex).xyww; -} diff --git a/data/shaders/logluminance.frag b/data/shaders/logluminance.frag deleted file mode 100644 index 10f3d4000..000000000 --- a/data/shaders/logluminance.frag +++ /dev/null @@ -1,14 +0,0 @@ -uniform sampler2D tex; - -in vec2 uv; -out vec4 FragColor; - -float delta = .0001; - -void main() -{ - vec3 weight = vec3(0.2125f, 0.7154f, 0.0721f); - vec3 col = texture(tex, uv).xyz; - float luma = dot(col, weight); - FragColor = vec4(log(luma + delta)); -} \ No newline at end of file diff --git a/data/shaders/mipviz.frag b/data/shaders/mipviz.frag deleted file mode 100644 index da795da40..000000000 --- a/data/shaders/mipviz.frag +++ /dev/null @@ -1,51 +0,0 @@ -uniform sampler2D tex; -uniform vec2 texsize; -uniform int notex; -out vec4 FragColor; - -float miplevel(in vec2 texture_coordinate) -{ - // The OpenGL Graphics System: A Specification 4.2 - // - chapter 3.9.11, equation 3.21 - - vec2 dx_vtc = dFdx(texture_coordinate); - vec2 dy_vtc = dFdy(texture_coordinate); - float delta_max_sqr = max(dot(dx_vtc, dx_vtc), dot(dy_vtc, dy_vtc)); - - return 0.5 * log2(delta_max_sqr); // == log2(sqrt(delta_max_sqr)); -} - -void main() { - - if (notex != 0) { - FragColor = gl_Color; - return; - } - - // Buggy Intel windows driver workaround - vec4 levels[6] = vec4[]( - vec4(0.0, 0.0, 1.0, 0.8), - vec4(0.0, 0.5, 1.0, 0.4), - vec4(1.0, 1.0, 1.0, 0.0), - vec4(1.0, 0.7, 0.0, 0.2), - vec4(1.0, 0.3, 0.0, 0.6), - vec4(1.0, 0.0, 0.0, 0.8) - ); - - float mip = miplevel(texsize * gl_TexCoord[0].xy) + 2.0; - mip = clamp(mip, 0.0, 5.0); - - int lowmip = int(mip); - int highmip = lowmip + 1; - if (highmip > 5) - highmip = 5; - - float mixer = fract(mip); - - vec4 mixcol = mix(levels[lowmip], levels[highmip], mixer); - vec4 tcol = texture(tex, gl_TexCoord[0].xy); - - vec3 col = mix(tcol.xyz, mixcol.xyz, mixcol.a); - - FragColor = vec4(col, tcol.a); -} diff --git a/data/shaders/skybox.frag b/data/shaders/skybox.frag deleted file mode 100644 index e9425c61b..000000000 --- a/data/shaders/skybox.frag +++ /dev/null @@ -1,69 +0,0 @@ -// SuperTuxKart - a fun racing game with go-kart -// Copyright (C) 2013 the SuperTuxKart team -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 3 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -uniform sampler2D tex; -uniform sampler2D glow_tex; -uniform float transparency; -uniform vec3 sun_pos; - -in vec2 uv_anim; -in vec2 uv; -in vec2 uv_cl; -in vec3 vertex; -in vec2 uv_fast; -out vec4 FragColor; - -void main() -{ - vec2 uv_temp = uv; - vec3 V = normalize(vertex); - vec3 L = normalize(vec3(sun_pos)); - - vec3 col = texture(tex, vec2((L.y + 1.0) / 2.0, V.y)).xyz; - - float vl = clamp(dot(V, L), 0., 1.); - - float paint = texture(tex, uv_temp * 3).a; - - uv_temp += 20; - //float paint2 = texture(tex, uv_temp * 5).a; - - float paint2 = texture(tex, uv * 5.).a; - - // Get the general cloud mask - - - float hello = texture(glow_tex, (uv_cl + paint2 * 0.07) *2.).g; - - float cld_mask = texture(glow_tex, (uv_anim + hello * 0.007 )).r; - - vec2 fast = vec2(-uv_fast.x, uv_fast.y);// + (hello * 0.007); - float cld_fast = texture(glow_tex, fast ).r; - - - - - cld_mask = (cld_mask * hello * 0.5); - cld_fast = (cld_fast * hello ); - - col = cld_mask + col*(1. - cld_mask); - col = cld_fast + col*(1. - cld_fast); - - FragColor = vec4( vec3(col * paint * paint2), 1.0); - - - //FragColor = vec4(vec3(ou), 1.0); -} diff --git a/data/shaders/skybox.vert b/data/shaders/skybox.vert deleted file mode 100644 index 45ded6b85..000000000 --- a/data/shaders/skybox.vert +++ /dev/null @@ -1,47 +0,0 @@ -// SuperTuxKart - a fun racing game with go-kart -// Copyright (C) 2013 the SuperTuxKart team -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 3 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - -// Creates a bubble (wave) effect by distorting the texture depending on time -uniform mat4 ModelViewProjectionMatrix; -uniform float time; - -out vec2 uv; -out vec2 uv_anim; -out vec2 uv_cl; -out vec2 uv_fast; - -out vec3 vertex; - - -void main() -{ - uv = gl_MultiTexCoord0.st; - gl_Position = ModelViewProjectionMatrix * gl_Vertex; - - - float delta_x = cos(time*3.0) * sin( 4.0 * gl_TexCoord[0].st.s * 6.28318531 ); - float delta_y = cos(time*2.0) * sin( 3.0 * gl_TexCoord[0].st.t * 6.28318531 ); - - vertex = gl_Vertex.xyz; - - - uv_anim = uv + vec2(0.002*time, 0); - uv_cl = uv + vec2(-0.001*time, 0); - - uv_fast = uv + vec2(0.005*time, 0); -} diff --git a/data/shaders/water.frag b/data/shaders/water.frag deleted file mode 100644 index 29bac3458..000000000 --- a/data/shaders/water.frag +++ /dev/null @@ -1,58 +0,0 @@ -// Shader based on work by Fabien Sanglard -// Released under the terms of CC-BY 3.0 -#version 330 compatibility -uniform sampler2D BumpTex1; // Normal map 1 -uniform sampler2D BumpTex2; // Normal map 2 -uniform sampler2D DecalTex; //The texture - -uniform vec2 delta1; -uniform vec2 delta2; - -in vec3 lightVec; -in vec3 halfVec; -in vec3 eyeVec; -in vec2 uv; -out vec4 FragColor; - -void main() -{ - // lookup normal from normal map, move from [0,1] to [-1, 1] range, normalize - vec3 normal = 2.0 * texture (BumpTex1, uv + delta1).rgb - 1.0; - vec3 normal2 = 2.0 * texture (BumpTex2, uv + delta2).rgb - 1.0; - - // scale normals - normal.y = 4.0*normal.y; - normal2.y = 4.0*normal2.y; - - normal = (normalize(normal) + normalize(normal2))/2.0; - - // compute diffuse lighting - float lamberFactor = max (dot (lightVec, normal), 0.0); - vec4 diffuseMaterial; - vec4 diffuseLight; - - diffuseMaterial = texture (DecalTex, uv + vec2(delta1.x, 0.0)); - diffuseLight = vec4(1.0, 1.0, 1.0, 1.0); - - vec3 col = diffuseMaterial.xyz * (0.3 + lamberFactor*0.7); - - // specular (phong) - vec3 R = normalize(reflect(lightVec, normal)); - float specular = max(dot(R, eyeVec), 0.0); - - // weak specular - specular = specular*specular; - specular = specular*specular; - float specular_weak = specular*0.05; - col += vec3(specular_weak, specular_weak, specular_weak); - - // strong specular - specular = specular*specular; - float specular_strong = specular*0.3; - col += vec3(specular_strong, specular_strong, specular_strong); - - float summed = dot(vec3(1.0), col) / 3.0; - float alpha = 0.9 + 0.1 * smoothstep(0.0, 1.0, summed); - - FragColor = vec4(col, alpha); -} diff --git a/data/shaders/water.vert b/data/shaders/water.vert deleted file mode 100644 index cf44b8e8c..000000000 --- a/data/shaders/water.vert +++ /dev/null @@ -1,55 +0,0 @@ -// Shader based on work by Fabien Sanglard -// Released under the terms of CC-BY 3.0 -#version 330 compatibility -uniform float speed; -uniform float height; -uniform float waveLength; - -uniform vec3 lightdir; - -out vec3 lightVec; -out vec3 halfVec; -out vec3 eyeVec; -out vec2 uv; - -void main() -{ - vec4 pos = gl_Vertex; - - pos.y += (sin(pos.x/waveLength + speed) + cos(pos.z/waveLength + speed)) * height; - - vec3 vertexPosition = vec3(gl_ModelViewMatrix * pos); - - // Building the matrix Eye Space -> Tangent Space - vec3 n = normalize (gl_NormalMatrix * gl_Normal); - // gl_MultiTexCoord1.xyz - vec3 t = normalize (gl_NormalMatrix * vec3(1.0, 0.0, 0.0)); // tangent - vec3 b = cross (n, t); - - // transform light and half angle vectors by tangent basis - vec3 v; - v.x = dot (lightdir, t); - v.y = dot (lightdir, b); - v.z = dot (lightdir, n); - lightVec = normalize (v); - - vertexPosition = normalize(vertexPosition); - - eyeVec = normalize(-vertexPosition); // we are in Eye Coordinates, so EyePos is (0,0,0) - - // Normalize the halfVector to pass it to the fragment shader - - // No need to divide by two, the result is normalized anyway. - // vec3 halfVector = normalize((vertexPosition + lightDir) / 2.0); - vec3 halfVector = normalize(vertexPosition + lightdir); - v.x = dot (halfVector, t); - v.y = dot (halfVector, b); - v.z = dot (halfVector, n); - - // No need to normalize, t,b,n and halfVector are normal vectors. - //normalize (v); - halfVec = v ; - - gl_Position = gl_ModelViewProjectionMatrix * pos; - uv = (gl_TextureMatrix[0] * gl_MultiTexCoord0).st; -}