Skip to content

Implement CesiumRasterOverlays::VectorDocumentRasterOverlay in Unreal #1677

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

Merged
merged 43 commits into from
Jul 31, 2025

Conversation

azrogers
Copy link
Contributor

This is the Cesium for Unreal counterpart to CesiumGS/cesium-native#1163. That PR will need to be merged before this one is.

@azrogers
Copy link
Contributor Author

@kring Pinging you to let you know this is in a PR if you want to give it a try!

@azrogers
Copy link
Contributor Author

What I assume to be a shared_ptr issue has appeared in the most recent round of changes - somehow a double free is happening to the GeoJsonDocument, but I can't tell where that might be happening.

@kring
Copy link
Member

kring commented Jun 18, 2025

@azrogers I'm using this branch and trying to recreate this screenshot:
image

I've created a CesiumGeoJsonDocumentRasterOverlay and I'm able to render the lines. Now I'm trying to style them.

I've added this to my level blueprint:
image

And that event function looks like this:
image

But what I can't figure out is how to set the style on particular features. Looking only briefly at the code, it looks like it might not be hooked up yet. Is that right?

@azrogers
Copy link
Contributor Author

@kring I've added blueprint functions for working with GeoJsonObject styling so you should be able to set it up now!

Base automatically changed from geojson-support to main July 1, 2025 15:17
@j9liu j9liu modified the milestone: August 2025 Release Jul 28, 2025
@kring
Copy link
Member

kring commented Jul 30, 2025

I tried to add a raster overlay with this GeoJSON (click Download and then GeoJSON), loaded from a file URL. It doesn't report any errors in the log, but nothing appears. Debugging it very briefly, I think the immediate problem is that GlobeRectangleFromObjectVisitor isn't implemented for FeatureCollection, which is the top-level object type in this file.

@kring
Copy link
Member

kring commented Jul 30, 2025

Oh sorry, I'm wrong. GlobeRectangleFromObjectVisitor is fine, it doesn't need to be implemented for FeatureCollection. The problem was that BoundingRegionBuilder::expandToIncludeGlobeRectangle has a couple of bugs. It's not computing the longitude correctly, because the < and > operators are flipped. And it wasn't setting _longitudeRangeIsEmpty to false. With those two changes (which I pushed to cesium-native vector-rasterizer branch), this GeoJSON is working well!

@kring
Copy link
Member

kring commented Jul 30, 2025

Mip generation doesn't appear to be working correctly. Only the first mip level has lines drawn. I believe the only reason this isn't visible is because, with the default raster overlay SSE of 2, every pixel ends up sampling the base mip level. But if you set the Max SSE to 0.5, lines start fading out and disappearing.

I confirmed that lines aren't drawn except in the base mip level using RenderDoc. Here's the base mip:
image

And here's the first mip level:
image

@kring
Copy link
Member

kring commented Jul 30, 2025

The problem was that primitivesRendered.assign({false}); needs to be primitivesRendered.assign(primitivesRendered.size(), false);. With that change, the lines stay a nice constant width as you zoom out, it looks great!

@kring
Copy link
Member

kring commented Jul 31, 2025

I'm seeing some shifting at different LODs. It's a little subtle in this gif due to the low frame rate, more obvious live, but hopefully you can see it. The lines appear to move relative to the globe surface when the LOD shifts.
line-shift
This only happens when the raster overlay's projection is set to Web Mercator. Setting it to Geographic avoids the problem, or at least drastically reduces it. Most likely this comes down to whether the lines are straight in the geographic projection versus the web mercator projection versus in reality (i.e., geodesics). But I need to think through it a bit more.

@kring
Copy link
Member

kring commented Jul 31, 2025

Here's a more obvious example where two different LODs side-by-side make a line disjoint:
image
(I've suspended update and zoomed in closer to make it easier to see in the screenshot)

@kring
Copy link
Member

kring commented Jul 31, 2025

Thanks @azrogers!

@kring kring merged commit 7d410b7 into main Jul 31, 2025
8 of 14 checks passed
@kring kring deleted the vector-overlay branch July 31, 2025 22:51
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.

3 participants