Skip to main content
GameDev.net gamedev.net
🔒 Locked

terrain generation

Started by u235 Dec 14, 2005 at 6:52 AM 4 replies 550+ views
Original Post
u235
u235
Ok, so just so I am clear how terrains and heightmaps work: A height map is a grayscale image and the color of a given pixel indicates the height of the terrain at that given point(ie. a hill can be defined by light grey that gradually increases to a darker grey or black) and this basically represents all of the vertices of the tris that will make up the heightmap. And for larger or smaller terrains you would simply multiply the distance between all the vertices by a scaler(ie. for a given heightmap, multiplying the distance between all the vertices(1 for the base heightmap) by, say 3, would give you three times the distance between vertices and thus a 3 times larger terrain). Is this right or am I confused? I have never worked with terrains and heightmaps before. Thanks. -AJ
V/R,-AJThere are 10 kinds of people in the world: Those who understand binary and those who don't...
Neex
Neex
Yes that sounds right.

However an alternative way of having smaller/larger terrains is to have smaller/larger heightmap images. That way the amount of detail in the terrain stays the same.
u235
u235
Thanks. It's good to know I'm not all jacked up on the concept. I also wanted to present a couple of ideas I had concerning heightmaps. I'm not sure if this is still a problem, but I seem to remember deformable terrains being somewhat of a problem among game developers. My idea to remedy this is that whenever an event occurs that will change the terrain, find out where the event happened, then reload the heightmap, programtically change the color values of what needs to be changed, make the appropriate changes to the vertex buffer and your terrain will be deformed.

The other idea is actually more of a question. Would it be feasible for 3D models to be described using a sort of heightmap system? Like from front to back, the pixels that define the model at a given depth are drawn as a bitmap, then you programtically cycle through the images to come up with a full 3D model. This could possibly eliminate skinning issues because the skin info could just be part of the images(ie. for a given depth, the pixels drawn will be the colors actually used for what the model should look like in game). That sounds less feasible than my first idea, but I thought I would throw it out there, because I am always looking for better ways to do things.

-AJ
V/R,-AJThere are 10 kinds of people in the world: Those who understand binary and those who don't...
haphazardlynamed
haphazardlynamed
Unfortunatly, things are not so easy.
The proposal to simply add changes and reload terrain will probably be too slow for a good sized terrain.
It works for a small project, but once your terrain starts to get big, like commercial game big. You will start Needing a more complex way of representing and rendering it, which is the typical reason why terrains are not changeable.

There are of course ways of accomplishing large scale deformalble terrain, it's just a a lot more complicated, look into an algorithm called ROAM, I belive that was the first one to really make it possible.


As for your 3d Modeling via 'Heightmap' Slices idea.
This sounds like "Voxels". Read about them and see if thats what you wanted.
As far as I know, they aren't used all that much in commercial games since 3d hardware is so polygon friendly. They are mostly used for terrains where there are lots of soft curves (not too detailed).
Part of the problem is even if you use this kind of system to build your model, for the videocard to actually render it you will need to convert to a polygon system Yourself. Meaning you'd have to run some Marching Cubes algorithm to calculate where the polygons that match the surface should be, as well as create/calculate traditional 2d texture maps to match your colors. -but that defeats your intent of avoiding skinning, since youre basically creating one right there.
u235
u235
Thanks for the info. Well, it may not work that well, but at least I am a little wiser knowing it's probably impracticle and thus can focus my efforts elsewhere. Thanks again.

-AJ
V/R,-AJThere are 10 kinds of people in the world: Those who understand binary and those who don't...
haphazardlynamed
haphazardlynamed
Don't get discouraged just because an idea has already been tried out before. Reinventing the wheel just shows that you're thinking in the right directions.

While your motive of avoiding skinning models doesn't necesarially apply, you might still want to investigate other uses of Voxels. Terrains created using them have the potential to have features impossible with traditional heightmap terrain, such as caves and overhanging cliffs.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.