diff options
Diffstat (limited to 'assets')
| -rw-r--r-- | assets/shaders/glsl330/color-depth.fs | 24 | ||||
| -rw-r--r-- | assets/shaders/glsl330/postprocessing.fs | 26 |
2 files changed, 26 insertions, 24 deletions
diff --git a/assets/shaders/glsl330/color-depth.fs b/assets/shaders/glsl330/color-depth.fs deleted file mode 100644 index c011df5..0000000 --- a/assets/shaders/glsl330/color-depth.fs +++ /dev/null @@ -1,24 +0,0 @@ -#version 330 - -in vec2 fragTexCoord; -in vec4 fragColor; - -uniform sampler2D texture0; -uniform vec4 colDiffuse; - -out vec4 finalColor; - -const int factor = 30; // x/255 - -void main() -{ - // Texel color fetching from texture sampler - vec4 texelColor = texture(texture0, fragTexCoord)*colDiffuse*fragColor; - - ivec4 color = ivec4(texelColor / factor * 255); - color *= factor; - - // Calculate final fragment color - finalColor = vec4(float(color.r) / 255, float(color.g) / 255, - float(color.b) / 255, texelColor.a); -}
\ No newline at end of file diff --git a/assets/shaders/glsl330/postprocessing.fs b/assets/shaders/glsl330/postprocessing.fs new file mode 100644 index 0000000..a2dcb17 --- /dev/null +++ b/assets/shaders/glsl330/postprocessing.fs @@ -0,0 +1,26 @@ +#version 330 + +in vec2 fragTexCoord; +in vec4 fragColor; + +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +out vec4 finalColor; + +float gamma = 0.6; +float numColors = 11.0; + +void main() +{ + // Texel color fetching from texture sampler + vec3 texelColor = texture(texture0, fragTexCoord.xy).rgb; + + texelColor = pow(texelColor, vec3(gamma, gamma, gamma)); + texelColor = texelColor*numColors; + texelColor = floor(texelColor); + texelColor = texelColor/numColors; + texelColor = pow(texelColor, vec3(1.0/gamma)); + + finalColor = vec4(texelColor, 1.0); +} |
