Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FXAA 3.11 in shaders menu #1879

Open
CaptTatsu opened this issue Oct 8, 2018 · 9 comments
Open

Add FXAA 3.11 in shaders menu #1879

CaptTatsu opened this issue Oct 8, 2018 · 9 comments

Comments

@CaptTatsu
Copy link

I just found out that the FXAA used by Optifine and me is kind of old. It creates noticeable artifacts at somewhat detailed texture in distance (i'll use Jappa's oak leaves as the example), and it only does a little bit of smoothing in near horizontal / vertical lines.
I tried using FXAA 3.11 and most of the issues above are resolved. However, it's obviously a bit more expensive and doesn't work in lower render quality (below 1x)
Here's the article which includes somewhat easy to implement FXAA 3.11 here.

Here's some comparison between old FXAA with FXAA 3.11 (using BSL)
Jappa's oak leaves
image
(left : old, right : 3.11, more noticeable in darker spots)

Near horizontal line
image
(top : old, bottom : 3.11)

@sp614x
Copy link
Owner

sp614x commented Oct 12, 2018

The FXAA configuration and shaders are in assets/minecraft/shaders/post and assets/minecraft/shaders/program in the OptiFine JAR (export to see the patched result). These can be customized with a resource pack.
If you make a resource pack that replaces one of the FXAAs with 3.11 it can be added to OptiFine.

@CaptTatsu
Copy link
Author

It seems that i can't do much due to the lack of bilinear filtering.
Here's the pack, it replaces FXAA 2x
FXAA 3.11.zip

@sp614x
Copy link
Owner

sp614x commented Oct 18, 2018

The 3.11 in the resource pack is correctly loaded, but it doesn't seem to work.
It was vertically mirrored in 1.13 (simple fix).

3.11 RP

image

current 2x

image

@CaptTatsu
Copy link
Author

CaptTatsu commented Oct 18, 2018

it was due to the lack of bilinear filtering
i tried to add one this time, but the anti aliasing only seem to show once i zoom in. otherwise it doesn't work.

1x zoom, no aa
2018-10-18_23 18 09

1x zoom, 3.11
2018-10-18_23 19 47

2x zoom, no aa
2018-10-18_23 21 30

2x zoom, aa
2018-10-18_23 21 24

this time it replaces super secret setting's fxaa(1.8.9, click the button twice), and 2x zoom is applied.
FXAA 3.11.zip

@sp614x
Copy link
Owner

sp614x commented Oct 18, 2018

Looks very smooth, but the zoom dependency is strange.

@CaptTatsu
Copy link
Author

CaptTatsu commented Oct 18, 2018

just found a fix for 1x zoom, turns out that i need to apply half a pixel coordinate shift. here's the result

no aa
2018-10-19_03 50 04

3.11
2018-10-19_03 50 08

no aa
2018-10-19_03 53 28

3.11
2018-10-19_03 53 33

now it replaces 2x again. i can't guarantee if it's artifact free
FXAA 3.11.zip

@sp614x
Copy link
Owner

sp614x commented Oct 19, 2018

The current 2x FXAA uses SubPixelShift in the .vsh:

    posPos.xy = texCoord.xy + (0.5/OutSize * vec2(0.5 - SubPixelShift));
    posPos.zw = texCoord.xy - (0.5/OutSize * vec2(0.5 + SubPixelShift));

@sp614x
Copy link
Owner

sp614x commented Oct 19, 2018

The last fxaa 3.11 works without zoom, but it has a lot of artifacts and can't be added like that:

fxaa 3.11

image

fxaa 4x

image

This looks like a problem with the subpixel accuracy, maybe SubPixelShift can fix it.

@sp614x sp614x added the todo label Oct 19, 2018
@sp614x
Copy link
Owner

sp614x commented Nov 8, 2018

@CaptTatsu can you fix the artifacts (subpixel shift)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants