terrain and round hills

Started by
6 comments, last by blue-ice2002 18 years, 8 months ago
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?
Advertisement
Hi,

You could just use a standard heightmap and then do a 3x3 or 5x5 filter over it to smooth it out.
Since you are using direct3d I would recommend http://www.moon-labs.com/ml_resources.htm as a good example with source of a heightmap that is smoothed by a 3x3 filter.

Regards
Richard 'ViLiO' Thomasv.net | Twitter | YouTube
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.
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
Richard 'ViLiO' Thomasv.net | Twitter | YouTube
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.

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.
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 leftvertex[2][2].y -= iHeight;vertex[0][2].y = (iHeight+tile_left->iHeight)/2.0f;// for better roundness we use slightly greater valueint temp_height = (vertex[2][2].y+vertex[2][0].y) / 2.0f;vertex[1][2].y = temp_height+(temp_height/3.0f);// this is upleftvertex[0][0].y = (iHeight+tile_upleft->iHeight)/2.0f;// for better roundness we use value of height-height/3temp_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,0vertex[0][1].y = (vertex[0][2].y+vertex[0][0].y) / 2.0f;/*with this we have done up left triangle V00V01 V11V02 V12 V22just 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 :)
its a great explanation,thanks

i will study that,and ask again.

This topic is closed to new replies.

Advertisement