Warpsharp Shader?

  • bugmenot
  • Topic Author
More
2 years 9 months ago - 2 years 9 months 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 years 9 months ago by bugmenot.
The following user(s) said Thank You: Viper_Joe

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

  • bugmenot
  • Topic Author
More
2 years 9 months ago - 2 years 9 months 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 years 9 months ago by bugmenot.

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

  • rj200
More
2 years 5 months ago #3 by rj200 Replied by rj200 on topic Warpsharp Shader?
Hi, I thought that sounds intersting and not too complicated so I wrote one:

github.com/rj200/Glamarye_Fast_Effects_f...Shaders/warpsharp.fx

Let me know what you think.

Warp sharp is good for restoring clear edges (but not texture details) on images that have been blurred or upscaled.

It is not necessarily good for sharpening game output, as games have a mixture of very sharp edges of objects, and varying levels of blurrines in different textures. Warpsharp needs configuring with scale and strength and can't magically sharpen some areas and not others.
The following user(s) said Thank You: Viper_Joe

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

  • Tojkar
More
2 years 5 months ago #4 by Tojkar Replied by Tojkar on topic Warpsharp Shader?

It is not necessarily good for sharpening game output...

This is pretty much useless for sharpening for it's ugly output but I found plenty of other uses for it. Awesome effect overall! Although I hope that you keep developing it a bit further, maybe adding  a bit more control over it or having a bit better quality sample matrix or that ever that scale thing is called.

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

  • rj200
More
2 years 4 months ago #5 by rj200 Replied by rj200 on topic Warpsharp Shader?
I'm curious. What are you using it for? Artistic effect? Have you got some screenshots?

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

  • Tojkar
More
2 years 4 months ago - 2 years 4 months ago #6 by Tojkar Replied by Tojkar on topic Warpsharp Shader?

I'm curious. What are you using it for? Artistic effect? Have you got some screenshots?


 
I quickly cooked up something. Doesn't really make justice to the effect, but shows it clearly, if you know what you are looking for. Just in case you don't, all of the warping in the advertisement and character is from the shader. Of course, it's unplayable with that exaggerated settings but makes interesting screenshots and with well made masking and tame settings looks great in some games even in real time.
imgur.com/a/Wxy4S4o
Last edit: 2 years 4 months ago by Tojkar.
The following user(s) said Thank You: bugmenot, rj200

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

  • bugmenot
  • Topic Author
More
2 years 3 months ago #7 by bugmenot Replied by bugmenot on topic Warpsharp Shader?
Works perfect. Thank you so much!

[img

[img


 

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

We use cookies
We use cookies on our website. Some of them are essential for the operation of the forum. You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.