Archived

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

NeXius

Making True Terrain

Recommended Posts

Hi, I''m in the designing stages of a game right now... and I can''t get something right I want to include large outdoor scenes, with large cliffs, holes, maybe caves... which is a problem because heightmaps can no longer help me I''m not sure I want to learn something like voxels as this would complicate things and I''d rather focus on gameplay So, I came up with this: I design and code a simple level-editor that starts with an initial heightmap. I can then modify the position of each vertex or add new faces to create the cliffs, caves, whatever. And store all the vertex locations with texture coordinates and normals in one big honking file. Will this work?

Share this post


Link to post
Share on other sites
Here is just something I''m coming up with,.

perhaps use the height maps.
and basicly define a level, and place it on the map
and the level will make a cutout from the height map
eh?
just define a box or write code to find a box that is tight to the edges of your level... and cut all vertices that fall within that box and interpolate all triange vertices that are in and outside the box.
kinda like octree rendering if that helps
i gotta go
Lemme know what you come up with
Andy
Hope this helps.
andy@leadant.com

Share this post


Link to post
Share on other sites
The terrain engine I am writing right now (or am going to write as soon as I finish other sections of my engine), allows caves by linking heightfields together in a tree structure. Another cool way that seems viable is a voxel landscape. Check the IOTD on flipcode from a day or two ago.

Gamedev for learning.
libGDN for putting it all together.

Share this post


Link to post
Share on other sites
I''m sorry I don''t understand either of those!

And as I said I don''t want to make it a voxel landscape... I want to keep things simple and actually complete this thing =)

Could you please elaborate on your way of achieving this?
Thanks for your replies!

Share this post


Link to post
Share on other sites
www.vterrain.org is good for everything landscape like, you might want to try octrees instead of quad trees if you want to add layers like caves and so on, do a google search and check the gamedev artciles (gamasutra have soem I think).

Ballistic Programs

Share this post


Link to post
Share on other sites
Ok here is what i meant.

-You have a 8 bit heightmap. maybe 1024x1024(+1) or whatever.
-You also have a level. For our purposes say it is a box.
+A box in a file that you load.
-Somewhere in code or in that file or whatever your heart desires you load the position that this level ( the box ) and it''s position relative to your heightmap.

now you have a box and your heightmap
oh.. when i say level i mean box and when i say heightmap i mean terrain and vice versa

