summaryrefslogtreecommitdiffhomepage
path: root/shaders/glsl330/grayscale.fs
diff options
context:
space:
mode:
Diffstat (limited to 'shaders/glsl330/grayscale.fs')
-rw-r--r--shaders/glsl330/grayscale.fs20
1 files changed, 20 insertions, 0 deletions
diff --git a/shaders/glsl330/grayscale.fs b/shaders/glsl330/grayscale.fs
new file mode 100644
index 00000000..b3a695bf
--- /dev/null
+++ b/shaders/glsl330/grayscale.fs
@@ -0,0 +1,20 @@
+#version 330
+
+in vec2 fragTexCoord;
+
+out vec4 fragColor;
+
+uniform sampler2D texture0;
+uniform vec4 fragTintColor;
+
+// NOTE: Add here your custom variables
+
+void main()
+{
+ vec4 base = texture(texture0, fragTexCoord)*fragTintColor;
+
+ // Convert to grayscale using NTSC conversion weights
+ float gray = dot(base.rgb, vec3(0.299, 0.587, 0.114));
+
+ fragColor = vec4(gray, gray, gray, fragTintColor.a);
+} \ No newline at end of file