Difference between revisions of "Mesilliac's Essay on Terrain Perspective"
Artisticdude (talk | contribs) (Created page with ' 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…') |
Artisticdude (talk | contribs) m |
||
Line 1: | Line 1: | ||
+ | By [http://forums.wesnoth.org/memberlist.php?mode=viewprofile&u=102249&sid=46ee83df05030b2f35e8c5cca73ff436 mesilliac] ([http://forums.wesnoth.org/viewtopic.php?p=292683#p292683 original thread]) | ||
Revision as of 13:38, 6 January 2012
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 some funny angle is that 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).
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.
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 his 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.
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:
So to sum up:
- 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.
- 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
- 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.
- This perspective applies only to terrain tiles, not to scenery or unit graphics