summaryrefslogtreecommitdiff
path: root/shaders/humus-domino
diff options
context:
space:
mode:
Diffstat (limited to 'shaders/humus-domino')
-rw-r--r--shaders/humus-domino/1.frag28
-rw-r--r--shaders/humus-domino/1.vert19
-rw-r--r--shaders/humus-domino/2.frag36
-rw-r--r--shaders/humus-domino/2.vert47
-rw-r--r--shaders/humus-domino/3.frag6
-rw-r--r--shaders/humus-domino/3.vert6
6 files changed, 142 insertions, 0 deletions
diff --git a/shaders/humus-domino/1.frag b/shaders/humus-domino/1.frag
new file mode 100644
index 0000000..af0fff3
--- /dev/null
+++ b/shaders/humus-domino/1.frag
@@ -0,0 +1,28 @@
+#version 120
+#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);
+}
+
diff --git a/shaders/humus-domino/1.vert b/shaders/humus-domino/1.vert
new file mode 100644
index 0000000..4114202
--- /dev/null
+++ b/shaders/humus-domino/1.vert
@@ -0,0 +1,19 @@
+#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/2.frag b/shaders/humus-domino/2.frag
new file mode 100644
index 0000000..61ffb92
--- /dev/null
+++ b/shaders/humus-domino/2.frag
@@ -0,0 +1,36 @@
+#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/2.vert b/shaders/humus-domino/2.vert
new file mode 100644
index 0000000..df4b21d
--- /dev/null
+++ b/shaders/humus-domino/2.vert
@@ -0,0 +1,47 @@
+#version 120
+#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);
+}
+
+
+
diff --git a/shaders/humus-domino/3.frag b/shaders/humus-domino/3.frag
new file mode 100644
index 0000000..4c72c26
--- /dev/null
+++ b/shaders/humus-domino/3.frag
@@ -0,0 +1,6 @@
+uniform vec4 color;
+void main()
+{
+ gl_FragColor = color;
+}
+
diff --git a/shaders/humus-domino/3.vert b/shaders/humus-domino/3.vert
new file mode 100644
index 0000000..b081d0f
--- /dev/null
+++ b/shaders/humus-domino/3.vert
@@ -0,0 +1,6 @@
+attribute vec4 position;
+void main()
+{
+ gl_Position = position;
+}
+