The Idea

Started by
17 comments, last by Azzier 18 years, 10 months ago
Common landscape generation methods have one drawback - they cannot be used for creation of landscapes with caves or even straight vertical surfaces. The idea is in taking two additional maps (I call them displacement maps) and modifying the height-map-based landscape, using those maps. The formulas look like (i+DispX[j],Height[j],j+DispZ[j]). Thus, caved landscapes can be created. I have tried this approach with three maps, that were created with perlin noise. It works. :) What do you think about it?
Advertisement
Sounds interesting, do you have any examples? Like images perhaps :)
Exitus Acta Probat
ehh, i dont get it. please explain in more detail. with screenshots etc (you can upload screenshots at imageshack.us)
edit: ohh hmm i think my brain is starting to work now... but i dont see how it will work with 'caves' especially complex ones where you would normally use an (portal based) indoor renderer


T2k
If I understand you correctly, it is a good idea - but it isn't perfect.

I was talking about something similar (I think) in my journal a week or so back. Basically you have a low-resolution heightmap that defines the general shape of a landscape. Then, for each "sector" in that heightmap you have a secondary heightmap. This heightmap, rather than being based off the same (flat) XZ plane is based of the plane defined for the sector by the first heightmap. If you also offset it so that the second heightmap is -1.0f <-> +1.0f you can generate your caves, cliffs and overhangs.

I really like the idea - regularly spaced heightmaps can look good this way, and at the same time you get the advantage that they fit a lot of computer algorithms very nicely. Meshes can create stunning landscapes, but they're (usually) more difficult to author, and aren't so easy to program for.

Or am I going off on the wrong interpretation here? [smile]

Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

"Sounds interesting, do you have any examples? Like images perhaps :)"
err...Yes. I just didn't know, how to show them here. :) I have a demo-version (just landscape and texture) and some screenshots.

Screenshots:
[img=http://img297.echo.cx/img297/1827/image003.th.jpg] [img=http://img297.echo.cx/img297/6699/image009.th.jpg] [img=http://img300.echo.cx/img300/4413/untitled17dn.th.jpg]

"but i dont see how it will work with 'caves' especially complex ones where you would normally use an (portal based) indoor renderer"

Image with left arrows shows the idea. It's only for one displacement map, but Z-displacement is much similar.
You take the point and move it in some direction on X axis. As two points can have equal X and Z coordinates, and different Y coordinates, vertical surfaces can be made. If you move the point further, you can have any cliff-or-cave structures. :)

"If I understand you correctly, it is a good idea - but it isn't perfect."
Nothing is perfect in this world, and this is really good. ;)

"This heightmap, rather than being based off the same (flat) XZ plane is based of the plane defined for the sector by the first heightmap. If you also offset it so that the second heightmap is -1.0f <-> +1.0f you can generate your caves, cliffs and overhangs."

Now I am trying to understand. Which plane is defined by the first height map? I really can't see. :( I have looked in your journal, and still I don't understand.
My explanations are above in this post. If they are too obscure (and this can be....), or something is wrong, please, tell. :)
Quote:Original post by Azzier
Screenshots:
[img=http://img297.echo.cx/img297/1827/image003.th.jpg] [img=http://img297.echo.cx/img297/6699/image009.th.jpg] [img=http://img300.echo.cx/img300/4413/untitled17dn.th.jpg]

These forums use the <img src=""> HTML tags to embed images:








EDIT: Dunno why, but some of them aren't working for me [oh]

Quote:Original post by Azzier
Quote:This heightmap, rather than being based off the same (flat) XZ plane is based of the plane defined for the sector by the first heightmap. If you also offset it so that the second heightmap is -1.0f <-> +1.0f you can generate your caves, cliffs and overhangs.


Now I am trying to understand. Which plane is defined by the first height map? I really can't see. :( I have looked in your journal, and still I don't understand.
My explanations are above in this post. If they are too obscure (and this can be....), or something is wrong, please, tell. :)

I think my idea needed an image to describe what I was on about. I can't really think of a better way to describe it with words [sad]. I'll have a go at drawing up a couple of diagrams when I get time later today.

Cheers,
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

Do not call them Displacement Maps ... that name is already well established as far back as the "The Reyes Image Rendering Architecture" (Cook et al. 1987). To be more precise it was first mentioned in the "Stochastic Samping for Computer Graphics" (Cook, 1986).

Just thought you would {like to, should} know.
"EDIT: Dunno why, but some of them aren't working for me"

Maybe I can say something helpful? :)

"I think my idea needed an image to describe what I was on about. I can't really think of a better way to describe it with words . I'll have a go at drawing up a couple of diagrams when I get time later today."

Where to look for them? In you journal?

P.S. thanks for help with images
P.P.S. i will be glad to upload my demo, guess it'll be more helpful, and it allows some experiments with method. but where can I upload it?
You can pack X/Y/Z values into RGB textures and what you have essentially is a displacement map.

This works OK for simple situations, but:

  • One of the nice things about traditional heightmaps is that it becomes very easy to do collision detection, as you can quickly calculate the height of the terrain at a point. You can't do that with this.
  • They're not very nice to author. Give an artist a simple height map and he can quickly flatten things out, create peaks and troughs, etc. With this approach he basically has no option but to drag points around in 3D, which is much slower.
  • Your topology is still the same as a regular heightmap, so while things like caves are possible, you're doing it by 'folding' a hill over itself. If you're trying to do a complex cave system, more and more of the actual hill surface will be 'sucked' into it. You really need to be creating more polys for that kind of situation, not moving existing ones.
  • Simple spatial subdivision techniques like quadtrees are rendered useless by this - you can't guarantee that the region of the map bounded by a quadtree rectangle is contained within that rectangle, or that texels outside that region don't actually lie within it.
  • It seems like you're going to have texture stretching issues. You can create a high cliff by displacing a pair of vertices to lie directly above another pair, but the texture between the two will be the same as any other quad on the landscape.


I had the same idea as you a while back, but when I thought about it I realised why nobody was really doing it [smile]

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

Original post by superpig
You can pack X/Y/Z values into RGB textures and what you have essentially is a displacement map.

This works OK for simple situations, but:
Quote:

  • One of the nice things about traditional heightmaps is that it becomes very easy to do collision detection, as you can quickly calculate the height of the terrain at a point. You can't do that with this.



Maybe, some precalculation'll help? I'll think about it. This is harder, as you have more complex structure now. And collision detection doesn't like complex structures, you know.

Quote:

  • They're not very nice to author. Give an artist a simple height map and he can quickly flatten things out, create peaks and troughs, etc. With this approach he basically has no option but to drag points around in 3D, which is much slower.



I don't think so. I have tried different variants, including those with three independent maps and those with hand-drawn maps. It's not that hard to draw them, although you really need some practice - and not so long one.
You can see peaks and valleys on your height map, and you can control them with your displacement maps (is it really a copyrighted word?! That's strange. I never knew that - and if it's not, I can use my own word as synonim).

Quote:

  • Your topology is still the same as a regular heightmap, so while things like caves are possible, you're doing it by 'folding' a hill over itself. If you're trying to do a complex cave system, more and more of the actual hill surface will be 'sucked' into it. You really need to be creating more polys for that kind of situation, not moving existing ones.



Surely, I need it. To have more complex structure with same "resolution" I need more polygons. And to add caves "as they are", in any 3d modeling software to a landscape, I need more polygons.

Quote:

  • Simple spatial subdivision techniques like quadtrees are rendered useless by this - you can't guarantee that the region of the map bounded by a quadtree rectangle is contained within that rectangle, or that texels outside that region don't actually lie within it.



Yes, I can. Although it's not so efficient. You see, if you use grayscale maps, you can have only values, belonging to [-128,128]. So, no displacement value can overcome this distance. And you can calculate precisely the max values positive and negative values on map before you start drawing. Guess, it's not that priceful.
And no, I can't guarantee, that something from outside regions doesn't lie withing. But I can check all regions, using almost standart methods, and have the same results.

Quote:
  • It seems like you're going to have texture stretching issues. You can create a high cliff by displacing a pair of vertices to lie directly above another pair, but the texture between the two will be the same as any other quad on the landscape.



  • Err, yes. I am working on this method, you know, and trying to solve problems. Some are easy to solve, some are not....

    Quote:
    I had the same idea as you a while back, but when I thought about it I realised why nobody was really doing it [smile]


    ....But if I stop, I'll create nothing. This is an interesting approach, and I am going to explore it. And I am grateful for comments, especially the texture stretching one. Between, what do you mean - will be the same? Why shouldn't it be? First, I thought - oh, it'll be stretched, and it'll be, but is it so awful?

    This topic is closed to new replies.

    Advertisement