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 dynamic screen space error #798

Draft
wants to merge 2 commits into
base: ue4-main
Choose a base branch
from
Draft

Add dynamic screen space error #798

wants to merge 2 commits into from

Conversation

baothientran
Copy link
Contributor

@baothientran baothientran commented Mar 23, 2022

This accommodates CesiumGS/cesium-native#466

@cesium-concierge
Copy link

Thanks for the pull request @baothientran!

  • ✔️ Signed CLA found.
  • CHANGES.md was not updated.
    • If this change updates the public API in any way, please add a bullet point to CHANGES.md.

Reviewers, don't forget to make sure that:

@kring
Copy link
Member

kring commented Mar 25, 2022

@baothientran this is really interesting! The reduction in tiles for horizon views near the ground is quite impressive. And in some cases it actually does a better job of preserving detail. For example, here's a horizon view with dynamic SSE enabled and default settings. Notice the small peak at the horizon near the middle-right of the screen.

image

Now here's the same scene with dynamic SSE disabled:
image

Huh.. where'd the peak go? Apparently, it got fog culled. Not great. But even less great is that second screenshot with the missing peak rendered 145 tiles, while your improved algorithm only rendered 81. That's very impressive.

Here's a zoomed out view showing which tiles were selected, with dynamic SSE (81 tiles rendered):

image

And with the original, non-dynamic algorithm (145 tiles rendered):

image

The new algorithm is switching to bigger, less detailed tiles much more aggressively, but it also is pushing the horizon out much further.

Of course, if you look closely, you can see the loss of detail at medium zoom distances.

medium-distance-detail

It's more obvious in the above gif because Bing has an imagery discontinuity here.

Also, because the dynamic SSE is only activated when the camera descends below a certain height, it's possible to observe weird discontinuities where moving the camera downward (and thus closer to the globe) causes the globe to become less detailed:
losing-detail-while-descending-smaller

So I think this is super promising, but we need to be a bit more rigorous about it. Especially considering that there are so many user-tweakable settings here. It's going to be very hard to explain to users how to set them, and settings that work great in one part of the globe may work very poorly in others. Perhaps we need some basic knowledge of terrain heights over the globe so that we can use that as an input to the algorithm? CesiumJS does similar things elsewhere (but not for tile selection, AFAIK).

@baothientran
Copy link
Contributor Author

yeah I agree we should have a better way to estimate those settings automatically, so that it works reliably for the whole earth and make it easier for user. I will check on CesiumJS to see if we can calculate the estimation

@kring kring deleted the branch ue4-main April 1, 2022 02:48
@kring kring closed this Apr 1, 2022
@kring kring reopened this Apr 1, 2022
@kring kring changed the base branch from main to ue4-main April 1, 2022 03:08
@javagl
Copy link
Contributor

javagl commented May 9, 2022

So I think this is super promising, but we need to be a bit more rigorous about it. Especially considering that there are so many user-tweakable settings here. It's going to be very hard to explain to users how to set them, ...

The number of settings/parameters depends on the exact approach that is implemented. The computation right now is implemented as

double sse = frustum.computeScreenSpaceError(tile.getGeometricError(), distance);
if (_options.enableDynamicScreenSpaceError) {
    // some complex computation, hightly specific for the approach,
    // depending on 7 user-tweakable parameters and many aspects
    // of what is currently visible on the screen...
    sse = ...;
}

where indeed quite a few paramters come into play.


Regardless of the implementation, it all boils down to a single bit being 0 or 1 (render or don't render). So it could be written as

boolean skipDueToSse = sseCuller.compute(....);

Usually (but not necessarily!) this is based on comparing the SSE with the "maximum SSE". So the default implementation of the SseCuller#compute function could be

boolean compute(....) {
    double sse = sseComputer.compute(tile, distance, ...);
    return sse < maxSse;
}

with SseComputer being a single-virtual-function class. One could argue about the exact inputs, but one could be open-minded about that. In any case, it would open room for further experiments, including approaches with fewer user-tweakable parameters.


Back when I opened CesiumGS/cesium-native#342 , I actually played around with one implementation like that, using sse = geometricError / pow(distance, someExponent) as the actual function. (That's just one of many possible SseComputer implementations that could be switched transparently, without affecting any other part of the code).

Some screenshots are attached.

The fist one (scene A) shows one scene where I varied the Distance Exponent ( lower right) in the range [0.25, 2.0], and chose the Maximum Screen Space Error so that roughly the same number of tiles are rendered. In the second one (scene B), I did the same with fewer steps.

This this had really just been very basic experiments, because there was no explicit "goal" here. The question about the "goal" could be:

  • Should there be fewer tiles rendered for the same SSE ?
  • Should the SSE be smaller for the same number of rendered tiles?
  • (+ probably many other "axes" to explore....)
  • ...
  • (abstractly: ) How to actually quantify "visual quality"?

CesiumUnreal distance exponent.zip

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.

None yet

4 participants