How can I avoid gaps between elevation tiles?

classic Classic list List threaded Threaded
5 messages Options
pvalsecc pvalsecc
Reply | Threaded
Open this post in threaded view
|

How can I avoid gaps between elevation tiles?

Hi,

I'm using an XYZElevationLayer as elevation source and I get gaps like that between two tiles:


If I look straight down, I have no gaps. If I look more horizontally, I do have a gap where the terrain goes up. So the gap is not in X/Y, but in Z. It's like the terrain is not contiguous between the tiles.

Any idea if there are options I should set on the Map to avoid that?

I am using osgEarth 3.2.

Thanks
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: How can I avoid gaps between elevation tiles?

You are probably using a data source that doesn't have matching tile boundaries. You can render a "skirt" to fill the hole by setting the skirt_ratio terrain option like so

<map>
   <options>
      <terrain skirt_ratio="0.1" ...

Hope that helps.
Glenn Waldron / Pelican Mapping
pvalsecc pvalsecc
Reply | Threaded
Open this post in threaded view
|

Re: How can I avoid gaps between elevation tiles?

Thanks for the quick answer.

You are saying the last column of tile x/y should be equal to the first column of tile x+1/y? I don't think it should. Elevations are the same as images, the tiles don't have common areas between them. The value of the pixel is at the center of it; not at one corner. So it's normal not to have repeated values between tiles.

Here is an illustration of two 3x1 tiles (H is for the border between the two tiles)
+---+---+---H---+---+---+
| 1 | 2 | 3 H 4 | 5 | 6 |
+---+---+---H---+---+---+

That should be shown as a straight slope without interruptions.

I've tried setting heightFieldSkirtRatio as you said and I have now vertical walls where the tiles join. I would not say it's better.
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: How can I avoid gaps between elevation tiles?

Patrick,
Unfortunately there is no actual standard for elevation raster data, and thus no real "normal" configuration.

osgEarth works best with elevation data tiles that are sized to a power-of-2-plus 1 (e.g. 129 or 257) with the edges repeated across tiles. That is because in order to create triangles that join at the tile boundary, and to create valid normal maps, one needs to know the values in the neighboring tile. The most efficient thing to do it to store those neighboring values in each tile.

To support non-overlapping elevation grids would require a new feature that reads in multiple tiles and converts then to an edge-matched tile.
Glenn Waldron / Pelican Mapping
pvalsecc pvalsecc
Reply | Threaded
Open this post in threaded view
|

Re: How can I avoid gaps between elevation tiles?

OK, I've created a TileLayer class that adds this extra column and extra row.
Files available there, if somebody needs them:
ElevationLayerSeamer.cpp
ElevationLayerSeamer.h

The terrain is displayed without gaps, with that.

Thanks a lot for your help, Glenn.