Restricted shader processing to the game screen area, fixing blurry cutoff point

This commit is contained in:
Nuno Pereira 2022-12-19 22:15:13 +00:00
parent 210034a507
commit 362e35919a
2 changed files with 86 additions and 72 deletions

View file

@ -95,6 +95,8 @@ float intsmear(float x, float dx, float d, float coeffs[7])
void main() void main()
{ {
if(abs(vTexCoord.x - 0.5) < 0.5 && abs(vTexCoord.y - 0.5) < 0.5)
{
vec2 texelSize = global.SourceSize.zw; vec2 texelSize = global.SourceSize.zw;
/* float2 range = IN.video_size / (IN.output_size * IN.texture_size); */ /* float2 range = IN.video_size / (IN.output_size * IN.texture_size); */
vec2 range = global.SourceSize.zw / screen_scale; vec2 range = global.SourceSize.zw / screen_scale;
@ -137,4 +139,9 @@ void main()
averageColor = mat3(cred, cgreen, cblue) * averageColor; averageColor = mat3(cred, cgreen, cblue) * averageColor;
FragColor = vec4(pow(averageColor, vec3(1.0/outgamma)),0.0); FragColor = vec4(pow(averageColor, vec3(1.0/outgamma)),0.0);
}
else
{
FragColor = vec4(0.0);
}
} }

View file

@ -57,6 +57,8 @@ float intsmear(float x, float dx)
void main() void main()
{ {
if(abs(vTexCoord.x - 0.5) < 0.5 && abs(vTexCoord.y - 0.5) < 0.5)
{
vec2 texelSize = global.SourceSize.zw; vec2 texelSize = global.SourceSize.zw;
vec2 subtexelSize = texelSize / vec2(3.0,1.0); vec2 subtexelSize = texelSize / vec2(3.0,1.0);
vec2 range; vec2 range;
@ -94,4 +96,9 @@ void main()
averageColor += ((top - bordert.y) / totalArea) * topRightColor; averageColor += ((top - bordert.y) / totalArea) * topRightColor;
FragColor = pow(averageColor,vec4(1.0/global.gamma)); FragColor = pow(averageColor,vec4(1.0/global.gamma));
}
else
{
FragColor = vec4(0.0);
}
} }