#version 450 /////////////////////////////////////////////////////////////////////////// // // // LCD Shader v0.0.1 // // // // Copyright (C) 2013 Harlequin : unknown92835@gmail.com // // // // This program is free software: you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // // the Free Software Foundation, either version 3 of the License, or // // (at your option) any later version. // // // // This program is distributed in the hope that it will be useful, // // but WITHOUT ANY WARRANTY; without even the implied warranty of // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // GNU General Public License for more details. // // // // You should have received a copy of the GNU General Public License // // along with this program. If not, see . // // // /////////////////////////////////////////////////////////////////////////// layout(push_constant) uniform Push { vec4 SourceSize; vec4 OriginalSize; vec4 OutputSize; uint FrameCount; float LCD_blending, original_blending; } params; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //config // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //values related to color blending on the darkened vertical lines of the output image //contribution of LCD colors to the blended output, higher values apply more color - [0.0, 0.5] #pragma parameter LCD_blending "LCD Blending" 0.2 0.0 0.5 0.01 //contribution of the original input colors to the blended output, higher values apply more color - [0.0, 0.5] #pragma parameter original_blending "Original Blending" 0.2 0.0 0.5 0.01 #define LCD_blending params.LCD_blending #define original_blending params.original_blending layout(std140, set = 0, binding = 0) uniform UBO { mat4 MVP; } global; #pragma stage vertex //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //vertex shader // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// layout(location = 0) in vec4 Position; layout(location = 1) in vec2 TexCoord; layout(location = 0) out vec2 vTexCoord; layout(location = 1) out vec2 tex_coord_1; layout(location = 2) out vec2 tex_coord_2; layout(location = 3) out vec2 lower_bound; layout(location = 4) out vec2 upper_bound; void main() { gl_Position = global.MVP * Position; vTexCoord = TexCoord; vec2 texel = params.SourceSize.zw; //size of one texel tex_coord_1 = vTexCoord + vec2(0.0, texel.y); //down tex_coord_2 = vTexCoord + vec2(0.0, -texel.y); //up lower_bound = vec2(0.0); //lower texture bounds upper_bound = texel * (params.OutputSize.xy - 2.0); //upper texture bounds } #pragma stage fragment //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //fragment definitions // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #define epsilon 0.1 #define line_alpha 0.5 //arbitrary 0