diff options
Diffstat (limited to 'shaders/humus-domino')
-rw-r--r-- | shaders/humus-domino/1.shader_test (renamed from shaders/humus-domino/1.frag) | 113 | ||||
-rw-r--r-- | shaders/humus-domino/1.vert | 19 | ||||
-rw-r--r-- | shaders/humus-domino/12.shader_test | 22 | ||||
-rw-r--r-- | shaders/humus-domino/2.frag | 36 | ||||
-rw-r--r-- | shaders/humus-domino/3.frag | 6 | ||||
-rw-r--r-- | shaders/humus-domino/3.vert | 6 | ||||
-rw-r--r-- | shaders/humus-domino/4.shader_test (renamed from shaders/humus-domino/2.vert) | 125 | ||||
-rw-r--r-- | shaders/humus-domino/9.shader_test | 17 |
8 files changed, 211 insertions, 133 deletions
diff --git a/shaders/humus-domino/1.frag b/shaders/humus-domino/1.shader_test index af0fff3..a80d525 100644 --- a/shaders/humus-domino/1.frag +++ b/shaders/humus-domino/1.shader_test @@ -1,28 +1,93 @@ -#version 120 +[require] +GLSL >= 1.10 + +[fragment shader] +#version 130 #define saturate(x) clamp(x,0.0,1.0) #define lerp mix #line 18 -uniform sampler2D Base;
-uniform sampler2D Bump;
-
-uniform float fade;
-
-varying vec2 texCoord;
-varying vec3 lVec;
-
-void main(){
- vec3 lightVec = normalize(lVec);
- vec3 viewVec = lightVec;
-
- float atten = saturate(1.0 / (1.0 + dot(lVec, lVec)) - 0.1);
-
- vec4 base = texture2D(Base, texCoord);
- vec3 bump = texture2D(Bump, texCoord).xyz;
- vec3 normal = normalize(bump * 2.0 - 1.0);
-
- float diffuse = saturate(dot(lightVec, normal));
- float specular = pow(diffuse, 16.0);
-
- gl_FragColor = fade * atten * ((diffuse * 0.7 + 0.3) * base + 0.5 * specular);
-}
+uniform sampler2D Base; +uniform sampler2D Bump; + +uniform float fade; + +varying vec2 texCoord; +varying vec3 lVec; + +void main(){ + vec3 lightVec = normalize(lVec); + vec3 viewVec = lightVec; + + float atten = saturate(1.0 / (1.0 + dot(lVec, lVec)) - 0.1); + + vec4 base = texture2D(Base, texCoord); + vec3 bump = texture2D(Bump, texCoord).xyz; + vec3 normal = normalize(bump * 2.0 - 1.0); + + float diffuse = saturate(dot(lightVec, normal)); + float specular = pow(diffuse, 16.0); + + gl_FragColor = fade * atten * ((diffuse * 0.7 + 0.3) * base + 0.5 * specular); +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +[vertex shader] +#version 130 +#define saturate(x) clamp(x,0.0,1.0) +#define lerp mix +#line 2 +uniform vec3 camPos; + +varying vec2 texCoord; +varying vec3 lVec; + +void main(){ + gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; + + texCoord = gl_Vertex.xz * 0.0625; + + lVec = 0.005 * (camPos - gl_Vertex.xyz).xzy; +} + + diff --git a/shaders/humus-domino/1.vert b/shaders/humus-domino/1.vert deleted file mode 100644 index 4114202..0000000 --- a/shaders/humus-domino/1.vert +++ /dev/null @@ -1,19 +0,0 @@ -#version 120 -#define saturate(x) clamp(x,0.0,1.0) -#define lerp mix -#line 2 -uniform vec3 camPos;
-
-varying vec2 texCoord;
-varying vec3 lVec;
-
-void main(){
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
-
- texCoord = gl_Vertex.xz * 0.0625;
-
- lVec = 0.005 * (camPos - gl_Vertex.xyz).xzy;
-}
-
-
- diff --git a/shaders/humus-domino/12.shader_test b/shaders/humus-domino/12.shader_test new file mode 100644 index 0000000..7497b6b --- /dev/null +++ b/shaders/humus-domino/12.shader_test @@ -0,0 +1,22 @@ +[require] +GLSL >= 1.10 + +[fragment shader] +#version 130 +uniform ivec4 color; +out ivec4 out_color; + +void main() +{ + out_color = color; +} + +[vertex shader] +#version 130 +in vec4 position; +void main() +{ + gl_Position = position; +} + + diff --git a/shaders/humus-domino/2.frag b/shaders/humus-domino/2.frag deleted file mode 100644 index 61ffb92..0000000 --- a/shaders/humus-domino/2.frag +++ /dev/null @@ -1,36 +0,0 @@ -#version 120 -#define saturate(x) clamp(x,0.0,1.0) -#define lerp mix -#define BATCH_INSTANCES 64 -#line 45 -uniform sampler3D Noise;
-
-uniform float fade;
-
-varying vec3 texCoord;
-varying vec3 normal;
-varying vec3 lVec;
-
-void main(){
- vec3 lightVec = normalize(lVec);
- vec3 viewVec = lightVec;
-
- float atten = saturate(1.0 / (1.0 + dot(lVec, lVec)) - 0.1);
-
- vec4 darkWood = vec4(0.09, 0.04, 0.01, 1.0);
- vec4 liteWood = vec4(0.92, 0.51, 0.13, 1.0);
-
- float rings = fract(texture3D(Noise, texCoord * 0.15, 1.0).x * 4.0);
- rings *= 4.0 * (1.0 - rings);
- rings *= rings;
-
- float n = texture3D(Noise, texCoord).x;
-
- vec4 base = lerp(darkWood, liteWood, rings + n);
-
- float diffuse = saturate(dot(lightVec, normal));
- float specular = pow(diffuse, 64.0);
-
- gl_FragColor = fade * atten * ((diffuse * 0.8 + 0.2) * base + 0.4 * specular);
-}
- diff --git a/shaders/humus-domino/3.frag b/shaders/humus-domino/3.frag deleted file mode 100644 index 4c72c26..0000000 --- a/shaders/humus-domino/3.frag +++ /dev/null @@ -1,6 +0,0 @@ -uniform vec4 color; -void main() -{ - gl_FragColor = color; -} - diff --git a/shaders/humus-domino/3.vert b/shaders/humus-domino/3.vert deleted file mode 100644 index b081d0f..0000000 --- a/shaders/humus-domino/3.vert +++ /dev/null @@ -1,6 +0,0 @@ -attribute vec4 position; -void main() -{ - gl_Position = position; -} - diff --git a/shaders/humus-domino/2.vert b/shaders/humus-domino/4.shader_test index df4b21d..4de43c5 100644 --- a/shaders/humus-domino/2.vert +++ b/shaders/humus-domino/4.shader_test @@ -1,47 +1,88 @@ -#version 120 +[require] +GLSL >= 1.10 + +[fragment shader] +#version 130 +#define saturate(x) clamp(x,0.0,1.0) +#define lerp mix +#define BATCH_INSTANCES 64 +#line 45 +uniform sampler3D Noise; + +uniform float fade; + +varying vec3 texCoord; +varying vec3 normal; +varying vec3 lVec; + +void main(){ + vec3 lightVec = normalize(lVec); + vec3 viewVec = lightVec; + + float atten = saturate(1.0 / (1.0 + dot(lVec, lVec)) - 0.1); + + vec4 darkWood = vec4(0.09, 0.04, 0.01, 1.0); + vec4 liteWood = vec4(0.92, 0.51, 0.13, 1.0); + + float rings = fract(texture3D(Noise, texCoord * 0.15, 1.0).x * 4.0); + rings *= 4.0 * (1.0 - rings); + rings *= rings; + + float n = texture3D(Noise, texCoord).x; + + vec4 base = lerp(darkWood, liteWood, rings + n); + + float diffuse = saturate(dot(lightVec, normal)); + float specular = pow(diffuse, 64.0); + + gl_FragColor = fade * atten * ((diffuse * 0.8 + 0.2) * base + 0.4 * specular); +} + +[vertex shader] +#version 130 #define saturate(x) clamp(x,0.0,1.0) #define lerp mix #define BATCH_INSTANCES 64 #line 2 -uniform vec3 camPos;
-
-void rotate(const vec2 sc, inout vec2 pos){
- pos.xy = vec2(dot(pos, sc), dot(pos, vec2(-sc.y, sc.x)));
-}
-
-varying vec3 texCoord;
-varying vec3 normal;
-varying vec3 lVec;
-
-uniform vec4 attribs[BATCH_INSTANCES];
-uniform float time;
-
-uniform float fallAngle;
-
-void main(){
- vec4 attrib = attribs[int(gl_MultiTexCoord0.x)];
-
- float a = saturate(time - attrib.w);
- a = fallAngle * pow(a, 0.8);
-
- vec2 scA = vec2(cos(a), sin(a));
- vec2 scB = vec2(cos(-attrib.z), sin(-attrib.z));
-
- vec4 position = gl_Vertex;
- normal = gl_Normal;
- rotate(scA, position.xy);
- rotate(scA, normal.xy);
- rotate(scB, position.xz);
- rotate(scB, normal.xz);
-
- position.xz += attrib.xy;
-
- gl_Position = gl_ModelViewProjectionMatrix * position;
-
- texCoord = gl_Vertex.xyz * 0.283 + attrib.w * vec3(7.243, 2.6783, 9.4921);
-
- lVec = 0.005 * (camPos - position.xyz);
-}
-
-
+uniform vec3 camPos; + +void rotate(const vec2 sc, inout vec2 pos){ + pos.xy = vec2(dot(pos, sc), dot(pos, vec2(-sc.y, sc.x))); +} + +varying vec3 texCoord; +varying vec3 normal; +varying vec3 lVec; + +uniform vec4 attribs[BATCH_INSTANCES]; +uniform float time; + +uniform float fallAngle; + +void main(){ + vec4 attrib = attribs[int(gl_MultiTexCoord0.x)]; + + float a = saturate(time - attrib.w); + a = fallAngle * pow(a, 0.8); + + vec2 scA = vec2(cos(a), sin(a)); + vec2 scB = vec2(cos(-attrib.z), sin(-attrib.z)); + + vec4 position = gl_Vertex; + normal = gl_Normal; + rotate(scA, position.xy); + rotate(scA, normal.xy); + rotate(scB, position.xz); + rotate(scB, normal.xz); + + position.xz += attrib.xy; + + gl_Position = gl_ModelViewProjectionMatrix * position; + + texCoord = gl_Vertex.xyz * 0.283 + attrib.w * vec3(7.243, 2.6783, 9.4921); + + lVec = 0.005 * (camPos - position.xyz); +} + + diff --git a/shaders/humus-domino/9.shader_test b/shaders/humus-domino/9.shader_test new file mode 100644 index 0000000..30ba541 --- /dev/null +++ b/shaders/humus-domino/9.shader_test @@ -0,0 +1,17 @@ +[require] +GLSL >= 1.10 + +[fragment shader] +uniform vec4 color; +void main() +{ + gl_FragColor = color; +} + +[vertex shader] +attribute vec4 position; +void main() +{ + gl_Position = position; +} + |