Select to view content in your preferred language

Water Bodies

216
3
a month ago
EthanMansfield
Emerging Contributor

Hi All,

Currently experimenting with Unreal + ArcGis for use in a flight simulator. I've managed to (kind of) get bodies of water working in an automated way. My current workflow is shapefile -> ESRI JSON -> load into UE. I then use the geometry of the polygons to create mesh modifications and also use the Geometry Script plugin to create dynamic meshes for each of the water bodies. This works *ok* for lakes and such:

EthanMansfield_0-1744794986667.png

They look fine from a distance, but fairly quickly fall apart when close up (1m^2 cube for reference):

EthanMansfield_2-1744795109230.png

As you can see, anywhere that my elevation data has a high slope after the mesh modifications are applied there is a big cliff. Not the end of the world, given the application, but this brings me to rivers and how I've gone about implementing this.

As I mentioned before I'm creating dynamic meshes using the geometry script tool. In order to have the water meshes at the correct height I draped my original vector data over my elevation data to give it Z values. Within Unreal, I then calculate an average height for each polygon and set each point in the polygon to that height. Not doing so i.e. each point has a different Z, results in strange geometry for the water meshes. Now, onto the rivers:

EthanMansfield_3-1744795657234.pngEthanMansfield_4-1744795701076.png

The rivers line up perfectly with my modifications but at various points they are set to too low of a Z. This is obviously because the river polygons cover much more distance and have a greater change in height compared to lakes. The same river as above but further down stream:

EthanMansfield_5-1744795997532.png

I guess my question is, can anyone think of a better way of doing this? It took me a lot of trial and error to get to this point. I've tried setting Z values for the meshes based on elevation data, I've tried triangulating the polygons in an effort to reduce the weird geometry mentioned previously. I've tried subdividing the river polygons - this kind of worked but resulted in stepping between the sections. I also tried using the ArcGis location component, thinking that perhaps the Unreal plugin was doing some interpolation of my elevation - the issue with this was that it can only be used when attached to an actor. It would be great if there was a function we could call to just get the elevation at a given location.

I've seen another post on here, trying to achieve similar with SLPKs and such. I also created a 3d SLPK based on my data but again that resulted in weird geometry (I assume because the polygons were not triangulated).  

0 Kudos
3 Replies
AShahbaz
Esri Contributor

Amazing workflow! A few thoughts:

  • Have you tried any bathymetry service as the elevation source? You might not need to carve the terrain with mesh modification if you use such a layer.
  • Have you tried to implement the rivers with a spline mesh? Basically a plane or cube that goes along a spline? The implementation might be a bit more involved depending on whether your data for a river is a polygon of the boundaries of the river bank or a polyline at the center of the river.
  • I think your idea for subdividing the river polygon should work too. Could you assign different elevation values to different vertices to avoid the steps? If each segment of the river has four vertices, each pair of those could have the same height (average of the two vertices across the rive). So your polygon would still be flat but not horizontal as the elevation changes along river.
  • We dont currently have function to get the elevation at a given point. As an alternative to attaching the location component to an actor, you could also use a ray cast or an external rest-api service to get the elevation for a given geographic point. Or if you already have the full geographic coordinates (including the altitude), you could convert it to engine coordinates using `TransformPointToEnginePosition` of location component
0 Kudos
EthanMansfield
Emerging Contributor

Thank you!

I had considered utilising bathymetry but never got around to trying it before my trial of ArcGis Pro ran out - I have a requirement to use my own (offline) data. I'm waiting to hear back from the sales team to potentially get the trial extended before I commit to a full license.

While not with rivers directly, I did experiment creating splines from my polygons to utilise Unreal's water system so I'm sure I can adapt this for rivers. However, some of my river polygons also contain small ponds/pools so I don't think a spline mesh would work in this situation.

On your third point, this had been an idea I had in the back of my head. I wasn't sure how I would "pair" these vertices though, I will have to have a look into the ESRI json spec to see if the order of vertices relates in someway that I could pair "opposite" vertices if you will.

On your last point, there must be some function that provides this functionality or else how does the location component work? From my digging into the source of the plugin I found an ElevationMonitor class (which the location component uses) but I couldn't manage to get it working for my use case. Anyhow, I think the previous solution of pairing up opposite vertices is the best way to go.

0 Kudos
salvaba
Emerging Contributor

Hi @EthanMansfield , 

I'm the author of the post you linked and I'm also investigating the use of this plugin for flight simulator use cases.

The key aspects for it to totally cover the use cases and work with other components were:

- The ability to replace materials of the tiles with water. With ArcGIS Maps 2.0 it is possible to assign materials to elevation and have several maps. I know it might not be optimal but you can have one map with 0 elevation reserved for the ocean water, the thing is that the quads do not have enough resolution to look nicely close to the ground (now water plugins use real-time morphing to have enough resolution in the very close field, normally only the highest resolution LOD alone). In the end, we followed the bathymetry approach, which might be enough for high altitude but not for low altitude because resolution of terrain is normally quite low.

- The ability to replace tiles with detail maps (i.e. with other materials like it is possible at the moment with UE landscapes), starting from maps like landsat land cover.

- The ability to procedurally paint foliage or buildings.

- Smooth rebasing logic implemented. It is important as current weather systems are not planetary and rain and particles generally work only when the Unreal Z is aligned with the ellipsoid local normal direction. Also, realistic ocean materials do not implement triplanar mapping, therefore they stretch when you move far away from your origin (it also happens with clouds). So it is important to update origin periodically and add offsets to materials to keep these things working. I have a custom implementation but it has flickering problems, here the issue.

- LODs without camera frustrum culling only distance culling for placing several views.

I don't exactly know how they did it, but something like this might be extremely useful.

Best regards,

Salva

0 Kudos