Planetside Software Forums

General => Terragen Discussion => Topic started by: cyphyr on September 13, 2013, 10:26:13 AM

Title: How do I match up a "geo-referanced" height map with an image mask?
Post by: cyphyr on September 13, 2013, 10:26:13 AM
How do I match up a "geo-referanced" height map with an image mask?

I have a DEM and a bit map mask of EXACTLY the same dimensions. Both are very high resolution data files showing rivers, port structures and coastal features (and terrain features). In Global Mapper they line up PERFECTLY.

As DEM and geotiff location is based on lat and log location references and image map location is based on x,y.z location references there is an intrinsic incompatibility.
Compounding this problem is the fact that a y projected image will be stretched as its edges are further away from the 0,0,0 point (the only place where the y projection is truly perpendicular to the planet surface).

Any suggestions gratefully received.
At the moment I'm stumped.
Camera projection from the center of the planet maybe but working out the exact camera FOV to hit the DEM with 10m accuracy is beyond me!)

Cheers

Richard
Title: Re: How do I match up a "geo-referanced" height map with an image mask?
Post by: RArcher on September 13, 2013, 10:51:53 AM
Hi Richard,

I have a non-ideal solution, but hopefully it will work for you.  As you know until we can load geo-referenced images it is pretty much impossible to line things up correctly.  What you can do potentially is make sure "Flatten Surface First" is checked which will stop the heightfield/DEM from following the curvature of the planet.  In theory your image map should then line up correctly as neither the image nor the terrain is wrapping around the planet.  This may cause issues later on with altitude based shading / water positions etc.
Title: Re: How do I match up a "geo-referanced" height map with an image mask?
Post by: cyphyr on September 13, 2013, 10:59:00 AM
Thanks Ryan, that's actually something I had not thought of but unfortunately in this case will not work since the terrain is too large (most of the gulf of California!). It would work for smaller areas I think though.
Cheers
Richard
Title: Re: How do I match up a "geo-referanced" height map with an image mask?
Post by: Oshyan on September 13, 2013, 04:07:43 PM
Are you sure you need the terrain to be in its actual, correct location on the planet? Or do you just want sizing to be correct? If the latter, you can change the lat/long at apex to be the 0,0 coordinate origin and then you should be able to line up an image with the same size/coverage area easily.

- Oshyan
Title: Re: How do I match up a "geo-referanced" height map with an image mask?
Post by: Matt on September 13, 2013, 04:39:23 PM
Quote from: Oshyan on September 13, 2013, 04:07:43 PM
Are you sure you need the terrain to be in its actual, correct location on the planet? Or do you just want sizing to be correct? If the latter, you can change the lat/long at apex to be the 0,0 coordinate origin and then you should be able to line up an image with the same size/coverage area easily.

- Oshyan

That may be true in some case. However, georeferencing may still pinch or even shear the rectangle so that a simple top-down image projection still might not perfectly match. You could probably line it up manually with a camera projection, but it would still be tricky.

If I were doing this, I'd sacrifice 100% accuracy in the projection by turning off georeferencing so you can easily align the image size and position. The Gulf of California is far enough from the poles that it probably won't matter to most viewers, and if it does, perhaps you can cheat the perspective of the camera.

Matt
Title: Re: How do I match up a "geo-referanced" height map with an image mask?
Post by: Oshyan on September 13, 2013, 04:58:10 PM
I should also mention we will have georeferenced images in a future release, which will make this kind of thing a lot easier. :)

- Oshyan
Title: Re: How do I match up a "geo-referanced" height map with an image mask?
Post by: cyphyr on September 13, 2013, 05:19:42 PM
Thanks guys.

The project is of a semi "legal" status using very accurate terrains  to show view points from specific locations so accuracy is paramount.
I think the solution will simply be to show different locations from camera vp's that don't have the intrinsic errors in shot.
I will have to talk to my client about this.

I've already moved the lat/long apex to 0,0. It made some improvement.

Is there a way of defining he level of accuracy of a given projection in a given situation?

You say that in all cases Geo referencing will throw up pinching errors?

Cheers

Richard
Title: Re: How do I match up a "geo-referanced" height map with an image mask?
Post by: Matt on September 16, 2013, 07:12:18 PM
Quote from: cyphyr on September 13, 2013, 05:19:42 PM
You say that in all cases Geo referencing will throw up pinching errors?

What I mean is, even though a tile may be perfectly rectangular in lat-long coordinates, once you map that onto the planet it won't be perfectly rectangular if some of its corners are closer than others to one of the poles.

You can see this in the grid here:

(http://upload.wikimedia.org/wikipedia/commons/thumb/7/70/Sphere_filled_blue.svg/200px-Sphere_filled_blue.svg.png)

From: http://en.wikipedia.org/wiki/Geographic_coordinate_system

However, maybe the tiles you downloaded are
Matt