31 lines
733 B
GLSL
31 lines
733 B
GLSL
#version 330
|
|
|
|
// Input vertex attributes (from vertex shader)
|
|
in vec3 fragPosition;
|
|
in vec2 fragTexCoord;
|
|
in vec4 fragColor;
|
|
in vec3 fragNormal;
|
|
|
|
// Input uniform values
|
|
uniform sampler2D texture0;
|
|
uniform sampler2D texture1;
|
|
uniform vec4 colDiffuse;
|
|
|
|
#define POSTERIZE 5.0
|
|
|
|
out vec4 finalColor;
|
|
|
|
void main() {
|
|
vec4 texelColor = texture(texture0, fragTexCoord);
|
|
float grey = 0.21 * texelColor.r + 0.71 * texelColor.g + 0.07 * texelColor.b ;
|
|
vec2 paluv = vec2(grey, 0.5);
|
|
vec4 paletteValue = texture(texture1, paluv);
|
|
|
|
finalColor.a = 1.0;
|
|
// finalColor.rgb = floor(texelColor.rgb * POSTERIZE) / POSTERIZE;
|
|
|
|
finalColor.rgb = paletteValue.rgb;
|
|
//
|
|
// finalColor.rgb = vec3(mean) + paletteValue.rgb;
|
|
}
|