-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Poor billboard quality #4235
Comments
I believe this happens because billboards are not aligned to the nearest pixel. When a billboard has a non-integer screen location, it becomes blurred by the fullscreen AA process. There's a suggested fix on Stack Overflow that involves making a one-line change to BillboardCollectionVS.glsl#L245, to change it from:
to:
This has the effect of greatly reducing blur on both Billboards and Labels. What do you guys think of this? If you like it, I can make a pull request out of it (assuming we can take code from SO. I presume most projects already have quite a bit of uncredited SO code around). The reasoning seems clear: Billboards are always raster images, so non-integer screen locations will always be worse quality than pixel-aligned locations. |
Ah cool, can you post a screenshot of the difference? |
The Stack Overflow answer has a good screenshot: http://stackoverflow.com/questions/33784256/cesium-label-blurred/33786151#33786151 |
Good memory @shunter. In experimenting with this code, it looks like the clamp-to-pixel is not what's actually improving this guy's screenshots. He's also turning off |
Yeah, fxaa is probably the real culprit here. Clamping to pixel actually does not do what we would hope it would do (Especially with text). It also causes all kinds of problem when during motion (either because the item is moving or the camera is moving). Not clamping really is the "correct" option. I asked Dan about possibly not running fxaa on labels and billboards and he things it might be possible but might require too much overhead or other craziness. I just noticed he's also provided us with an svg, that's probably compounding the problem because the svg is properly be anti-aliased on rasterization by the browser (and depending on the browser it could be doing a bad job). @hpinkos can you reach out and get the original icon? I didn't notice it in that thread. |
I asked @bagnell offline how our fxaa is actually implemented. He suggested this was based on an older approximation where high-contrast edges are intentionally blurred, which is fast enough for realtime, but is a very different implementation from true anti-aliasing. There was talk of this possibly being upgraded to a different algorithm when WebGL 2 becomes more widely available. So it sounds like the blurring is a design feature of the current fxaa system, making it almost unavoidable without a rewrite or disabling of fxaa. |
I don't think it is out of the question to render to one framebuffer that would get FXAA, and another for labels/billboards/points that would not, and then composite them. This would also work well with the need to render labels on top of polygons since the low level-renderer now would have explicit-ish knowledge of labels/billboards/points. This will be a non-trivial amount of time though so we can't do it for a few months. |
Here is a png and svg version of the icon from the user. He says the png looks better than the svg |
This is exactly what I assumed a large part of the problem was. Browsers do not all do an equally good job of rasterizing/resizing SVGs, so the fact that it's an SVG is one of the reasons it looked so blurry. |
True, but we still have big problem with fxaa intentionally blurring our billboards and labels. I think @pjcozzi's comment is the path to persue, when time permits. |
I think everyone agrees @emackey I just wanted to point out that SVGs can compound the issue. |
Also reported here: https://groups.google.com/forum/?hl=en#!topic/cesium-dev/NBfMvj80vGI |
@bagnell can you post a link to the branch-in-progress and before/after screenshots? |
The branch is selective-fxaa. |
Another idea is to render pick ids with MRT (or a separate pass to an offscreen framebuffer/texture), and then only blur pixels where the surrounding pick ids are different so only the ends of objects are blurred. Billboards, the globe texture, etc. would not be blurred except at the silhouettes. |
Would these fixes apply to #3279 as well? |
@denverpierce they would be part of the solution. |
I believe that this is still an issue - has there been any additional thought on this topic in the last ~5 years? Or is there a recommended approach to solve with billboards and text overlays? |
Quality issue when moving reported in https://community.cesium.com/t/billboard-with-custom-canvas-image-gets-darker-brighter-on-scrolling-rotating/25221/2. |
I'm still having this issue. |
Any further investigation into this issue? I can see that even in the sandcastle examples the billboard quality is low as well. |
Thanks for the interest. There hasn't been any activity on this item recently, but it is definitely on our radar. |
for anyone else that has found this thread, my co-worker came across this other thread explaining how billboards were made intentionally blurry to help with running on mobile devices. and that viewing billboards at a browser zoom level of anything other than 100% will cause this issue to become more noticeable. UPDATE: change this setting for the viewer |
@dukeofcool199 Thanks big time for this. I've been searching and made too many attempts to fix this than I want to admit lol, but your tip did the trick! :) |
nice bro. |
Also reported in #9444. |
Reported on the forum: https://groups.google.com/d/msg/cesium-dev/OLbOuzNRM7U/MHgo_4N6CwAJ
The icon to the left is a billboard, the icon to the right is the original image
The text was updated successfully, but these errors were encountered: