Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ReShade.fxh"
- uniform bool sharper <
- ui_tooltip = "Sharper";
- > = 1;
- uniform bool aspect65 <
- ui_tooltip = "Leave aspect ratio at 6:5 to show full borders.";
- > = 0;
- sampler2D buffer
- {
- Texture = ReShade::BackBufferTex;
- MinFilter = POINT;
- MagFilter = POINT;
- MipFilter = POINT;
- AddressU = Clamp;
- AddressV = Clamp;
- };
- float2 goodtobad (float2 pos)
- {
- float2 badpos;
- badpos.x = (312.0 + pos.x * 1296) / 1920.0;
- badpos.y = pos.y;
- return badpos;
- }
- float4 PS_BilinearMM10(float4 pos : SV_Position, float2 uv : TEXCOORD0) : SV_Target
- {
- // Input:
- // 256x224 scaled into 312 -> 1296 -> 312 (6:5) in 1920x1080 buffer
- // Output:
- // 240 -> 1440 -> 240 (4/3) in 1920x1080 buffer
- float2 fragment = float2(1920, 1080) * uv;
- float2 samp;
- float left = 240;
- float middle = 1440;
- if (aspect65)
- {
- left = 312;
- middle = 1296;
- }
- if (fragment.x < left || fragment.x >= (left + middle))
- return tex2D(buffer, uv);
- samp.x = (fragment.x - left) / middle;
- samp.y = fragment.y / 1080.0;
- float2 ploc;
- ploc = samp * float2(256, 224);
- float2 ppoffset = (ploc - 0.5) - (floor(ploc - 0.5));
- // Centers of 4 sampled pixels
- float2 ul = ploc - ppoffset;
- float2 ur = float2(ul.x + 1.0, ul.y);
- float2 ll = float2(ul.x, ul.y + 1.0);
- float2 lr = float2(ul.x + 1.0, ul.y + 1.0);
- if (sharper)
- {
- ppoffset = clamp((ppoffset - 0.375) * 4.0, 0.0, 1.0);
- }
- ul /= float2(256, 224);
- ur /= float2(256, 224);
- ll /= float2(256, 224);
- lr /= float2(256, 224);
- float4 cul = tex2D(buffer, goodtobad(ul));
- float4 cur = tex2D(buffer, goodtobad(ur));
- float4 cll = tex2D(buffer, goodtobad(ll));
- float4 clr = tex2D(buffer, goodtobad(lr));
- return lerp(lerp(cul, cur, ppoffset.x), lerp(cll, clr, ppoffset.x), ppoffset.y);
- }
- technique BilinearMM10
- {
- pass BilinearMM10
- {
- VertexShader=PostProcessVS;
- PixelShader=PS_BilinearMM10;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement