Heightfields and caves/overhangs

Hi,

is it theoretically possible to have also caves and overhangs in a heightfield generated terrain?

How would you encode a cave in a single height value?
For in-cave scenes one method would be to add another heightfield for the ceiling.

Actually, i thought about using even two more heightfields
I was just wondering if someone ever did that. If not, here’s my idea:

Use an RGB image instead of a grayscale and use the channels as follows:
Red Channel == Normal height map as commonly known
Green channel == Cave/Overhang “floor”
Blue channel == Cave/Overhang ceiling.

Can anyone confirm that this might work? What could the pitfalls of that be (except not being able of having two caves above each other of course) ?

An example scheme can be found on my page .

[This message has been edited by iLLuminatus (edited 05-30-2001).]

What is the rule for the filled area in the second image on your page?

I’m guessing that cave-ceiling = cave-floor for the solid areas. Once you do this you can abstract and compress out all of the other vertices.

Siwko

Originally posted by Relic:
[b]What is the rule for the filled area in the second image on your page?

[/b]

The filled area displays the actual terrain you will get using that method. IF it works out, which i will try tonite and the next days.

Originally posted by Siwko:
[b]I’m guessing that cave-ceiling = cave-floor for the solid areas. Once you do this you can abstract and compress out all of the other vertices.

Siwko[/b]

Well, basically i was thinking about a line-by-line processing of the image data and creating one vertex per pixel. when certain conditions are met (like cave_floor meets terrain) then the terrain values aren’t going to be processed (until cave_ceiling meets terrain), thus the “hole” in the terrain will appear…
I will try an openGL implementation using quads or triangles and post the results on that website.

[This message has been edited by iLLuminatus (edited 05-30-2001).]

The problem is: how would your engine know to show the cave opening? If it renders each layer solid, the top ground will cover up the cave entrance.

not necessarily. we do not render every layer solid. the diagram i made shows it (the image with the brownish filling):

first, we process the terrain normally (red line), but when we discover that we’re intersecting with a cave floor, then we turn off the following ground triangles. when our ground intersects with a cave ceiling (blue line), we turn it back on. Also, the normal ground has a hole where a overhang appears, the overhang just covers that hole seamlessly.

please note: that method is meant for one time terrain creation at the moment.

there’s a whole sequence of checks involved to make sure nothing overlaps etc.

for example:

//cave starts (take the diagram as a reference, following the red line)

if(red==green && red < blue && green<blue) {
render_cavefloor = true;
render_ground = false;
render_caveceiling = false;
}

//then most probably the ceiling intersection will be encountered

if(red>green && red==blue && green<blue) {
render_cave_floor = true;
render_ground = true;
render_cave_ceiling=true;
}

//and so on…

You should think of a ‘vertical tracing’ method, like “x-raying” thru the three colors. i’ll take a cave for an example:
when looking onto a hill from above (one that has a cave), then you will first encounter the hill’s surface, the next would be the cave ceiling, then comes the cave floor. we’re creating three triangles in this case, one for the ground, one for the ceiling and one for the cave floor…

did i make any sense?

[This message has been edited by iLLuminatus (edited 05-30-2001).]

My approach to overhangs, caves etc. has been to go to a true voxel representation.

You can download a cave modeling program Cavernosa, based on voxels, at my we page here: http://www.btinternet.com/~andrew.h.cox/Cavernosa/index.html
BTW, that version is a little old and lacks a few things like mesh export which the build on my HD has.

Andy

a few questions:

  1. is that screenshot actually showing a 3d accelerated “terrain”?

  2. What’s the basic procedure of doing something like that?

  3. Can i have the source codes please?

>1. is that screenshot actually showing a 3d accelerated “terrain”?

Well, it is running through SGI’s software OpenGL implementation but it is pumping out triangles not directly rendering the voxels.

  1. What’s the basic procedure of doing something like that?

There’s a link under the first pic to a paper at Stan Mellax’s site which I followed and which was one of my inspirations (well actualy the demo he produced was the inspiration but the paper was good to have).

  1. Can i have the source codes please?

Ask Stan . Or ask Jack Strohm who’s GEEK game engine inspired by the same demo has a link from my site (he at least runs LINUX, I’m a Microsoft user: Nuff Said).

Andy

Addition to the method described on my webpage:

Referring to the schemes:
I found out that using the blue channel as floor and the green one as ceiling gives the best results. In fact, the effect of a terrain created with that method is simply astonishing (didn’t think it would work out like this). When i’m done refining the techdemo (or whatever such things are called), i’ll provide the sourcecode of course.

Maybe there’s someone out there who knows how to optimize it