Flatten terrain

Started by bigben, June 12, 2007, 12:29:38 AM

Previous topic - Next topic

bigben

This is kind if a follow up to an earlier post I had on masking terrains.
<http://forums.planetside.co.uk/index.php?topic=1232.0>

In that post the solution for combining multiple terrains of differing resolutions was to check "Flatten first" in the displacement tab of the the heightfield shader. While it fixes one problem, it also creates another one because the underlying terrain is not set to an altitude of 0, but rather a Y value of 0 which creates a flat terrain. This isn't too much of a problem for smallish terrains, it is when you get ambitious.

[attachthumb=#2]
20 degree terrain with flatten first

[attachthumb=#1]
Same terrain without flatten first

While the second image is obviously what you want, if you add another smaller/higher res terrain in the centre there is no way to merge the two terrains (that I know of). If you select flatten first on the second terrain, it's edges will be markedly higher than the adjoining terrain. The only way I can see of doing this in the current version is to have flatten first turned off, and mask the terrains, but this doesn't appear to be straight forward.

Is the behaviour of "Flatten first" going to change to use an altitude of 0 rather than Y = 0 (or as an option) in future?

... needless to say I've been thinking about something along the lines of the Mars animation demo on the Planetside site, but using an Earth based terrain. As it's a bit more recognisable the detail of the launch/landing site needs to be pretty good. While my tiled terrains provide the coverage and resolution required, I'm still at a loss to fit them nicely onto the planet properly...


And while I'm here.... here are some demos of the joins between terrains (all using flatten first).

1 degree (10m DEM) and 20 degree (90m SRTM), 0 blending
[attachthumb=#3]

1 degree (10m NED) and 20 degree (90m SRTM), 0.1 blending
[attachthumb=#4]

The difference in altitude is to be expected with the smoothing of the data for the lower res terrain, so providing intermediate resolutions helps to reduce this.  With the default blending it looks pretty good, given that it is not intended for the camera to be so close to the low res terrain.

0.5 degree (10m NED) and 1 degree (10m NED), 0 blending
[attachthumb=#5]

Only a very small difference, and with blending on it's almost impossible to pick. Using 30m NEDs as an intermediate before 90m SRTM also helps to reduce the difference.  For my US terrains I use 10m NEDs for the first 3 degrees, then 30m NEDs to 10 degrees and then 90m SRTM for anything bigger.

Oshyan

I believe this will always be an issue as long as the terrain you're importing isn't georeferenced. How does it know how to properly fit it onto the planet sphere (distort it)? For example with most DEM data projections you're going to see increasing distortion at the poles, but without knowing if a terrain depicts an area near the pole you don't know how to map it properly. You could fake it or manually position it there, but the results are just not going to be as good. The reason the MOLA shader works so well is that it is essentially somewhat georeferencing-aware, but it's the only such node that is at this point. There are plans to increase GIS and georeferencing support in the future.

In any case I agree some better handling of heightfield blending and conforming to the planet shape would be nice and may be possible to implement. Just keep in mind the distortion that will occur and, depending on the projection of your data, it may be extreme especially if the terrain is being used at a larger or different scale than it was sampled from, or in a different location on the planet.

For now you may be able to get the results you want by using an Image Map shader with spherical projection and converting your larger terrains into an image map for the purpose, then turning on Displacement in the Image Map shader. The only issue then is working out the proper vertical scale, but the mapping should at least be more as you expect it. The merging may not be so easy...

- Oshyan

bigben

UTM or a similar projection should work for reasonable sized chunks of terrain centred at 0,0 irrespective of the latitude or longitude of the source. This would (should) be helpful in this situation (?), and may possibly be useful for adding extra terrains off centre (assuming they use the same projection).

Finding a workaround sounds like a challenge, but I suspect I'll stick to smaller terrains for now and wait to see what happens.

Oshyan

At scales visible from space the distortion can become noticeable. But it's true that UTM is often used as a default projection, perhaps for this reason.

Fundamentally the only major differences between doing this with an image map and doing it with a heightfield are file formats, projection options, and blending/flatten options. If the heightfield shader could allow for "flattening" to the underlying planet curvature rather than a true plane, *or* if the Image Map shader could load .ter and do border blending, we'd have a solution. The latter is a bit more unintuitive though because it doesn't use the heightfield nodes.

- Oshyan

bigben

Flattening to the planet may be the simplest, mapping the TER's Y to the altitude.

UTM is also good for the current flat terrains. I changed the projection of my TERs and reworked my spreadsheets to work with metres and produced another set of terrains, but this time with two high res terrains offset to cover the entire Grand Canyon. I loaded them into TG2 and plugged in the theoretical offsets and it all lines up beautifully, so I now have an 80km wide terrain of the Grand Canyon at 10m resolution :) This also avoids the dilema of where to place the centre of the terrain if it doesn't cover the entire (potential) area of interest.

The conversion process created  some spikes along the edges of the terrain but blending took care of these quite nicely. I'll see if I can avoid these when I fine tune the extraction locations.

The image below is a test render of the borders of the terrain. 20m terrain at one of the bottom corners, and the join between the two 10m terrains runs vertically through the centre of the image. Blending = 0.05