Welcome, Guest.
Username: Password: Remember me

TOPIC: FXAA Supersampling Question!

FXAA Supersampling Question! 1 year 2 months ago #1

So I did some digging around while trying to find a way to cure some jaggies in some of my favourite games (the unfortunate few that don't have one of those nice new temporal aa solutions now-days). And found this:

From Marty Mcfly in a previous thread called "fxaa ultra quality":
Downsampling 4life!

FXAA can produce an extremely smooth image when running it internally with 2x screensize. ReShade allows it. If I run any game on 1920x1080 but use an internal resolution of all render target textures of 3840x2160, applying a strong FXAA, the resulting image is very smooth since the FXAA reliably finds all aliased edges but the rendering in higher resolution lowers the heavy blurring plus the linear filter applied also smoothens the image. You can almost fake true Downsampling results. I have to mention though that running any ReShade shader (especially big ones like the Framework or MasterEffect) with a globally higher resolution means quite a loss of fps so it's better to detach AA from it.

Now I find myself very interested in this method. What exactly should I be tweaking for this super-sample effect?
(EDIT: These lines seem to do nothing to the quality/no supersample)
Is it these lines in Util.h ?
Warning: Spoiler! [ Click to expand ]


Or is it something else?
What other shaders are also affected by this super sample tweak?

Thanks for checking this out :D
I'm always learning.
Last Edit: 1 year 2 months ago by Constantine PC.
The administrator has disabled public write access.
The following user(s) said Thank You: MaxG3D

FXAA Ultra Quality Questions 1 year 2 months ago #2

  • MaxG3D
  • MaxG3D's Avatar
  • Offline
  • Posts: 27
  • Thank you received: 2
Oh, hell yeah, would love to know that as well!
The administrator has disabled public write access.

FXAA Ultra Quality Questions 1 year 2 months ago #3

Me too, I'm really interested in how this looks. I cannot find out how to do it myself :(
I'm always learning.
The administrator has disabled public write access.

FXAA Ultra Quality Questions 1 year 2 months ago #4

  • JBeckman
  • JBeckman's Avatar
  • Offline
  • Posts: 180
  • Thank you received: 36
It's in SMAA.h and perhaps FXAA.h too. :)
(From forum.step-project.com/topic/2894-temporal-vs-edge-vs-smaa/ )

From SMAA.h:
* After this point you can choose to enable predicated thresholding,
* temporal supersampling and motion blur integration:

EDIT: Though I think it relies on the velocity buffer which ReShade does not support as far as I'm aware.
(Which is why SMAA T2X and the others are not available.)

Full text quote:
* After this point you can choose to enable predicated thresholding,
* temporal supersampling and motion blur integration:
*
* a) If you want to use predicated thresholding, take a look into
* SMAA_PREDICATION; you'll need to pass an extra texture in the edge
* detection pass.
*
* b) If you want to enable temporal supersampling (SMAA T2x):
*
* 1. The first step is to render using subpixel jitters. I won't go into
* detail, but it's as simple as moving each vertex position in the
* vertex shader, you can check how we do it in our DX10 demo.
*
* 2. Then, you must setup the temporal resolve. You may want to take a look
* into SMAAResolve for resolving 2x modes. After you get it working, you'll
* probably see ghosting everywhere. But fear not, you can enable the
* CryENGINE temporal reprojection by setting the SMAA_REPROJECTION macro.
* Check out SMAA_DECODE_VELOCITY if your velocity buffer is encoded.
*
* 3. The next step is to apply SMAA to each subpixel jittered frame, just as
* done for 1x.
*
* 4. At this point you should already have something usable, but for best
* results the proper area textures must be set depending on current jitter.
* For this, the parameter 'subsampleIndices' of
* 'SMAABlendingWeightCalculationPS' must be set as follows, for our T2x
* mode:
*
* @SUBSAMPLE_INDICES
*
* | S# | Camera Jitter | subsampleIndices |
* +----+
+
+
* | 0 | ( 0.25, -0.25) | float4(1, 1, 1, 0) |
* | 1 | (-0.25, 0.25) | float4(2, 2, 2, 0) |
*
* These jitter positions assume a bottom-to-top y axis. S# stands for the
* sample number.
*
* More information about temporal supersampling here:
* iryoku.com/aacourse/downloads/13-Anti-Al...s-in-CryENGINE-3.pdf
*
* c) If you want to enable spatial multisampling (SMAA S2x):
*
* 1. The scene must be rendered using MSAA 2x. The MSAA 2x buffer must be
* created with:
* - DX10: see below (*)
* - DX10.1: D3D10_STANDARD_MULTISAMPLE_PATTERN or
* - DX11: D3D11_STANDARD_MULTISAMPLE_PATTERN
*
* This allows to ensure that the subsample order matches the table in
* @SUBSAMPLE_INDICES.
*
* (*) In the case of DX10, we refer the reader to:
* - SMAA::detectMSAAOrder and
* - SMAA::msaaReorder
*
* These functions allow to match the standard multisample patterns by
* detecting the subsample order for a specific GPU, and reordering
* them appropriately.
*
* 2. A shader must be run to output each subsample into a separate buffer
* (DX10 is required). You can use SMAASeparate for this purpose, or just do
* it in an existing pass (for example, in the tone mapping pass, which has
* the advantage of feeding tone mapped subsamples to SMAA, which will yield
* better results).
*
* 3. The full SMAA 1x pipeline must be run for each separated buffer, storing
* the results in the final buffer. The second run should alpha blend with
* the existing final buffer using a blending factor of 0.5.
* 'subsampleIndices' must be adjusted as in the SMAA T2x case (see point
* b).
*
* d) If you want to enable temporal supersampling on top of SMAA S2x
* (which actually is SMAA 4x):
*
* 1. SMAA 4x consists on temporally jittering SMAA S2x, so the first step is
* to calculate SMAA S2x for current frame. In this case, 'subsampleIndices'
* must be set as follows:
*
* | F# | S# | Camera Jitter | Net Jitter | subsampleIndices |
* +----+----+
+
+
+
* | 0 | 0 | ( 0.125, 0.125) | ( 0.375, -0.125) | float4(5, 3, 1, 3) |
* | 0 | 1 | ( 0.125, 0.125) | (-0.125, 0.375) | float4(4, 6, 2, 3) |
* +----+----+
+
+
+
* | 1 | 2 | (-0.125, -0.125) | ( 0.125, -0.375) | float4(3, 5, 1, 4) |
* | 1 | 3 | (-0.125, -0.125) | (-0.375, 0.125) | float4(6, 4, 2, 4) |
*
* These jitter positions assume a bottom-to-top y axis. F# stands for the
* frame number. S# stands for the sample number.
*
* 2. After calculating SMAA S2x for current frame (with the new subsample
* indices), previous frame must be reprojected as in SMAA T2x mode (see
* point b).
*
* e) If motion blur is used, you may want to do the edge detection pass
* together with motion blur. This has two advantages:
*
* 1. Pixels under heavy motion can be omitted from the edge detection process.
* For these pixels we can just store "no edge", as motion blur will take
* care of them.
* 2. The center pixel tap is reused.
*
* Note that in this case depth testing should be used instead of stenciling,
* as we have to write all the pixels in the motion blur pass.
*
* That's it!
*/

