Jump to content
  • Advertisement
Sign in to follow this  
ko9

height in an isometric landscape

This topic is 4466 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I've recently started making a simple isometric game/simulation, and I've been stuck for a few weeks now trying to figure out what the neatest way was to implement the 'height' element of my terrain. So far, I just have tiles, and each tile has a height value. The problem is that I don't want it to be just blocks sticking out at a certain level, I want the landscape to flow. This means each tile (I'm using square tiles) has 4 corners, and I will have to determine the height of each corner by averaging out the 4 neighbouring heights:
.-.-.
| | |
|-+-|
| | |
`-`-`
(please forgive the bad ASCII art ;-)) anyway, if I would do this , it would create a nice quad for me that is skewed/stretched/etc to match the 4 corners.. the problem is, that my landscape is now not the level I had expected it to be, rendering the height value worthless (besides calculating these averages). Say I have a top of a mountain, where the heighest tile would be height 16, and all (eight) surrounding tiles would be 12. Using this system, each corner of the top tile would be (16 + 3*12)/4 = 13, so the mountain top would only be 13 high. The height value of the top tile would be useless for rendering objects/items/trees/etc on a certain height.. I've been considering a lot of options to solve this, but I won't bore you with all those now, or the thread will be too intimidatingly long to read for most people, and would only result in less feedback ;-) In short, what's a neat way to implement a flowing isometric landscape (think Settlers), without losing the height data? Thx in advance, Ko9 [Edited by - ko9 on July 28, 2006 1:43:10 PM]

Share this post


Link to post
Share on other sites
Advertisement
DarkBASIC uses a 3D matrix system in which you assign the heights of each corner, and it calculates polygons using lines between pairs of corners.

Share this post


Link to post
Share on other sites
Why do you need to average out the corners in the first place?

Isn't it simplier to do:

A ---- B
| |
| Tile |
| |
C----- D


And let Tile's height be interpolated by A through D?

If you're using 3D, don't average out heights at all
Drawing a quad based on dots A->D will suffice!

/Robert

Share this post


Link to post
Share on other sites
Consider following picture:



1 step:
you need to find x,y coordinate of these vertices:
- 1,2,3,4,5
5.x = (A.x+B.x)/2;
5.y = (A.y+D.y)/2;

1.x = (A.x+5.x)/2;
1.y = (A.y+5.y)/2;

2.x = 5.x + (B.x+5.x)/2;
2.y = 1.y;

3.x = 1.x;
3.y = 5.y + (D.y+5.y)/2;

4.x = 2.x;
4.y = 3.y;

2nd step:
For calculating height of these vertices, you need to know height of tile plus height of surrounding tiles.



Height of tile is height of vertex no 5, so:
5.z = tile_height;

We need to calculate height of vertices ABCD:
A.z = (5.z+ T0.tile_height)/2;
B.z = (5.z+ T2.tile_height)/2;
C.z = (5.z+ T4.tile_height)/2;
D.z = (5.z+ T6.tile_height)/2;

Height of veretx 1 is 1.z = (5.z+ A.z)/2;
2.z = (5.z+ B.z)/2;
3.z = (5.z+ D.z)/2;
4.z = (5.z+ C.z)/2;

Here you can use greater slope and not use /2, but /3 or similar.
Also you must calculate z coordinates of vertices between A and B, B and C, C and D, and D and A.
AB.z = (5.z+ T1.tile_height)/2;
BC.z = (5.z+ T3.tile_height)/2;
CD.z = (5.z+ T5.tile_height)/2;
DA.z = (5.z+ T7.tile_height)/2;
3 step - drawing:
Because we are using 2D drawing there are no z coordinate. For achieving fake look of height just subtract height from y coordinate of vertex;
1.y -= 1.z;
2.y -= 2.z;
etc...

Another problem is shading them. You'll find that height is ok, but you need a light map for heights.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!