Warpsharp Shader?

More
2 months 1 week ago - 2 months 1 week ago #1 by bugmenot
Warpsharp Shader? was created by bugmenot
Is there anyone whe ants to re-create the famous avisynth WarpSharp Shader for Reshade. Or is there a similar shader already existing?

I think, that Warpsharp would be a great addition for upscaled images especially when the ingame render resolution is lower than the output resolution:The basic "warp sharp" algorithmWarp sharp is the name of an algorithm that I originally found coded as a filter for an image editing application called "The GIMP." It's based on the idea that if you can identify the edges in an image, you can warp the image to shrink the edges and thus make them appear sharper. I don't remember how the original code worked, but here's one way to implement such an algorithm:
  • Convert the original channel to grayscale.
  • Compute a gradient map from the grayscale image. For each pixel in the original image, the gradient map encodes a vector that indicates the direction and rate of fastest ascent in luminance. The usual way to do this is through a pair of edge detection filters that compute horizontal and vertical gradient. In a 3x3 window, subtracting (right-left) and (bottom-top) is one way to do this. Sobel filters are also popular:-1 0 +1 -1 -2 -1
    -2 0 +2 0 0 0
    -1 0 +1 +1 +2 +1

    (Both filters can be computed together in 10 adds; how this is done is left as an exercise to the reader.)
  • Convert the gradient map to a bump map by taking the length of each gradient vector.
  • Optionally, apply a blur to the bump map.
  • Compute a second gradient map from the bump map.
  • Use the gradient map as a displacement map for warping the original image — that is, you use a scaled version of the gradient vector at each pixel to perturb the sampling location in the original image. In other words, given a gradient (du, dv), you retrieve (u+du*k, v+dv*k) from the source, where k is usually set such that the displacement is under a single pixel. I usually use a cardinal bicubic interpolator for the warp.

www.virtualdub.org/blog2/entry_079.html

Last edit: 2 months 1 week ago by bugmenot.

Please Log in or Create an account to join the conversation.

More
2 months 1 day ago - 2 months 1 day ago #2 by bugmenot
Replied by bugmenot on topic Warpsharp Shader?
I think this would be a great postprocessing alternative to FSR. Look at the edge of the nose. Warpsharp produces a completely sharp edge whereas other solutions suffer from blurred upscaling.
Last edit: 2 months 1 day ago by bugmenot.

Please Log in or Create an account to join the conversation.