2018-08-27 05:31:48 +00:00
|
|
|
/* clang-format off */
|
2017-12-04 12:41:34 +00:00
|
|
|
[vertex]
|
|
|
|
|
2019-08-31 22:03:55 +00:00
|
|
|
#ifdef USE_GLES_OVER_GL
|
|
|
|
#define lowp
|
|
|
|
#define mediump
|
|
|
|
#define highp
|
|
|
|
#else
|
|
|
|
precision highp float;
|
|
|
|
precision highp int;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
attribute vec2 vertex_attrib; // attrib:0
|
2018-08-27 05:31:48 +00:00
|
|
|
/* clang-format on */
|
2019-08-31 22:03:55 +00:00
|
|
|
attribute vec2 uv_in; // attrib:4
|
2017-12-04 12:41:34 +00:00
|
|
|
|
2019-08-31 22:03:55 +00:00
|
|
|
varying vec2 uv_interp;
|
2017-12-04 12:41:34 +00:00
|
|
|
|
|
|
|
void main() {
|
2019-08-31 22:03:55 +00:00
|
|
|
gl_Position = vec4(vertex_attrib, 0.0, 1.0);
|
2017-12-04 12:41:34 +00:00
|
|
|
|
|
|
|
uv_interp = uv_in;
|
|
|
|
}
|
|
|
|
|
2018-08-27 05:31:48 +00:00
|
|
|
/* clang-format off */
|
2017-12-04 12:41:34 +00:00
|
|
|
[fragment]
|
|
|
|
|
2019-08-31 22:03:55 +00:00
|
|
|
|
|
|
|
// texture2DLodEXT and textureCubeLodEXT are fragment shader specific.
|
|
|
|
// Do not copy these defines in the vertex section.
|
|
|
|
#ifndef USE_GLES_OVER_GL
|
|
|
|
#ifdef GL_EXT_shader_texture_lod
|
|
|
|
#extension GL_EXT_shader_texture_lod : enable
|
|
|
|
#define texture2DLod(img, coord, lod) texture2DLodEXT(img, coord, lod)
|
|
|
|
#define textureCubeLod(img, coord, lod) textureCubeLodEXT(img, coord, lod)
|
2017-12-04 12:41:34 +00:00
|
|
|
#endif
|
2019-08-31 22:03:55 +00:00
|
|
|
#endif // !USE_GLES_OVER_GL
|
2017-12-04 12:41:34 +00:00
|
|
|
|
2019-08-31 22:03:55 +00:00
|
|
|
#ifdef GL_ARB_shader_texture_lod
|
|
|
|
#extension GL_ARB_shader_texture_lod : enable
|
|
|
|
#endif
|
2017-12-04 12:41:34 +00:00
|
|
|
|
2019-08-31 22:03:55 +00:00
|
|
|
#if !defined(GL_EXT_shader_texture_lod) && !defined(GL_ARB_shader_texture_lod)
|
|
|
|
#define texture2DLod(img, coord, lod) texture2D(img, coord, lod)
|
|
|
|
#define textureCubeLod(img, coord, lod) textureCube(img, coord, lod)
|
|
|
|
#endif
|
2017-12-04 12:41:34 +00:00
|
|
|
|
2019-08-31 22:03:55 +00:00
|
|
|
// Allows the use of bitshift operators for bicubic upscale
|
|
|
|
#ifdef GL_EXT_gpu_shader4
|
|
|
|
#extension GL_EXT_gpu_shader4 : enable
|
|
|
|
#endif
|
2017-12-04 12:41:34 +00:00
|
|
|
|
2019-08-31 22:03:55 +00:00
|
|
|
#ifdef USE_GLES_OVER_GL
|
|
|
|
#define lowp
|
|
|
|
#define mediump
|
|
|
|
#define highp
|
|
|
|
#else
|
|
|
|
#if defined(USE_HIGHP_PRECISION)
|
|
|
|
precision highp float;
|
|
|
|
precision highp int;
|
|
|
|
#else
|
|
|
|
precision mediump float;
|
|
|
|
precision mediump int;
|
|
|
|
#endif
|
|
|
|
#endif
|
2017-12-04 12:41:34 +00:00
|
|
|
|
2019-08-31 22:03:55 +00:00
|
|
|
#include "stdlib.glsl"
|
2017-12-04 12:41:34 +00:00
|
|
|
|
2019-08-31 22:03:55 +00:00
|
|
|
varying vec2 uv_interp;
|
|
|
|
/* clang-format on */
|
2017-12-04 12:41:34 +00:00
|
|
|
|
2019-08-31 22:03:55 +00:00
|
|
|
uniform highp sampler2D source; //texunit:0
|
2017-12-04 12:41:34 +00:00
|
|
|
|
2019-08-31 22:03:55 +00:00
|
|
|
#if defined(USE_GLOW_LEVEL1) || defined(USE_GLOW_LEVEL2) || defined(USE_GLOW_LEVEL3) || defined(USE_GLOW_LEVEL4) || defined(USE_GLOW_LEVEL5) || defined(USE_GLOW_LEVEL6) || defined(USE_GLOW_LEVEL7)
|
|
|
|
#define USING_GLOW // only use glow when at least one glow level is selected
|
|
|
|
|
|
|
|
#ifdef USE_MULTI_TEXTURE_GLOW
|
2020-10-01 05:28:20 +00:00
|
|
|
uniform highp sampler2D source_glow1; //texunit:2
|
|
|
|
uniform highp sampler2D source_glow2; //texunit:3
|
|
|
|
uniform highp sampler2D source_glow3; //texunit:4
|
|
|
|
uniform highp sampler2D source_glow4; //texunit:5
|
|
|
|
uniform highp sampler2D source_glow5; //texunit:6
|
|
|
|
uniform highp sampler2D source_glow6; //texunit:7
|
|
|
|
#ifdef USE_GLOW_LEVEL7
|
|
|
|
uniform highp sampler2D source_glow7; //texunit:8
|
|
|
|
#endif
|
2019-08-31 22:03:55 +00:00
|
|
|
#else
|
2020-10-01 05:28:20 +00:00
|
|
|
uniform highp sampler2D source_glow; //texunit:2
|
2019-08-31 22:03:55 +00:00
|
|
|
#endif
|
2017-12-04 12:41:34 +00:00
|
|
|
uniform highp float glow_intensity;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USE_BCS
|
|
|
|
uniform vec3 bcs;
|
|
|
|
#endif
|
|
|
|
|
2020-08-21 22:15:50 +00:00
|
|
|
#ifdef USE_FXAA
|
|
|
|
uniform vec2 pixel_size;
|
|
|
|
#endif
|
|
|
|
|
2021-03-27 17:58:12 +00:00
|
|
|
#ifdef USE_SHARPENING
|
|
|
|
uniform float sharpen_intensity;
|
|
|
|
#endif
|
|
|
|
|
2017-12-04 12:41:34 +00:00
|
|
|
#ifdef USE_COLOR_CORRECTION
|
2020-10-01 05:28:20 +00:00
|
|
|
uniform sampler2D color_correction; //texunit:1
|
2017-12-04 12:41:34 +00:00
|
|
|
#endif
|
|
|
|
|
2019-08-31 22:03:55 +00:00
|
|
|
#ifdef GL_EXT_gpu_shader4
|
2017-12-04 12:41:34 +00:00
|
|
|
#ifdef USE_GLOW_FILTER_BICUBIC
|
|
|
|
// w0, w1, w2, and w3 are the four cubic B-spline basis functions
|
2018-08-24 12:50:59 +00:00
|
|
|
float w0(float a) {
|
|
|
|
return (1.0 / 6.0) * (a * (a * (-a + 3.0) - 3.0) + 1.0);
|
2017-12-04 12:41:34 +00:00
|
|
|
}
|
|
|
|
|
2018-08-24 12:50:59 +00:00
|
|
|
float w1(float a) {
|
|
|
|
return (1.0 / 6.0) * (a * a * (3.0 * a - 6.0) + 4.0);
|
2017-12-04 12:41:34 +00:00
|
|
|
}
|
|
|
|
|
2018-08-24 12:50:59 +00:00
|
|
|
float w2(float a) {
|
|
|
|
return (1.0 / 6.0) * (a * (a * (-3.0 * a + 3.0) + 3.0) + 1.0);
|
2017-12-04 12:41:34 +00:00
|
|
|
}
|
|
|
|
|
2018-08-24 12:50:59 +00:00
|
|
|
float w3(float a) {
|
|
|
|
return (1.0 / 6.0) * (a * a * a);
|
2017-12-04 12:41:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// g0 and g1 are the two amplitude functions
|
2018-08-24 12:50:59 +00:00
|
|
|
float g0(float a) {
|
|
|
|
return w0(a) + w1(a);
|
2017-12-04 12:41:34 +00:00
|
|
|
}
|
|
|
|
|
2018-08-24 12:50:59 +00:00
|
|
|
float g1(float a) {
|
|
|
|
return w2(a) + w3(a);
|
2017-12-04 12:41:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// h0 and h1 are the two offset functions
|
2018-08-24 12:50:59 +00:00
|
|
|
float h0(float a) {
|
|
|
|
return -1.0 + w1(a) / (w0(a) + w1(a));
|
2017-12-04 12:41:34 +00:00
|
|
|
}
|
|
|
|
|
2018-08-24 12:50:59 +00:00
|
|
|
float h1(float a) {
|
|
|
|
return 1.0 + w3(a) / (w2(a) + w3(a));
|
2017-12-04 12:41:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uniform ivec2 glow_texture_size;
|
|
|
|
|
2018-08-24 12:50:59 +00:00
|
|
|
vec4 texture2D_bicubic(sampler2D tex, vec2 uv, int p_lod) {
|
|
|
|
float lod = float(p_lod);
|
2017-12-04 12:41:34 +00:00
|
|
|
vec2 tex_size = vec2(glow_texture_size >> p_lod);
|
2020-08-21 22:15:50 +00:00
|
|
|
vec2 texel_size = vec2(1.0) / tex_size;
|
2019-08-31 22:03:55 +00:00
|
|
|
|
|
|
|
uv = uv * tex_size + vec2(0.5);
|
|
|
|
|
2018-08-24 12:50:59 +00:00
|
|
|
vec2 iuv = floor(uv);
|
|
|
|
vec2 fuv = fract(uv);
|
2017-12-04 12:41:34 +00:00
|
|
|
|
|
|
|
float g0x = g0(fuv.x);
|
|
|
|
float g1x = g1(fuv.x);
|
|
|
|
float h0x = h0(fuv.x);
|
|
|
|
float h1x = h1(fuv.x);
|
|
|
|
float h0y = h0(fuv.y);
|
|
|
|
float h1y = h1(fuv.y);
|
|
|
|
|
2020-08-21 22:15:50 +00:00
|
|
|
vec2 p0 = (vec2(iuv.x + h0x, iuv.y + h0y) - vec2(0.5)) * texel_size;
|
|
|
|
vec2 p1 = (vec2(iuv.x + h1x, iuv.y + h0y) - vec2(0.5)) * texel_size;
|
|
|
|
vec2 p2 = (vec2(iuv.x + h0x, iuv.y + h1y) - vec2(0.5)) * texel_size;
|
|
|
|
vec2 p3 = (vec2(iuv.x + h1x, iuv.y + h1y) - vec2(0.5)) * texel_size;
|
2017-12-04 12:41:34 +00:00
|
|
|
|
2019-08-31 22:03:55 +00:00
|
|
|
return (g0(fuv.y) * (g0x * texture2DLod(tex, p0, lod) + g1x * texture2DLod(tex, p1, lod))) +
|
2021-10-28 11:23:24 +00:00
|
|
|
(g1(fuv.y) * (g0x * texture2DLod(tex, p2, lod) + g1x * texture2DLod(tex, p3, lod)));
|
2017-12-04 12:41:34 +00:00
|
|
|
}
|
|
|
|
|
2018-08-24 12:50:59 +00:00
|
|
|
#define GLOW_TEXTURE_SAMPLE(m_tex, m_uv, m_lod) texture2D_bicubic(m_tex, m_uv, m_lod)
|
2019-08-31 22:03:55 +00:00
|
|
|
#else //!USE_GLOW_FILTER_BICUBIC
|
|
|
|
#define GLOW_TEXTURE_SAMPLE(m_tex, m_uv, m_lod) texture2DLod(m_tex, m_uv, float(m_lod))
|
|
|
|
#endif //USE_GLOW_FILTER_BICUBIC
|
2017-12-04 12:41:34 +00:00
|
|
|
|
2019-08-31 22:03:55 +00:00
|
|
|
#else //!GL_EXT_gpu_shader4
|
|
|
|
#define GLOW_TEXTURE_SAMPLE(m_tex, m_uv, m_lod) texture2DLod(m_tex, m_uv, float(m_lod))
|
|
|
|
#endif //GL_EXT_gpu_shader4
|
2017-12-04 12:41:34 +00:00
|
|
|
|
2021-11-04 03:59:33 +00:00
|
|
|
vec4 apply_glow(vec4 color, vec3 glow) { // apply glow using the selected blending mode
|
2019-08-31 22:03:55 +00:00
|
|
|
#ifdef USE_GLOW_REPLACE
|
2021-11-04 03:59:33 +00:00
|
|
|
color.rgb = glow;
|
2019-08-31 22:03:55 +00:00
|
|
|
#endif
|
2017-12-04 12:41:34 +00:00
|
|
|
|
2019-08-31 22:03:55 +00:00
|
|
|
#ifdef USE_GLOW_SCREEN
|
2021-11-04 03:59:33 +00:00
|
|
|
color.rgb = max((color.rgb + glow) - (color.rgb * glow), vec3(0.0));
|
2017-12-04 12:41:34 +00:00
|
|
|
#endif
|
|
|
|
|
2019-08-31 22:03:55 +00:00
|
|
|
#ifdef USE_GLOW_SOFTLIGHT
|
|
|
|
glow = glow * vec3(0.5) + vec3(0.5);
|
2017-12-04 12:41:34 +00:00
|
|
|
|
2019-08-31 22:03:55 +00:00
|
|
|
color.r = (glow.r <= 0.5) ? (color.r - (1.0 - 2.0 * glow.r) * color.r * (1.0 - color.r)) : (((glow.r > 0.5) && (color.r <= 0.25)) ? (color.r + (2.0 * glow.r - 1.0) * (4.0 * color.r * (4.0 * color.r + 1.0) * (color.r - 1.0) + 7.0 * color.r)) : (color.r + (2.0 * glow.r - 1.0) * (sqrt(color.r) - color.r)));
|
|
|
|
color.g = (glow.g <= 0.5) ? (color.g - (1.0 - 2.0 * glow.g) * color.g * (1.0 - color.g)) : (((glow.g > 0.5) && (color.g <= 0.25)) ? (color.g + (2.0 * glow.g - 1.0) * (4.0 * color.g * (4.0 * color.g + 1.0) * (color.g - 1.0) + 7.0 * color.g)) : (color.g + (2.0 * glow.g - 1.0) * (sqrt(color.g) - color.g)));
|
|
|
|
color.b = (glow.b <= 0.5) ? (color.b - (1.0 - 2.0 * glow.b) * color.b * (1.0 - color.b)) : (((glow.b > 0.5) && (color.b <= 0.25)) ? (color.b + (2.0 * glow.b - 1.0) * (4.0 * color.b * (4.0 * color.b + 1.0) * (color.b - 1.0) + 7.0 * color.b)) : (color.b + (2.0 * glow.b - 1.0) * (sqrt(color.b) - color.b)));
|
|
|
|
#endif
|
2017-12-04 12:41:34 +00:00
|
|
|
|
2019-08-31 22:03:55 +00:00
|
|
|
#if !defined(USE_GLOW_SCREEN) && !defined(USE_GLOW_SOFTLIGHT) && !defined(USE_GLOW_REPLACE) // no other selected -> additive
|
2021-11-04 03:59:33 +00:00
|
|
|
color.rgb += glow;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef USE_GLOW_SOFTLIGHT // softlight has no effect on black color
|
|
|
|
// compute the alpha from glow
|
|
|
|
float a = max(max(glow.r, glow.g), glow.b);
|
|
|
|
color.a = a + color.a * (1 - a);
|
|
|
|
if (color.a == 0.0) {
|
|
|
|
color.rgb = vec3(0.0);
|
|
|
|
} else if (color.a < 1.0) {
|
|
|
|
color.rgb /= color.a;
|
|
|
|
}
|
2019-08-31 22:03:55 +00:00
|
|
|
#endif
|
2017-12-04 12:41:34 +00:00
|
|
|
|
2019-08-31 22:03:55 +00:00
|
|
|
return color;
|
2017-12-04 12:41:34 +00:00
|
|
|
}
|
|
|
|
|
2019-08-31 22:03:55 +00:00
|
|
|
vec3 apply_bcs(vec3 color, vec3 bcs) {
|
|
|
|
color = mix(vec3(0.0), color, bcs.x);
|
|
|
|
color = mix(vec3(0.5), color, bcs.y);
|
|
|
|
color = mix(vec3(dot(vec3(1.0), color) * 0.33333), color, bcs.z);
|
|
|
|
|
|
|
|
return color;
|
2017-12-04 12:41:34 +00:00
|
|
|
}
|
|
|
|
|
2019-08-31 22:03:55 +00:00
|
|
|
vec3 apply_color_correction(vec3 color, sampler2D correction_tex) {
|
|
|
|
color.r = texture2D(correction_tex, vec2(color.r, 0.0)).r;
|
|
|
|
color.g = texture2D(correction_tex, vec2(color.g, 0.0)).g;
|
|
|
|
color.b = texture2D(correction_tex, vec2(color.b, 0.0)).b;
|
2017-12-04 12:41:34 +00:00
|
|
|
|
2019-08-31 22:03:55 +00:00
|
|
|
return color;
|
2017-12-04 12:41:34 +00:00
|
|
|
}
|
|
|
|
|
2021-11-04 03:59:33 +00:00
|
|
|
vec4 apply_fxaa(vec4 color, vec2 uv_interp, vec2 pixel_size) {
|
2020-08-21 22:15:50 +00:00
|
|
|
const float FXAA_REDUCE_MIN = (1.0 / 128.0);
|
|
|
|
const float FXAA_REDUCE_MUL = (1.0 / 8.0);
|
|
|
|
const float FXAA_SPAN_MAX = 8.0;
|
|
|
|
|
2021-11-04 03:59:33 +00:00
|
|
|
vec4 rgbNW = texture2DLod(source, uv_interp + vec2(-1.0, -1.0) * pixel_size, 0.0);
|
|
|
|
vec4 rgbNE = texture2DLod(source, uv_interp + vec2(1.0, -1.0) * pixel_size, 0.0);
|
|
|
|
vec4 rgbSW = texture2DLod(source, uv_interp + vec2(-1.0, 1.0) * pixel_size, 0.0);
|
|
|
|
vec4 rgbSE = texture2DLod(source, uv_interp + vec2(1.0, 1.0) * pixel_size, 0.0);
|
|
|
|
vec3 rgbM = color.rgb;
|
2020-08-21 22:15:50 +00:00
|
|
|
vec3 luma = vec3(0.299, 0.587, 0.114);
|
2021-11-04 03:59:33 +00:00
|
|
|
float lumaNW = dot(rgbNW.rgb, luma) - ((1 - rgbNW.a) / 8.0);
|
|
|
|
float lumaNE = dot(rgbNE.rgb, luma) - ((1 - rgbNE.a) / 8.0);
|
|
|
|
float lumaSW = dot(rgbSW.rgb, luma) - ((1 - rgbSW.a) / 8.0);
|
|
|
|
float lumaSE = dot(rgbSE.rgb, luma) - ((1 - rgbSE.a) / 8.0);
|
|
|
|
float lumaM = dot(rgbM, luma) - (color.a / 8.0);
|
2020-08-21 22:15:50 +00:00
|
|
|
float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));
|
|
|
|
float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));
|
|
|
|
|
|
|
|
vec2 dir;
|
|
|
|
dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));
|
|
|
|
dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));
|
|
|
|
|
|
|
|
float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *
|
2021-10-28 11:23:24 +00:00
|
|
|
(0.25 * FXAA_REDUCE_MUL),
|
2020-08-21 22:15:50 +00:00
|
|
|
FXAA_REDUCE_MIN);
|
|
|
|
|
|
|
|
float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);
|
|
|
|
dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),
|
|
|
|
max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),
|
|
|
|
dir * rcpDirMin)) *
|
2021-10-28 11:23:24 +00:00
|
|
|
pixel_size;
|
2020-08-21 22:15:50 +00:00
|
|
|
|
2021-11-04 03:59:33 +00:00
|
|
|
vec4 rgbA = 0.5 * (texture2DLod(source, uv_interp + dir * (1.0 / 3.0 - 0.5), 0.0) + texture2DLod(source, uv_interp + dir * (2.0 / 3.0 - 0.5), 0.0));
|
|
|
|
vec4 rgbB = rgbA * 0.5 + 0.25 * (texture2DLod(source, uv_interp + dir * -0.5, 0.0) + texture2DLod(source, uv_interp + dir * 0.5, 0.0));
|
2020-08-21 22:15:50 +00:00
|
|
|
|
2021-11-04 03:59:33 +00:00
|
|
|
float lumaB = dot(rgbB.rgb, luma) - ((1 - rgbB.a) / 8.0);
|
|
|
|
vec4 color_output = ((lumaB < lumaMin) || (lumaB > lumaMax)) ? rgbA : rgbB;
|
|
|
|
if (color_output.a == 0.0) {
|
|
|
|
color_output.rgb = vec3(0.0);
|
|
|
|
} else if (color_output.a < 1.0) {
|
|
|
|
color_output.rgb /= color_output.a;
|
2020-08-21 22:15:50 +00:00
|
|
|
}
|
2021-11-04 03:59:33 +00:00
|
|
|
return color_output;
|
2020-08-21 22:15:50 +00:00
|
|
|
}
|
|
|
|
|
2017-12-04 12:41:34 +00:00
|
|
|
void main() {
|
2021-11-04 03:59:33 +00:00
|
|
|
vec4 color = texture2DLod(source, uv_interp, 0.0);
|
2017-12-04 12:41:34 +00:00
|
|
|
|
2020-08-21 22:15:50 +00:00
|
|
|
#ifdef USE_FXAA
|
|
|
|
color = apply_fxaa(color, uv_interp, pixel_size);
|
|
|
|
#endif
|
|
|
|
|
2019-08-31 22:03:55 +00:00
|
|
|
// Glow
|
2017-12-04 12:41:34 +00:00
|
|
|
|
2019-08-31 22:03:55 +00:00
|
|
|
#ifdef USING_GLOW
|
|
|
|
vec3 glow = vec3(0.0);
|
|
|
|
#ifdef USE_MULTI_TEXTURE_GLOW
|
|
|
|
#ifdef USE_GLOW_LEVEL1
|
|
|
|
glow += GLOW_TEXTURE_SAMPLE(source_glow1, uv_interp, 0).rgb;
|
|
|
|
#ifdef USE_GLOW_LEVEL2
|
|
|
|
glow += GLOW_TEXTURE_SAMPLE(source_glow2, uv_interp, 0).rgb;
|
|
|
|
#ifdef USE_GLOW_LEVEL3
|
|
|
|
glow += GLOW_TEXTURE_SAMPLE(source_glow3, uv_interp, 0).rgb;
|
|
|
|
#ifdef USE_GLOW_LEVEL4
|
|
|
|
glow += GLOW_TEXTURE_SAMPLE(source_glow4, uv_interp, 0).rgb;
|
|
|
|
#ifdef USE_GLOW_LEVEL5
|
|
|
|
glow += GLOW_TEXTURE_SAMPLE(source_glow5, uv_interp, 0).rgb;
|
|
|
|
#ifdef USE_GLOW_LEVEL6
|
|
|
|
glow += GLOW_TEXTURE_SAMPLE(source_glow6, uv_interp, 0).rgb;
|
|
|
|
#ifdef USE_GLOW_LEVEL7
|
|
|
|
glow += GLOW_TEXTURE_SAMPLE(source_glow7, uv_interp, 0).rgb;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
2017-12-04 12:41:34 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2019-08-31 22:03:55 +00:00
|
|
|
#else
|
2017-12-04 12:41:34 +00:00
|
|
|
|
|
|
|
#ifdef USE_GLOW_LEVEL1
|
2018-08-24 12:50:59 +00:00
|
|
|
glow += GLOW_TEXTURE_SAMPLE(source_glow, uv_interp, 1).rgb;
|
2017-12-04 12:41:34 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USE_GLOW_LEVEL2
|
2018-08-24 12:50:59 +00:00
|
|
|
glow += GLOW_TEXTURE_SAMPLE(source_glow, uv_interp, 2).rgb;
|
2017-12-04 12:41:34 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USE_GLOW_LEVEL3
|
2018-08-24 12:50:59 +00:00
|
|
|
glow += GLOW_TEXTURE_SAMPLE(source_glow, uv_interp, 3).rgb;
|
2017-12-04 12:41:34 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USE_GLOW_LEVEL4
|
2018-08-24 12:50:59 +00:00
|
|
|
glow += GLOW_TEXTURE_SAMPLE(source_glow, uv_interp, 4).rgb;
|
2017-12-04 12:41:34 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USE_GLOW_LEVEL5
|
2018-08-24 12:50:59 +00:00
|
|
|
glow += GLOW_TEXTURE_SAMPLE(source_glow, uv_interp, 5).rgb;
|
2017-12-04 12:41:34 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USE_GLOW_LEVEL6
|
2018-08-24 12:50:59 +00:00
|
|
|
glow += GLOW_TEXTURE_SAMPLE(source_glow, uv_interp, 6).rgb;
|
2017-12-04 12:41:34 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USE_GLOW_LEVEL7
|
2018-08-24 12:50:59 +00:00
|
|
|
glow += GLOW_TEXTURE_SAMPLE(source_glow, uv_interp, 7).rgb;
|
2017-12-04 12:41:34 +00:00
|
|
|
#endif
|
2019-08-31 22:03:55 +00:00
|
|
|
#endif //USE_MULTI_TEXTURE_GLOW
|
2017-12-04 12:41:34 +00:00
|
|
|
|
|
|
|
glow *= glow_intensity;
|
2019-08-31 22:03:55 +00:00
|
|
|
color = apply_glow(color, glow);
|
2017-12-04 12:41:34 +00:00
|
|
|
#endif
|
|
|
|
|
2019-08-31 22:03:55 +00:00
|
|
|
// Additional effects
|
2017-12-04 12:41:34 +00:00
|
|
|
|
|
|
|
#ifdef USE_BCS
|
2021-11-04 03:59:33 +00:00
|
|
|
color.rgb = apply_bcs(color.rgb, bcs);
|
2017-12-04 12:41:34 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USE_COLOR_CORRECTION
|
2021-11-04 03:59:33 +00:00
|
|
|
color.rgb = apply_color_correction(color.rgb, color_correction);
|
2017-12-04 12:41:34 +00:00
|
|
|
#endif
|
|
|
|
|
2021-11-04 03:59:33 +00:00
|
|
|
gl_FragColor = color;
|
2017-12-04 12:41:34 +00:00
|
|
|
}
|