more tweaks to GTU-Famicom

This commit is contained in:
hunterk 2016-12-06 15:04:16 -06:00
parent c53288bb40
commit 9c99a6083c
6 changed files with 83 additions and 23 deletions

View file

@ -1,27 +1,27 @@
shaders = 5 shaders = 5
shader0 = shaders/gtu-famicom/DAC.slang shader0 = shaders/gtu-famicom/DAC_LUT.slang
scale_type_x0 = source scale_type_x0 = source
scale_x0 = 8.0 scale_x0 = 8.0
scale_type_y0 = source scale_type_y0 = source
scale_y0 = 1.0 scale_y0 = 1.0
float_framebuffer0 = true
filter_linear0 = false filter_linear0 = false
frame_count_mod0 = 2 frame_count_mod0 = 2
float_framebuffer0 = true
shader1 = shaders/gtu-famicom/lowPass.slang shader1 = shaders/gtu-famicom/lowPass.slang
scale_type_1 = source scale_type_1 = source
scale_1 = 1.0 scale_1 = 1.0
float_framebuffer1 = true
filter_linear1 = false filter_linear1 = false
frame_count_mod1 = 32 frame_count_mod1 = 32
float_framebuffer1 = true
shader2 = shaders/gtu-famicom/combFilter.slang shader2 = shaders/gtu-famicom/combFilter.slang
scale_type_2 = source scale_type_2 = source
scale_2 = 1.0 scale_2 = 1.0
float_framebuffer2 = true
filter_linear2 = false filter_linear2 = false
frame_count_mod2 = 2 frame_count_mod2 = 2
float_framebuffer2 = true
shader3 = shaders/gtu-famicom/scaleX.slang shader3 = shaders/gtu-famicom/scaleX.slang
scale_type_x3 = viewport scale_type_x3 = viewport
@ -36,5 +36,11 @@ scale_type_x4 = source
scale_x4 = 1.0 scale_x4 = 1.0
scale_type_y4 = viewport scale_type_y4 = viewport
scale_y4 = 1.0 scale_y4 = 1.0
float_framebuffer4 = true
filter_linear4 = false filter_linear4 = false
float_framebuffer4 = true
textures = nestable
nestable = shaders/gtu-famicom/NesTable.png
nestable_linear = false
nestable_mipmap = false
nestable_wrap_mode = clamp_to_border

View file

@ -0,0 +1,50 @@
#version 450
layout(std140, set = 0, binding = 0) uniform UBO
{
mat4 MVP;
vec4 OutputSize;
vec4 OriginalSize;
vec4 SourceSize;
uint FrameCount;
} global;
////////////////////////////////////////////////////////
// GTU-famicom version 0.50
// Author: aliaspider - aliaspider@gmail.com
// License: GPLv3
////////////////////////////////////////////////////////
#define GET_LEVEL(X) ((X)*(255.0f / (128.0f*(1.962f-.518f)))-(.518f / (1.962f-.518f)))
#pragma stage vertex
layout(location = 0) in vec4 Position;
layout(location = 1) in vec2 TexCoord;
layout(location = 0) out vec2 vTexCoord;
layout(location = 1) out float colorPhase;
void main()
{
gl_Position = global.MVP * Position;
vTexCoord = TexCoord;
vec2 pos = (vTexCoord.xy*global.OutputSize.xy)-0.5;
colorPhase = 8.0001 + pos.x + pos.y * 4.0001 + global.FrameCount * 4.0001;
}
#pragma stage fragment
layout(location = 0) in vec2 vTexCoord;
layout(location = 1) in float colorPhase;
layout(location = 0) out vec4 FragColor;
layout(set = 0, binding = 2) uniform sampler2D Source;
layout(set = 0, binding = 3) uniform sampler2D nestable;
void main()
{
vec4 c = texture(Source, vTexCoord.xy);
vec2 pixmapCoord;
pixmapCoord.x = c.x * (15.0 / (16.0 * 4.0)) + c.y * (3.0 / 4.0) +(0.5 / (16.0 * 4.0));
pixmapCoord.y = 1.0 - (floor(mod(colorPhase + 0.5, 12.0)) / (12.0 * 8.0) + c.z * (7.0 / 8.0) + (0.5 / (12.0 * 8.0)));
FragColor = vec4(GET_LEVEL(texture(nestable, pixmapCoord.xy).r));//vec4(signal);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 849 B

View file

@ -24,8 +24,6 @@ layout(std140, set = 0, binding = 0) uniform UBO
// License: GPLv3 // License: GPLv3
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////
//#include "config.h"
#define pi 3.14159265358 #define pi 3.14159265358
#pragma stage vertex #pragma stage vertex
@ -38,8 +36,8 @@ void main()
{ {
gl_Position = global.MVP * Position; gl_Position = global.MVP * Position;
vTexCoord = TexCoord; vTexCoord = TexCoord;
vec2 pos = (vTexCoord.xy*params.OutputSize.xy)-0.5; vec2 pos = (vTexCoord.xy * params.OutputSize.xy * params.SourceSize.xy * params.SourceSize.zw) - 0.5;
colorPhase = 8.0001 + pos.x + pos.y * 4.0001 + params.FrameCount * 4.0001 + 4.0001 + params.phaseOffset * 12.0001; colorPhase = 8.0 + pos.x + pos.y * 4.0 + params.FrameCount * 4.0 + 4.0 + params.phaseOffset * 12.0;
} }
#pragma stage fragment #pragma stage fragment
@ -56,18 +54,19 @@ void main()
if (params.combFilter > 0.0) if (params.combFilter > 0.0)
{ {
float prev6 = texture(Source, vTexCoord.xy - vec2(5.9999 * (params.OutputSize.z), 0.0)).r; float prev6 = texture(Source, vTexCoord.xy - vec2(6.0 * (params.OutputSize.x * params.SourceSize.x * params.SourceSize.z), 0.0)).r;
signal = (current + prev6) / 2.0001; signal = (current + prev6) / 2.0;
float chromaSignal = current - signal; float chromaSignal = current - signal;
I = chromaSignal * cos (colorPhase * (2.0001 * pi / 12.0001))*2.0001; I = chromaSignal * cos (colorPhase * (2.0 * pi / 12.0)) * 2.0;
Q = chromaSignal * sin (colorPhase * (2.0001 * pi / 12.0001))*2.0001; Q = chromaSignal * sin (colorPhase * (2.0 * pi / 12.0)) * 2.0;
} }
else else
{ {
signal = current; signal = current;
I = signal * cos (colorPhase * (2.0001 * pi / 12.0001))*2.0001; I = signal * cos (colorPhase * (2.0 * pi / 12.0))*2.0;
Q = signal * sin (colorPhase * (2.0001 * pi / 12.0001))*2.0001; Q = signal * sin (colorPhase * (2.0 * pi / 12.0))*2.0;
} }
FragColor = vec4(signal, I, Q, 1.0); FragColor = vec4(signal, I, Q, 1.0);
} }

