postprocessor for 3dlut colcorr; dithering should be managed in "dirty" way

dirty way: loads dithered/passthru shader according to the game's config (boolean fxdither)
This commit is contained in:
minjaesong
2017-11-02 17:47:52 +09:00
parent ce8f6bda75
commit 9aa4919bab
9 changed files with 158 additions and 35 deletions

View File

@@ -10,9 +10,9 @@ uniform sampler2D u_texture;
// "steps" of R, G and B. Must be integer && equal or greater than 2
uniform float rcount = 4.0;
uniform float gcount = 4.0;
uniform float bcount = 4.0;
uniform float rcount = 64.0;
uniform float gcount = 64.0;
uniform float bcount = 64.0;
uniform float acount = 1.0;
@@ -65,15 +65,9 @@ vec4 nearestColour(vec4 incolor) {
color.r = floor((rgbaCounts.r - 1.0) * color.r + 0.5) / (rgbaCounts.r - 1.0);
color.g = floor((rgbaCounts.g - 1.0) * color.g + 0.5) / (rgbaCounts.g - 1.0);
color.b = floor((rgbaCounts.b - 1.0) * color.b + 0.5) / (rgbaCounts.b - 1.0);
color.a = 1.0;//floor((rgbaCounts.a - 1.0) * color.a + 0.5) / (rgbaCounts.a - 1.0);
if (rgbaCounts.a >= 2.0) {
color.a = floor((rgbaCounts.a - 1.0) * color.a + 0.5) / (rgbaCounts.a - 1.0);
}
else {
color.a = 1.0;
}
return (color);
return color;
}
void main(void) {
@@ -87,4 +81,5 @@ void main(void) {
gl_FragColor = nearestColour(inColor + spread * (bayer[int(entry.y) * int(bayerSize) + int(entry.x)] / bayerDivider - 0.5));
//gl_FragColor = nearestColour(inColor);
//gl_FragColor = inColor;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

14
assets/passthru.frag Normal file
View File

@@ -0,0 +1,14 @@
#version 120
#ifdef GL_ES
precision mediump float;
#endif
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
void main(void) {
gl_FragColor = texture2D(u_texture, v_texCoords);
}

38
assets/skyboxfill.frag Normal file
View File

@@ -0,0 +1,38 @@
#version 120
#ifdef GL_ES
precision mediump float;
#endif
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
uniform vec3 topColor;
uniform vec3 bottomColor;
uniform float parallax = 0.0; // +1.0: all top col, -1.0: all bototm col, 0.0: normal grad
uniform float parallax_size = 1.0/3.0; // 0: no parallax
void main(void) {
float scale = v_texCoords.y * (1.0 - parallax_size) + (parallax_size / 2.0) + (parallax * parallax_size / 2.0);
float inR = mix(bottomColor.r, topColor.r, scale);
float inG = mix(bottomColor.g, topColor.g, scale);
float inB = mix(bottomColor.b, topColor.b, scale);
gl_FragColor = vec4(inR, inG, inB, 1.0);
}
/*
UV mapping coord.y
-+ <- 1.0 =
D| = // parallax of +1
i| = =
s| = // parallax of 0
p| = =
.| = // parallax of -1
-+ <- 0.0 =
*/