if you were to render this right now... perhaps walk within your box ( if it has a door or whatever ), chances are your terrain would be coming through the walls. ( obviosly based on where the level is. But since you wanted CUT INTO THE terrain.. you would probably have some terrain lapping into your box.

From here you would just want to clip all the vertices that fall within your box, so your terrain doesn''t come inside.

This is where i touched on octrees.
If you have a triangle whos 3 vertices which define it are within your level... you can simply remove that triangle and all of its vertices. However if you have a triangle whos has perhaps one or two vertices within the level.. and one out.. you will want to reshape the triangle and not simply remove it. Otherwize you would get a bunch of jagged edges around the mouth of the terrain and your level. So you will want to interpolate these new points. I said octrees because if you lookup, data on that, they explain that you need to trim triangles. So that might be a good place to begin looking for an algo on how to reshape your triangles.
I hope this was clearer. I may have been a bit wordy and not well thought out, but the idea should be there.
Email me if you have any more questions.
andy@leadant.com
Andy


<< XP SUCKS >>

Share this post


Link to post
Share on other sites
For overhangs why not use heightmaps and create overhangs as separate 3d objects, which you place by hand so that they appear to be attached to the terrain? Hmmmm, you might not get smooth texturing though. The overhang object may actually sit partway underneath the terrain, but I''m sure you may still see the join. So this probably isn''t a good idea! It seemed like one when I started typing this!

Cheers!

Share this post


Link to post
Share on other sites
heh... I considered models too, but I don''t think I could pull it off without having it look like crap

skillfreak, I really like your idea (now that I understand it =)

Problem is connecting the level to the terrain smoothly, right?

I''m taking www.gameinstitute.com''s bsp/level-editor course right now so I''ll probably learn all about carving objects into levels, but this is what I''m thinking of right now:

Actually first I was thinking of just lining up the box with a point on the terrain where dividing up triangles wouldn''t be necessary (it would be set up in a triangle-strip pattern with nicely organized columns and rows) but then I wouldn''t be able to apply any LOD on the terrain... if you know what I mean

So what if I set up every ''level'' to have four basic polygons--one along each edge--and then subdivide those polygons to attach to each vertex produced when a triangle intersects the box... Four basic polgons being something like this:
http://www.alientrap.com/neproxource/thing.jpg

Does that make any sense at all?

Share this post


Link to post
Share on other sites
I don''t know about the cliffs and such, but for caves/holes you would probably be better off using portals. If this terrain is for in game graphics, it would speed up the frame rate a bit if you use portals.

Share this post


Link to post
Share on other sites
I''m not %100 certain that what I''m about to say will make much sense, but what the hell...

If I remember correctly, the guys that made Drakan (Fabulous Game by the way) used multiple height maps layered over each other to make their levels. You''d have one height map representing the floor, walls, bumps in the ground, etc... and another representing the ceiling. You could even make more floors and ceilings to create different floors and cliffs and varying heights. Crypts and dungeons and such were built up from seperate objects (You had different kinds of brick walls, stone floors and such).

All of this comes from messing around in the editor, so I''m not certain that this is how they did it. Sounds like something that may be fun to experiment with though.

As for the engine I''m working on. The geometry is created in a 3D Modelling program (E.g.: 3D Studio Max) and imported into the engine, where it is then run through an octree. At least that''s the way its going to work once I finish up a few other things and get started on it. I plan on being able to store the resulting Octree in a file so that it doesn''t have to be regenerated every run, as well as implementing some sort of LOD on each node. I suspect some sort of occulsion culling will be useful to in order to get rid of the caves and mines while stomping around outdoors.

Share this post


Link to post
Share on other sites
Well, for this game I want to have really massive outdoor levels so I want to be able to implement some LOD... so that basically rules out loading a bsp or a 3ds level

Multiple heightmaps sounds feasible, but maybe I'll just not include caves or overhangs and just concentrate on fixing the texturing problem with really steep cliffs

I'll build a program to generate the texture coordinates based on the area that the triangle covers, instead of just the area as viewed from above... In effect fixing the texturing problem

and generate a texture based on slope, height, etc. (I know there's some papers out there on that)

Suggestions? Comments?

[edited by - nexius on November 10, 2002 9:43:45 PM]

Share this post


Link to post
Share on other sites
The huge-scale terrain engine I''m designing (as a very background project, school''s gotta come first) is based on a big quadtree-sorted list of bezier patches, with some limitations for performance. But the limitations can be disabled on a per-patch basis, and thus overhangs, cool terrain features, and much more is possible.

I''d considered once adding a CSG element, subtractive shapes, that I would use to punch holes in the terrain, so that buildings could have basements without manually adding and manipulating the terrain patches to "fit" the building.

I think I considered that because I wanted to be able to blow the buildings up, in-game, unscripted, and simply remove the subtractive "base" of the building when I remove the building.

Whatever the case, bezier patches are an incredibly memory-efficient way to store massive and detailed maps, and very easy to implement LOD for. Just a thought.

Share this post


Link to post
Share on other sites
cool!

I have a few questions though.

1. Is there any advantage in using a quadtree with this particular method as opposed to an octree?

2. Wouldn''t the fact that the edges around these patches must always exist on the same plane make it look kind of cheesy?

3. Could you maybe use a heightmap to position the vertices making up each patch to solve this problem?

4. Since it''s a mathematical function, would this make collision detection any easier?

Share this post


Link to post
Share on other sites