(To avoid ghosting artifacts smaa reprojection is recommended which I think is what the velocity buffer would be needed for to work correctly.)
Last Edit: 1 year 2 months ago by JBeckman.
The administrator has disabled public write access.

FXAA Ultra Quality Questions 1 year 2 months ago #5

Any word on this yet?
I'm always learning.
The administrator has disabled public write access.

FXAA Ultra Quality Questions 1 year 2 months ago #6

  • roxahris
  • roxahris's Avatar
  • Offline
  • Refreshing yet disheartening bucket of water
  • Posts: 15
I'm not really sure how this would work any better than regular FXAA. In regular circumstances, FXAA has been noted (by the creator, most notably) to have issues dealing with surfaces that have already been blurred or smoothed beforehand, such as with linear filtering or regular multisample AA. It'll apply to "false edges" in the image, causing odd artefacts on edges, while ignoring places where aliasing visibly occurs. So if the image is blown up with linear filtering, sharp edges would become too smooth for it to detect. Meanwhile, if nearest filtering is applied, the doubling of the size between pixels would cause breaks in the line shapes the algorithm looks for.

Having said that, I'd be curious to see pictures of what it looks like - not to mention an idea of what settings one would need to change to get it searching properly. Oh, and "temporal supersampling" has nothing to do with this.
Last Edit: 1 year 2 months ago by roxahris.
The administrator has disabled public write access.

