#### Archived

This topic is now archived and is closed to further replies.

# Terrain

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

## Recommended Posts

I was wondering how terrain could be generated, not from a fps pov but from a strategy/army game pov. Like Shogun or similar. So you can see a great distance and fly around the map god-like with a free-camera view. The maps, as I understand it, wouldn't have to be hugely big (due to the relative scale of the people populating it) yet have good lod? Also, would it be possible to have two levels of terrain? Just like a cliff face has concave sections so there's an overhang like: ---- | _> |_ > / / | (it looks like a cliff face in my head!) Any articles you could point me to, cos the ones on this site went straight over my head :S I'd also prefer answers wrt OpenGL, if poss. tia, dammit Edited by - dammit on February 25, 2002 11:30:56 AM

##### Share on other sites
The keyword are: heightmap & CLOD or ROAM or geomipmap.

By example this one

Edited by - JesterLeCodeur on February 25, 2002 11:49:37 AM

##### Share on other sites
plus there are tuts over at NeHe and gametutorials.com about rendering heightmaps, should be a good start. Plus over at gametutorials he has alot of camera tutorials, which could help with your free movement. As for ROAM, that is what i am preparing to do with my terrain, hopefully...later-

what we do in life... echoes in eternity...

##### Share on other sites
Thanks guys, I''ll keep reading up... What about the double platform problem? Heightmaps represent only one level of height, what happens when you need to have two vertices above each other? Like my previous cliff-face question?

I''m not sure whether I''m explaining it properly mind.

tia,

dammit

##### Share on other sites
Thanks guys, I''ll keep reading up... What about the double platform problem? Heightmaps represent only one level of height, what happens when you need to have two vertices above each other? Like my previous cliff-face question?

I''m not sure whether I''m explaining it properly mind.

tia,

dammit

##### Share on other sites
Oups you''re right
Supperposing 2 heightmap if you have 2 level in a huge part of your world. And using meshes if just local. Or local heightmap why not.

_______________

Jester, studient programmer
The Jester Home in French

