Welcome, Guest. |

## TOPIC: Bilinear Interpolation for reshade

## Bilinear Interpolation for reshade 3 years 1 week ago #1

- qdclonman
- Offline
| Hi everyone，I found Bilinear Interpolation shader code，but I can't make this working for reshade，anyone can made this？？？？？ Code: /* Copyright (c) 2013 James Slepicka Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ Texture2D tex; SamplerState sam_linear { Filter = MIN_MAG_MIP_LINEAR; AddressU = Clamp; AddressV = Clamp; }; matrix world; matrix view; matrix proj; float2 tex_size; float2 input_size; float2 output_size; float sharpness = 1.0; struct VS_INPUT { float4 pos : POSITION; float2 tex : TEXCOORD0; }; struct PS_INPUT { float4 pos : SV_POSITION; float2 tex : TEXCOORD0; }; PS_INPUT VS (VS_INPUT input) { PS_INPUT output = (PS_INPUT)0; output.pos = mul (input.pos, world); output.pos = mul (output.pos, view); output.pos = mul (output.pos, proj); output.tex = input.tex; return output; } float4 PS (PS_INPUT input) : SV_Target { float2 scale = output_size / input_size; float2 interp = saturate((scale - lerp(scale, 1.0, sharpness))/(scale * 2.0)); float2 p = input.tex.xy * tex_size + .5; float2 i = floor(p); float2 f = p - i; f = saturate((f - interp) / (1.0 - interp * 2.0)); p = ((i + f) - .5) / tex_size; float4 r = tex.Sample(sam_linear, p); r.a = 1.0; return r; } technique10 render { pass P0 { SetVertexShader(CompileShader(vs_4_0, VS())); SetGeometryShader(NULL); SetPixelShader(CompileShader(ps_4_0, PS())); } } |

Last Edit: 3 years 1 week ago by qdclonman. The administrator has disabled public write access. |

## Bilinear Interpolation for reshade 3 years 1 week ago #2

- qdclonman
- Offline
| UP |

The administrator has disabled public write access. |

## Bilinear Interpolation for reshade 3 years 1 week ago #3

- Marty McFly
- Offline
| Bilinear interpolation is hardware supported, no need for any custom shadercode. It's what ReShade does when sampling any texture, if specified in the sampler. There is no use of this code as is, it just modifies the default algorithm slightly. For any application where e.g. the quality of an upscaled image is important, one uses bicubic or other functions. |

Last Edit: 3 years 1 week ago by Marty McFly. The administrator has disabled public write access. |