Dithering
This commit is contained in:
BIN
assets/gfx/bluem0ld-1x.png
Normal file
BIN
assets/gfx/bluem0ld-1x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 82 B |
BIN
assets/gfx/fiery-plague-gb-1x.png
Normal file
BIN
assets/gfx/fiery-plague-gb-1x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 82 B |
BIN
assets/gfx/look-of-horror-1x.png
Normal file
BIN
assets/gfx/look-of-horror-1x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 82 B |
@ -15,13 +15,25 @@ uniform vec4 colDiffuse;
|
||||
|
||||
out vec4 finalColor;
|
||||
|
||||
const int bayer16[16] = int[16](0, 8, 2, 10,
|
||||
12, 4, 14, 6,
|
||||
3, 11, 1, 9,
|
||||
15, 7, 13, 5);
|
||||
|
||||
|
||||
void main() {
|
||||
vec4 texelColor = texture(texture0, fragTexCoord);
|
||||
float grey = 0.21 * texelColor.r + 0.71 * texelColor.g + 0.07 * texelColor.b ;
|
||||
int col = int(mod(gl_FragCoord.x, 4));
|
||||
int row = int(mod(gl_FragCoord.y, 4));
|
||||
float threshold = float(bayer16[col + 4 * row]) / 16.0 - 0.5;
|
||||
grey = clamp(grey + threshold * 0.04 + 0.15 , 0.01, 0.99);
|
||||
|
||||
vec2 paluv = vec2(grey, 0.5);
|
||||
vec4 paletteValue = texture(texture1, paluv);
|
||||
|
||||
finalColor.a = 1.0;
|
||||
// finalColor.rgb = vec3(floor(grey * POSTERIZE) / POSTERIZE );
|
||||
|
||||
// finalColor.rgb = floor(texelColor.rgb * POSTERIZE) / POSTERIZE;
|
||||
|
||||
finalColor.rgb = paletteValue.rgb;
|
||||
|
Reference in New Issue
Block a user