Mesilliac's Essay on Terrain Perspective

From The Battle for Wesnoth Wiki

By mesilliac (original thread)


Wesnoth terrain tiles are in a somewhat unusual perspective, as anyone who has attempted to draw a terrain tile has most probably noticed. While at first glance the tiles might seem to use an isometric perspective, this is not the case. Note that the perspective discussed herein applies only to terrain tiles, not to all terrain images (for instance, castles and forests are not necessarily draw in this perspective). Also remember that Wesnoth units are not drawn in the perspective discussed here. This perspective is unique to terrain tiles.


Now for the essay.


You might already know that a regular hexagonal grid has a kind of inherent perspective. The hexagons align at 30° angles, implying an Isometric Projection.

Wesnoth tiles aren't regular hexagons, but they happen to have some very nice properties anyway. Either high-school trig or playing around with the measuring tool in GIMP will tell you that the inherent angle that wesnoth hexes are aligned on is 33.69°. This is close to isometric. As close as most "isometric" games, which usually use a 26.565° angle. The reason it is at some funny angle is because this is the angle you get when you move 3 pixels horizontally and 2 pixels vertically (26.565° comes from moving 2 pixels horizontally and 1 pixel vertically).

geometry1.png

For the purposes of this post, I'm gonna call this perspective "wesometric" .

To find out how much this view was squished from the top-down view, just expand it until the wesometric square is a true square. A little math or playing around will give you a vertical expansion to 150% of the original height. This shows you the "true" top-down view of a wesnoth hex, as implied by this perspective.

geometry2.png

In corollary, if you have drawn something from top-down and want to scale it to fit in with this perspective, scale the image to 2/3 of the original height.

For a consistent vertical scale in this perspective, assume that it is a true 3D view. We are looking down at some angle from an infinite distance away. Unless you have a 3D modelling program handy playing around won't give you this one and you have to do some trig. To sum it up:

our viewing angle = arcsin(2/3) == 41.81°

This means that the vertical scale should be foreshortened to a factor of cos(41.81°) == 0.745355... ≈ 75%

It's basically a convenient coincidence that this is so close to 3/4.

To demonstrate, here's a randomly-aligned cube, drawn in wesnoth's inherent perspective. Any object can be drawn in this way, which is first to draw it top down, then to compress it vertically to 66.67%, then to extrude it upwards by 3/4 of the "real" height.

geometry3.png


And here's a nicely aligned cube, drawn in the same perspective. The height should technically be 3.16 units or so, but 3 is close enough to be used for this well-aligned rotation:

geometry4.png


So to sum up:

  1. You can draw a terrain texture in a top-down perspective, rotate it 45 degrees, then resize it vertically to 66.666...% of its original height in order to achieve the correct perspective for a Wesnoth terrain tile.
  2. A texture drawn from side on should be squished by 1/4 to 75% of its original height in order to achieve the correct perspective for a Wesnoth terrain tile.
  3. The inherent angle that wesnoth hexes are aligned on is 33.69°. This is close to isometric, but the perspective used here is not true isometric perspective.
  4. This perspective applies only to terrain tiles, not to scenery or unit graphics.


See Also

This page was last edited on 23 January 2012, at 15:55.