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

Upgrade FXAA #5200

Merged
merged 12 commits into from
Apr 13, 2017
Merged

Upgrade FXAA #5200

merged 12 commits into from
Apr 13, 2017

Conversation

bagnell
Copy link
Contributor

@bagnell bagnell commented Apr 11, 2017

Upgrades FXAA to version 3.11. Improves performance and visual quality for geometry. Slightly improves billboards, labels and imagery, but we'll still need a separate pass for better quality. Also, fixes #1921.

@pjcozzi pjcozzi mentioned this pull request Apr 11, 2017
53 tasks
@@ -50,6 +60,11 @@ define([
owner : this
});
this._clearCommand = clearCommand;

this._qualityPreset = 39;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these be packed into a vec4 or just constants in the shader?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made them shader comments. I wasn't sure if we would expose them. I'm leaving _qualityPreset which is a preprocessor constant because we may expose it or change it for mobile. The possible values are 10-15, 20-29 or 39 (Its documented in a shader comment).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, but did you forget a commit to remove the three properties below?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, thanks.

@pjcozzi
Copy link
Contributor

pjcozzi commented Apr 11, 2017

@abwood do you want to look at this?

@pjcozzi
Copy link
Contributor

pjcozzi commented Apr 11, 2017

@emackey do you want to do some before/after quality comparisons?

@pjcozzi
Copy link
Contributor

pjcozzi commented Apr 11, 2017

@bagnell do you have any meaningful before/after performance numbers? How much faster is this? Could be worth mentioning in CHANGES.md that visual quality and performance are slightly better.

this._command = context.createViewportQuadCommand(FXAAFS, {
var fs =
'#define FXAA_PC 1\n' +
'#define FXAA_WEBGL_1 1\n' +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there WebGL 2 optimizations that we should roadmap in #797? If so, please update that issue.

@@ -0,0 +1,2074 @@
/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is really long. Our build process will remove comments from release builds, but it will not remove all the versions of this shader that are pulled out at runtime by the preprocessor. I hate to bloat Cesium with that extra code and potentially slow down shader compile times.

Can we either

  • Add the preprocessor directives to this file and verify/change our build process to generate the smaller shader, or
  • Generate the smaller shader by hand.

In either case, please document how to upgrade this. A comment at the top of the file should be OK.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I stripped all of the unused shader code. There is a comment at the top that lists the steps. I added the original shader to Source/ThirdParty. It isn't included anywhere so it won't be part of the build, but I can remove it if necessary. There's also a link to the original in the trimmed version after the license.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just make this the file in the ThirdParty directory. Git history will have the original and this way we don't have any third-party code outside of the ThirdParty directory.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I move it out of the Shaders directory, it won't be part of the build. So it needs to stay there or I can modify the build to check the ThirdParty directory.

@pjcozzi
Copy link
Contributor

pjcozzi commented Apr 13, 2017

Does anyone else want to review this or test the visual quality before/after? You might not notice an improvement, we just don't want it to be worse in any case.

@mramato
Copy link
Contributor

mramato commented Apr 13, 2017

I actually did some informal testing yesterday and can confirm that it's no worse. It's not really much better either though, labels are a little crisper but so are orbit lines so it's kind of a trade off. I don't think the average person would notice a difference at all either way.

What I really want to see is New/Old/Off comparisons. Right now I lean towards shutting it off in my use cases because I think having good imagery/text/textures outweighs any jaggies but I'd like to confirm that. No need to hold up this PR though.

@emackey
Copy link
Contributor

emackey commented Apr 13, 2017

I saw some New/Old/Off comparisons on @bagnell's screen yesterday, and I agree with @mramato's assessment above.

@bagnell
Copy link
Contributor Author

bagnell commented Apr 13, 2017

For performance, I'm not seeing any difference in frame rate. I'm only seeing an increase of performance in the hundredths or milliseconds.

@bagnell
Copy link
Contributor Author

bagnell commented Apr 13, 2017

@pjcozzi This should be ready.

u_fxaaQualityRcpFrame : function() {
return rcpFrame;
},
u_fxaaQualitySubpix : function() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These three aren't used, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I forgot those as well. Removed.

@pjcozzi
Copy link
Contributor

pjcozzi commented Apr 13, 2017

Looks good. I also tested release.

@pjcozzi pjcozzi merged commit d6bc1ac into master Apr 13, 2017
@pjcozzi pjcozzi deleted the fxaa-upgrade branch April 13, 2017 21:49
@pjcozzi
Copy link
Contributor

pjcozzi commented Apr 13, 2017

Please merge this/master into 3d-tiles.

@sdegenaar
Copy link

Hi,
I did some testing as well and confirm the same as above. Its not worse, although I did not really notice an improve. I have a globe with data spikes and they still appear the same jaggered regardless of FXAA turned off or on. I can confirm though that transparency works with it now set to true, but unfortunately looks the same off or on.

@pjcozzi
Copy link
Contributor

pjcozzi commented Apr 14, 2017

Thanks for checking this out, @sdegenaar!

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

Successfully merging this pull request may close these issues.

Translucent appearances break transparent backgrounds.
5 participants