aboutsummaryrefslogtreecommitdiff
path: root/engine/src/core-effects/Common/MatDefs/Post/Posterization15.frag
diff options
context:
space:
mode:
Diffstat (limited to 'engine/src/core-effects/Common/MatDefs/Post/Posterization15.frag')
-rw-r--r--engine/src/core-effects/Common/MatDefs/Post/Posterization15.frag20
1 files changed, 20 insertions, 0 deletions
diff --git a/engine/src/core-effects/Common/MatDefs/Post/Posterization15.frag b/engine/src/core-effects/Common/MatDefs/Post/Posterization15.frag
new file mode 100644
index 0000000..f55ac5b
--- /dev/null
+++ b/engine/src/core-effects/Common/MatDefs/Post/Posterization15.frag
@@ -0,0 +1,20 @@
+#import "Common/ShaderLib/MultiSample.glsllib"
+
+uniform COLORTEXTURE m_Texture;
+in vec2 texCoord;
+
+uniform int m_NumColors;
+uniform float m_Gamma;
+uniform float m_Strength;
+
+void main() {
+ vec4 texVal = getColor(m_Texture, texCoord);
+
+ texVal = pow(texVal, vec4(m_Gamma));
+ texVal = texVal * m_NumColors;
+ texVal = floor(texVal);
+ texVal = texVal / m_NumColors;
+ texVal = pow(texVal, vec4(1.0/m_Gamma));
+
+ gl_FragColor = mix(getColor(m_Texture, texCoord), texVal, m_Strength);
+} \ No newline at end of file