summaryrefslogtreecommitdiff
path: root/shaders/humus-domino/1.shader_test
diff options
context:
space:
mode:
Diffstat (limited to 'shaders/humus-domino/1.shader_test')
-rw-r--r--shaders/humus-domino/1.shader_test93
1 files changed, 93 insertions, 0 deletions
diff --git a/shaders/humus-domino/1.shader_test b/shaders/humus-domino/1.shader_test
new file mode 100644
index 0000000..a80d525
--- /dev/null
+++ b/shaders/humus-domino/1.shader_test
@@ -0,0 +1,93 @@
+[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);
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+[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;
+}
+
+
+