FXAA Ultra Quality Questions 1 year 2 months ago #7

  • Kleio420
  • Kleio420's Avatar
  • Offline
  • Posts: 224
  • Thank you received: 28
JBeckman wrote:
It's in SMAA.h and perhaps FXAA.h too. :)
(From forum.step-project.com/topic/2894-temporal-vs-edge-vs-smaa/ )

From SMAA.h:

this doesnt work currently with reshade , what marty was saying was when fxaa/smaa go to start up they grab the screen size idk why or what this does for either or but im sure either him or someone else could explain this better. Also fxaa does have a supersampling effect but its never been released to the public
The administrator has disabled public write access.

FXAA Ultra Quality Questions 1 year 2 months ago #8

  • JBeckman
  • JBeckman's Avatar
  • Offline
  • Posts: 180
  • Thank you received: 36
Ah so it's something different entirely, then I think I understand.
(Something like upscaling the shader or something in the shader to a higher resolution than what is being rendered I assume, trying to brute force it like downsampling to improve overall quality? But without the actual performance hit from render downsampling as it's only being done to the shader?)

EDIT: Then I guess it could potentially work for other shaders too such as improving the precision of ambient occlusion or depth of field but it might work better for shaders for removing aliasing, very interesting.
(And AO/DOF likely have a higher framerate impact too if you were to attempt this with those shaders.)
Last Edit: 1 year 2 months ago by JBeckman.
The administrator has disabled public write access.

FXAA Ultra Quality Questions 1 year 2 months ago #9

  • Kleio420
  • Kleio420's Avatar
  • Offline
  • Posts: 224
  • Thank you received: 28
JBeckman wrote:
Ah so it's something different entirely, then I think I understand.
(Something like upscaling the shader or something in the shader to a higher resolution than what is being rendered I assume, trying to brute force it like downsampling to improve overall quality? But without the actual performance hit from render downsampling as it's only being done to the shader?)

EDIT: Then I guess it could potentially work for other shaders too such as improving the precision of ambient occlusion or depth of field but it might work better for shaders for removing aliasing, very interesting.
(And AO/DOF likely have a higher framerate impact too if you were to attempt this with those shaders.)
im pretty sure most of the shaders already do that to help improve artifacting. Was just saying smaa tx2 and up modes dont currently work in reshade, fxaa 4.0(had a supersampling effect) but current nvidia driver fxaa does not feature this nor do i think they will ever include it kinda silly not to considering fallout 4 , and the witcher 3 use a similar method to fxaa 4.0 that cost almost nothing to run. To the op wanting to improve quality of fxaa theres a dime a dozen of methods out there its more of a finding someone willing to put in the effort of using whats good in one and in another then making a custom method for reshade only each post aa has their pro's and con's just like any shader , and i think if you need to "supersample" a post aa you should just save up buy a higher resolution monitor if you have the system power to go wasting on something like that
The administrator has disabled public write access.

FXAA Supersampling Question! 1 year 2 months ago #10

  • JPulowski
  • JPulowski's Avatar
  • Offline
  • Posts: 95
  • Thank you received: 87
It is basically supplying the anti-aliasing shader with a (interpolated/simulated) bigger sized data input, then scaling down the result to its original size. The interpolation algorithm that is used during resize is also quite important. For upscaling, nearest-neighbor (point) algorithm would work best, since it would not introduce blur to edges like linear interpolation does. Then you would just use linear interpolation for downscaling. But I am not sure how the result would look like.
The administrator has disabled public write access.

FXAA Ultra Quality Questions 1 year 2 months ago #11

Kleio420 wrote:
JBeckman wrote:
Ah so it's something different entirely, then I think I understand.
(Something like upscaling the shader or something in the shader to a higher resolution than what is being rendered I assume, trying to brute force it like downsampling to improve overall quality? But without the actual performance hit from render downsampling as it's only being done to the shader?)

EDIT: Then I guess it could potentially work for other shaders too such as improving the precision of ambient occlusion or depth of field but it might work better for shaders for removing aliasing, very interesting.
(And AO/DOF likely have a higher framerate impact too if you were to attempt this with those shaders.)
im pretty sure most of the shaders already do that to help improve artifacting. Was just saying smaa tx2 and up modes dont currently work in reshade, fxaa 4.0(had a supersampling effect) but current nvidia driver fxaa does not feature this nor do i think they will ever include it kinda silly not to considering fallout 4 , and the witcher 3 use a similar method to fxaa 4.0 that cost almost nothing to run. To the op wanting to improve quality of fxaa theres a dime a dozen of methods out there its more of a finding someone willing to put in the effort of using whats good in one and in another then making a custom method for reshade only each post aa has their pro's and con's just like any shader , and i think if you need to "supersample" a post aa you should just save up buy a higher resolution monitor if you have the system power to go wasting on something like that

I ended up using DSR...
It was more of a curiosity question anyways.
I'm always learning.
The administrator has disabled public write access.
The following user(s) said Thank You: Kleio420

FXAA Ultra Quality Questions 1 year 2 months ago #12

  • Kleio420
  • Kleio420's Avatar
  • Offline
  • Posts: 224
  • Thank you received: 28
Constantine PC wrote:
Kleio420 wrote:
JBeckman wrote:
Ah so it's something different entirely, then I think I understand.
(Something like upscaling the shader or something in the shader to a higher resolution than what is being rendered I assume, trying to brute force it like downsampling to improve overall quality? But without the actual performance hit from render downsampling as it's only being done to the shader?)

EDIT: Then I guess it could potentially work for other shaders too such as improving the precision of ambient occlusion or depth of field but it might work better for shaders for removing aliasing, very interesting.
(And AO/DOF likely have a higher framerate impact too if you were to attempt this with those shaders.)
im pretty sure most of the shaders already do that to help improve artifacting. Was just saying smaa tx2 and up modes dont currently work in reshade, fxaa 4.0(had a supersampling effect) but current nvidia driver fxaa does not feature this nor do i think they will ever include it kinda silly not to considering fallout 4 , and the witcher 3 use a similar method to fxaa 4.0 that cost almost nothing to run. To the op wanting to improve quality of fxaa theres a dime a dozen of methods out there its more of a finding someone willing to put in the effort of using whats good in one and in another then making a custom method for reshade only each post aa has their pro's and con's just like any shader , and i think if you need to "supersample" a post aa you should just save up buy a higher resolution monitor if you have the system power to go wasting on something like that

I ended up using DSR...
It was more of a curiosity question anyways.
dsr is nice on some games upgraded my monitor to 1440p so i dont use anything other then post aa
The administrator has disabled public write access.

FXAA Ultra Quality Questions 1 year 2 months ago #13

  • JBeckman
  • JBeckman's Avatar
  • Offline
  • Posts: 180
  • Thank you received: 36
Yeah DSR is a really good option for Nvidia GPU owners along with custom res settings, VSR from AMD however is a bit more static but by using custom resolutions I can downsample from 2880x1800 and 3360x2100 to 1920x1200 instead of "just" 2560x1600 to 1920x1200 unfortunately unless you have a GCN 1.2 GPU 3840x2400 or "4K" is impossible due to the way they've coded VSR.
(Still 2880 is a 50% increase and for performance reasons that and SMAA via ReShade is what I try to use in most games, works pretty well most of the time, for older games 3360x2100 with a 75% res increase over 1920x1200 is a good option as well but it's not usable in the newest games due to just how demanding those become when played at a very high resolution, 3840x2400 isn't viable at all outside of less advanced games or simply older games, sub-20 FPS most of the time whereas I try to at least stay over 30, preferably over 50.)
Last Edit: 1 year 2 months ago by JBeckman.
The administrator has disabled public write access.