A complete 3D game development suite written purely in Java.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
jmonkeyengine/jme3-effects/src/main/resources/Common/MatDefs/Post/Posterization15.frag

21 lines
540 B

#import "Common/ShaderLib/MultiSample.glsllib"
uniform COLORTEXTURE m_Texture;
in vec2 texCoord;
out vec4 fragColor;
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));
fragColor = mix(getColor(m_Texture, texCoord), texVal, m_Strength);
}