Jump to content
  • Advertisement
Sign in to follow this  
blue-ice2002

terrain and round hills

This topic is 4761 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

i want to make round hills on orthographic projection in direct3d,with quads,but is there an algorithm or a known source for that,any help will be appreciated. i mean i use tiles to make a terrain,by tiles i mean quads made of 2 triangles,and i render them to have an isometric perspective,but use orthographic projection,i mean i dont use depth. But to make round hills,i modified the vertices to make hills,but is there a known way,or u play with them to make a hill?

Share this post


Link to post
Share on other sites
Advertisement
thanks for explanation i checked that but,that uses perspective projection,its truely 3d,

i use ortographic projection means,i dont have depth,but make the hills in xy plane,thats why i cant use a heightmap maybe,or can i use,dunno.

i want to make not a random hill,just a smooth and regular hill by quads.

Share this post


Link to post
Share on other sites
Hi,

I may not be the best to talk to on this matter (as I have little experience with orthographic projection and little experience with direct3d ...i'm an opengl kind of guy), but surely the type of projection matrix you use to view your world shouldn't really matter. You should be able to draw a mesh using 3 axis and then just view that mesh with the orthographic projection matrix.

I could be very wrong though and you'd have to give me an example of a game or something that uses orthographic projection :D

Share this post


Link to post
Share on other sites
You need tiles with more tringles. With 2 triangles you'll have very rough terrain. Create tiles with 5x5 (25 vertices) and then just change y coordinate of central vertex in minus by X value, vertices around central vertices by X-X/3 (basic explanation).
x x x x x
x 2 2 2 x
x 2 C 2 x
x 2 2 2 x
x x x x x
C - central vertx
2 - second ring of vertices

On the other hand for hills you need to know height of tiles around heightened tile, and then just interpolate y coordinate of vertices between two tile.

Share this post


Link to post
Share on other sites

thanks,thats the thing that i just made ,i mean the one in the graphic,

but not the calculations u said,i couldnt understand why u came up with that formula,i mean is there a good explanation of that,or how did u learn it,is there a tutorial for making hills like that?

and i did that rings and i got a pyramid,not a hill,but i said with easy giving heights,not with that formula.

Share this post


Link to post
Share on other sites
Quote:
Original post by blue-ice2002

thanks,thats the thing that i just made ,i mean the one in the graphic,

but not the calculations u said,i couldnt understand why u came up with that formula,i mean is there a good explanation of that,or how did u learn it,is there a tutorial for making hills like that?

and i did that rings and i got a pyramid,not a hill,but i said with easy giving heights,not with that formula.


Well if you to second round of vertices give height of height/2 you'll have piramid. That's why
Quote:
vertices around central vertices by X-X/3...

With only one tile you'll got pyramid style hill, but if you use tile with 8 tiles around that central tile you will have a real hill :)
Let's say you have a tile with 25 vertex:


DXVERTEX vertex[5][5];
// V00 V10 V20 V30 V40
// V01 V11 V21 V31 V41
// V02 V12 V22 V32 V42
// V03 V13 V23 V33 V43
// V04 V14 V24 V34 V44

//and off course height in int...
INT iHeight;
/* our tile have to know height of tiles around them. You can solve this with linked lists or simple array which you must feed before rendering.
tile_upleft->iHeght;
tile_up->iHeight;
etc...
or INT iHeightAround[8];*/


// I'll show you just one tile solution, other ones are just copy/paste matter :)
// this is left
vertex[2][2].y -= iHeight;
vertex[0][2].y = (iHeight+tile_left->iHeight)/2.0f;
// for better roundness we use slightly greater value
int temp_height = (vertex[2][2].y+vertex[2][0].y) / 2.0f;
vertex[1][2].y = temp_height+(temp_height/3.0f);

// this is upleft
vertex[0][0].y = (iHeight+tile_upleft->iHeight)/2.0f;
// for better roundness we use value of height-height/3
temp_height = (vertex[2][2].y+vertex[0][0].y) / 2.0f;
vertex[1][1].y = temp_height+(temp_height/3.0f);
// interpolate missing vertex 1,0
vertex[0][1].y = (vertex[0][2].y+vertex[0][0].y) / 2.0f;

/*with this we have done up left triangle
V00
V01 V11
V02 V12 V22

just make another three trangle interpolation and you have done it :)*/







Notice that only edge vertices are interpolated with around tiles's height, vertices that are inside are interpolated after calculating edge vertices...

and I learned this stuff by myself after few minutes of thinking ;) it is just matter of logic...


Good luck :)

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!