View file

@ -37,7 +37,7 @@ layout(std140, set = 0, binding = 0) uniform UBO
#define S(i) (texture(Source, vec2(vTexCoord.x - X(i)/params.SourceSize.x,vTexCoord.y)).x) #define S(i) (texture(Source, vec2(vTexCoord.x - X(i)/params.SourceSize.x,vTexCoord.y)).x)
#define VAL(i) (S(i)*STU(X(i),(params.signalResolution * params.SourceSize.z))) #define VAL(i) (S(i)*STU(X(i),(params.signalResolution * params.SourceSize.z)))
float rand(vec2 co) float rand2(vec2 co)
{ {
float c = 43758.5453; float c = 43758.5453;
float dt= dot(co.xy ,vec2(12.9898,78.233)); float dt= dot(co.xy ,vec2(12.9898,78.233));
@ -45,6 +45,9 @@ float rand(vec2 co)
return fract(sin(sn) * c); return fract(sin(sn) * c);
} }
float rand(vec2 co){
return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);
}
#pragma stage vertex #pragma stage vertex
layout(location = 0) in vec4 Position; layout(location = 0) in vec4 Position;

View file

@ -28,7 +28,6 @@ layout(std140, set = 0, binding = 0) uniform UBO
// License: GPLv3 // License: GPLv3
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////
#define YIQ_to_RGB mat3x3( 1.0 , 1.0 , 1.0 , 0.9563 , -0.2721 , -1.1070 , 0.6210 , -0.6474 , 1.7046 )
#define pi 3.14159265358 #define pi 3.14159265358
float d(float x, float b){ float d(float x, float b){
@ -60,7 +59,8 @@ layout(set = 0, binding = 2) uniform sampler2D Source;
void main() void main()
{ {
float offset = fract((vTexCoord.x * params.SourceSize.x) - 0.5); float offset = fract((vTexCoord.x * params.SourceSize.x) - 0.5);
vec3 tempColor = vec3(0.0); vec3 YIQ = vec3(0.0);
vec3 RGB = vec3(0.0);
float X; float X;
vec3 c; vec3 c;
float Y = params.signalResolutionY * params.SourceSize.z; float Y = params.signalResolutionY * params.SourceSize.z;
@ -77,10 +77,12 @@ void main()
c.x *= ((d(X,Y) + sin(d(X,Y)) - e(X,Y) - sin(e(X,Y))) / (2.0 * pi)); c.x *= ((d(X,Y) + sin(d(X,Y)) - e(X,Y) - sin(e(X,Y))) / (2.0 * pi));
c.y *= ((d(X,I) + sin(d(X,I)) - e(X,I) - sin(e(X,I))) / (2.0 * pi)); c.y *= ((d(X,I) + sin(d(X,I)) - e(X,I) - sin(e(X,I))) / (2.0 * pi));
c.z *= ((d(X,Q) + sin(d(X,Q)) - e(X,Q) - sin(e(X,Q))) / (2.0 * pi)); c.z *= ((d(X,Q) + sin(d(X,Q)) - e(X,Q) - sin(e(X,Q))) / (2.0 * pi));
tempColor+=c; YIQ+=c;
} }
tempColor=clamp(YIQ_to_RGB * tempColor,0.0,1.0); RGB.r = YIQ.r + 0.956 * YIQ.g + 0.621 * YIQ.b;
RGB.g = YIQ.r - 0.272 * YIQ.g - 0.647 * YIQ.b;
FragColor = vec4(tempColor, 1.0); RGB.b = YIQ.r - 1.106 * YIQ.g + 1.703 * YIQ.b;
FragColor = vec4(clamp(RGB, 0.0, 1.0), 1.0);
} }