##### Share on other sites
Hmm, I'm getting into this now. Your solution works fine if I just want two levels to my terrain, like an upstairs/downstairs scenario. But a cliff face could have 10s of vertices with the same x,z values and just different y values. So, here's a thought (although potentially unimplementable, I wouldn't know):
Define your usual height map but allow for a deliberate non-gradual gradient from high to low where a second heightmap could be assigned. This heightmap would be as wide as the cliff face and as long as it's height. So you'd have 1 heightmap for the overall x,z terrain and then assign n amount of other heightmaps for the y,z plane to be used for the cliff-face, yeah? Basically, a cliff-face is just a heightmap in the y,z plane isn't it? I'm not sure whether you'll get what I'm babbling about so I might try and draw some diagrams. I reckon it could work.

tia,

dammit

Edited by - dammit on February 25, 2002 4:08:51 PM

##### Share on other sites
I am not sure if the need for two heightmaps would be necessary to gain a cliff, you could accomplish this with some good texturing i think, though it may be tricky. You may not have exactly what you are talking about, meaning having the verticies directly over verticies, but i think you could simulate a steep cliff with just a regular heightmap.
One way to do this is to calculate steepness of a mountain, and if it is steep enough, say 90 degrees for a cliff, you could apply a texture to it.
THere is a good technique called procedural texture generation, go here to learn about it

http://www.flipcode.com/tutorials/tut_proctext.shtml

I have implemented this into my terrain project, and i like it alot,
and here is another article which may help too.

http://www.flipcode.com/tutorials/tut_terrtex.shtml

Dont know if that is what you are lookin for, but i think one heitmap is the way to go, later-

what we do in life... echoes in eternity...

##### Share on other sites
Thanks for the articles, I''ll check them out. I''m not after a realistic cliff face from a merely aesthetic perspective, I''m wanting it from a gameplay perspective. Without having the ability to have two vertices (more preferably) parallel in the x,z plane you cannot have a cave in said cliff face or an overhang. Cliff faces cannot be 90 degress or more, like | or /, because of the heightmap. Putting a detailed texture over it is sufficient for the aesthetic is fine but for tactical gameplay reasons it falls short. I think I''ll write an article on my idea and post it in this thread cos I''m pretty sure I haven''t explained myself correctly :/
Anyway, cheers for taking the time to help,

tia,

dammit

##### Share on other sites
I''m not sure if this''ll work at all (just came to me while reading the posts. It seems like what might work best, would be not two heightmaps, but three. If you''ve ever seen an architect, or engineer, or 3D modeler''s layouts, they include a top, side, and front view... with these three views, they can reprisent the model exactly.

However, if you implement your system this way, you''re going to have to make sure the maps are consistant (meaning they line up, and are to scale with eachother) or you''ll end up with an ucky map that just wont look right.

Again, I have never implemented a system even CLOSE to this, I''m just trying to problem solve here. It sounds interesting though, let me know if you try this method, I''l love to see it in action.

-Lonely

##### Share on other sites

Usually the height map data all point "up". Why not have a height map where, instead of always assuming they are pointing up, you use a normal that can point into any direction.

Let''s say your terrain is divided into smaller grids (or patches) of sub-height maps. Each sub-grid has one additional normal. For most cases, the normal would point up, and you simply calculate the vertex position by multiplying the current height entry with the normal. This would give the same result as simply not having the normal, like in a regular height map.

Now, you can point the normal for any grid into any direction. It can point sideways, so that you can create an overhanging cliff, for instance, or even a cave.

Now if you do this, you will need to make sure the edges of the grids line up with the other grids. Maybe you can do this with specifying the 3D location of each of the four corners of the grid. This way you can even have an upside-down height map.

Imagine a large hill with overhanging cliffs, where many smaller patches are "wrapped" around the terrain. Each patch knows it''s four corners, which join up with other patches around it. Some patches are sideways, with normals pointing to the side, while others are even upside-down, with normals pointing down.

Maybe you can have grids of varying size, and with a flag to turn off the calculation with the direction normal. This way, you can have large patches for open areas that do not use overhanging cliffs, and therefore do not waste time on the additional calculation. So this would result in about the same performance as any other algorithm. But some patches will have the flag turned on, in which case the additional normal is also taken into consideration to rotate the patch.

You get the idea...

But how does one create such a height map? Bitmaps with height data would not work too well. Maybe in the level editor you can "stretch" the patches into new orientations?

Or use some form of simple model editor where each rectangular polygon represents one patch. Scale the model up to your terrain size and overlay this then with the regular bitmap that stores the usual height detail, and use each rectangular polygon for the four corners of the patch (auto-create the patches). The normal of each polygon becomes the normal stored in each patch. This implies the points in the patches are not equally spaced, but that’s easy to deal with (you have the four corners).

Hmm, I can go on... I''m going to update my height map now...

SS

##### Share on other sites
2 ideas.

First, you can use a regular heightmap for the general terrain and an overlayed "detail" heightmap where you need cliffs. This detailed heightmap is actually 2 heightmaps, the first representing the upper limit of the terrain and the second representing the lower limit. Treat the area between the 2 as solid space. This is kind of like voxels I suppose.

Secondly, if the overhangs are specific and sparse, treat the whole mountain, overhang, and cave as a regular model. Depending on the size or detail, you''ll probably need decent culling for an object that large.

##### Share on other sites
not exactley a robust solution (sticking to using image editors to create terrain)

but you could use primitives to cut holes into the terrain, or make slices, or whatever you want... subtracting and permanently changing that part of the terrain...

you''d have a heightmap, that filled up all spaced that will ever need to be filled, then define primitives that will go in and cut out parts, slice parts, cut, dig, or hollow, whatever you want, and its up to you to decide how to save that data

then just write your routines to load the heightmap as regular, make all the cuts saved, then render

you wouldnt be able to use the easly-to-code brute force method of rendering anymore though, and that would suck (in my opinion)

im currently looking at defining additive heightmaps, which just hook onto the heightmap that you already have, which define caves and mountains and things that your regular heightmap wont let you do (without tons of technology involved)..

im also thinking of this concept i came up with called "natural land geometry generation"... its based off of heightmaps, except it uses colors, and allows you to define over hanging cliffs, caves or caverns, and other types of geometry, defined in regular 2 dimensional images along with an xml file which clarifies how to draw the colors in real time.. ill get back to you when i get it done, cuz its probably going to be a long time, lol

##### Share on other sites
just a thought, don''t normal maps store the normal data in colors? So why couldn''t you do the same?

so you have a RGBA (or ARGB) image.
Use the alpha for the height and each of the R,G and B for it''s own dimension. like XYZ. there you go, you can store the normal that way.

Though I have no idea how to make a good lanscape out of those, just wanted to point out that the image part isn''t your problem.