0

I am working on 3d terrain visualization tool right now. Surface is logically covered with square tiles. This tiling could be visualized as follows:

Tiled earth

Suppose I want to draw a picture on these tiles. The level of detail for a picture is required to be selected according to the current camera scale which is calculated for each tile individually.

In case of vertical camera (no tilt, i.e. camera looks perpendicularly on the ground) all tiles have the same scale which is camera focal length divided on camera height above the ground.

Following picture depicts the situation:

camera with no tilt

where red triangle is camera which has no tilt, BG is camera height above the ground and EG is focal length, then scale = AC/DF = BG/EG

But if camera has tilt (i.e. pitch angle isn't 0) then scale is changed from tile to tile (even from point to point).

enter image description here

So I wonder if there any kind method to produce reasonable scale for each tile in that case ?

Community
  • 1
  • 1
deephace
  • 324
  • 3
  • 15

1 Answers1

1

There may be (there almost surely is) a more straightforward solution, but what you could do is regular world to screen coordinate conversion.

You just take the coordinates of bounding points of the tile and calculate to which pixels on the screen these will project (you of course get floating point precision). From this, I believe you can calculate the "scale" you are mentioning.

This is applicable to any point or set of points in the world space.

Here is tutorial on how to do this "by hand".

If you are rendering the tiles with OpenGL or DirectX, you can do this much easier.

Matěj Zábský
  • 16,909
  • 15
  • 69
  • 114
  • Suppose I don't have access to the rendering pipeline at all. To solve this problem I'd like to use only information about camera position, its height above the ground, tile center and camera lookat position without construction of additional matrices. – deephace Apr 09 '12 at 20:52
  • @deephace You need information about the "camera". E.g. you need to factor the focal length of the camera somehow. Imagine a photo of two objects whose distance from the objective is very different. Ratio of sizes of these two objects will differ vastly depending on focal length. Wide angle lens will result in the objects being similar in size, but narrow angle lens will result in the distant object being much smaller. IMO any formula you can come up with will be just disguised matrix multiplication (or it will work only in some simple cases - I tried to do something similar in my project). – Matěj Zábský Apr 09 '12 at 22:23