Move towards pixel upscaling filter

This commit is contained in:
2025-11-25 11:04:06 +00:00
parent f5a972d9e2
commit c0cfadbdd3
13 changed files with 107 additions and 49 deletions
+21
View File
@@ -0,0 +1,21 @@
#version 450 core
in vec2 vTexPos;
out vec4 fColor;
layout (location = 0) uniform vec2 screensize;
layout(binding = 0) uniform sampler2D screenTexture;
float xoff = 2 / screensize.x;
float yoff = 2 / screensize.y;
vec3 f (float x, float y)
{ return texture(screenTexture, vTexPos + vec2(x*xoff,y*yoff)).xyz;
}
void main()
{
vec3 tl = f(-1, 1);
vec3 tt = f( 0, 1);
vec3 tr = f( 1, 1);
vec3 mr = f( 1, 0);
vec3 br = f( 1,-1);
if (tl == tt && tt == tr && tr == mr && mr == br)
{ fColor = vec4(tl,1);}
else {fColor = texture(screenTexture, vTexPos); }
}
+7
View File
@@ -0,0 +1,7 @@
#version 450 core
layout (std140, binding = 2) uniform PosTex { vec4 posTex[3]; };
out vec2 vTexPos;
void main() {
gl_Position = vec4(posTex[gl_VertexID].xy,0,1);
vTexPos = posTex[gl_VertexID].zw ;
}
-16
View File
@@ -1,16 +0,0 @@
#version 450 core
in vec3 vTexPos;
in vec3 vPos;
layout (location=0) out vec4 fCol;
layout (location=1) out vec4 fPos;
layout (location=2) out vec4 normal;
//layout (binding=0) uniform sampler2DArray tilesetSampler;
layout (binding=1) uniform sampler2D normalSampler;
void main()
{
//fCol = texture(tilesetSampler, vec3(0.3,0.1,0) + vTexPos);
fCol = vec4(0.2,0.3,0.6,1);
//fCol = vec4(0.6,0.4,0.3,1);
fPos = vec4(vPos,1);
normal = vec4(vec3(0.5) - texture(normalSampler,2*vTexPos.xy).xyz,0);
}
-12
View File
@@ -1,12 +0,0 @@
#version 450 core
layout (location = 0) in vec3 pos;
layout (location = 1) in vec3 texPos;
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
out vec3 vTexPos;
out vec3 vPos;
void main()
{
gl_Position = theMat * vec4(pos,1.0) ;
vTexPos = texPos;
vPos = pos;
}