Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ReShade.fxh"
- uniform bool aspect87 <
- ui_tooltip = "Leave aspect at 8:7 (for MM7 borders or square pixels)";
- > = 0;
- uniform bool sharper <
- ui_tooltip = "Sharper";
- > = 1;
- sampler2D buffer
- {
- Texture = ReShade::BackBufferTex;
- MinFilter = POINT;
- MagFilter = POINT;
- MipFilter = POINT;
- AddressU = Clamp;
- AddressV = Clamp;
- };
- float2 goodtobad (float2 pos)
- {
- float2 badpos;
- badpos.x = (343.0 + pos.x * 1234) / 1920.0;
- badpos.y = pos.y;
- return badpos;
- }
- float4 PS_BilinearMM9(float4 pos : SV_Position, float2 uv : TEXCOORD0) : SV_Target
- {
- // Input:
- // 256x224 scaled into 343 -> 1234 -> 343 (8:7) 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 (aspect87)
- {
- left = 343;
- middle = 1234;
- }
- if (fragment.x < left || fragment.x >= (left + middle))
- return tex2D(buffer, uv);
- // Our uv coords in the 256x224 buffer
- 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 = ppoffset * ppoffset * ppoffset * ppoffset * (ppoffset * (ppoffset * (-20.0 * ppoffset + float2(70.0, 70.0)) - float2(84.0, 84.0)) + float2(35.0, 35.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 BilinearMM9
- {
- pass BilinearMM9
- {
- VertexShader=PostProcessVS;
- PixelShader=PS_BilinearMM9;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement