Results 1 to 10 of 17

Thread: Reverse Quantizing, AKA - how to get a heightfield from contour lines

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default

    I think this is a good place to explain in more detail what I've already done about this; I've written a Python script which will interoplate between contours in a rather vanilla way. For each point not on a contour, it finds the closest points to the contours on either side and calculates the height according to the distances to these points, so if a point was halfway between the nearest points on each of the 1000 and 2000 metre contours, it would be set to 1500 metres. Points within the topmost contour line are interpolated relative to the top two contours, which seems the only sensible thing to do.

    This works well enough for a first approximation, but it lacks detail and isn't very useful for my purposes, which require a lot more realism. I tried to make the results more realistic by incorporating some plasma-generated landscaping, without much success. Ideally my program could take a quantised heightmap, interpolate in between the discrete levels, and apply some magic to generate realistic-looking mountains and so on. Any ideas?

  2. #2

  3. #3
    Guild Artisan su_liam's Avatar
    Join Date
    Aug 2007
    Location
    Port Alberta, Regina(IRL: Eugene, OR)
    Posts
    798

    Default

    Funny coincidence. I've just been working on a similar problem. I was playing around with a heightfield I found on the net(I've been looking into the possibility of stitching together real-world heightmaps and subtly altering them to produce interesting and "realistic" extraterrestrial landscapes). The heightmap had serious stairsteps so, in Bryce, I used several iterations of the smoothing, noise, erode and eroded tools to obliterate the steps(mostly), and then applied a fractal at very low opacity on top of that. Thus far my methods aren't at all systematic(just to taste) and won't necessarily maintain the original landform with great fidelity.

    Attached, I have an image generated from the original hf at upper left. From lower right clockwise: a heavily modified version(this was my second try, I lost the first one, which was my favorite ), a less modified version, and on the upper right a minimally modified version(this is about as much of the original structure as I could maintain without obvious stepping.

    I'll try to add individual closeups and heightfields later. I'll also try to work out my methodology. This really isn't interpolation(since it doesn't maintain the existing contours), it's more like draping a canvas over a frame. Only the frame can get a little whacked out of shape.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	interpolation3.jpg 
Views:	127 
Size:	1.37 MB 
ID:	1803  

  4. #4

    Default

    su_liam-

    Can you post that original heightfield (as b/w or contour lines)?

    It would be nice to have a standard example to play at with different techniques and compare the result.

    -Rob A>

  5. #5
    Guild Artisan su_liam's Avatar
    Join Date
    Aug 2007
    Location
    Port Alberta, Regina(IRL: Eugene, OR)
    Posts
    798

    Default

    Quote Originally Posted by RobA View Post
    su_liam-

    Can you post that original heightfield (as b/w or contour lines)?

    It would be nice to have a standard example to play at with different techniques and compare the result.

    -Rob A>
    They're jpeg and not my original 16-bit tiffs, but here you go...

    interpOrig.jpg is the original. Mmm, duh?
    interpHeavy.jpg is the one at lower right.
    interpModerate.jpg is the one at lower left.
    interpLight.jpg is the one at upper right.

    edit: just noticed how bryce pooped all over the original aspect ratio. Sorry 'bout that.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	interpOrig.jpg 
Views:	62 
Size:	13.8 KB 
ID:	1804   Click image for larger version. 

Name:	interpHeavy.jpg 
Views:	79 
Size:	29.6 KB 
ID:	1805   Click image for larger version. 

Name:	interpModerate.jpg 
Views:	68 
Size:	27.3 KB 
ID:	1806   Click image for larger version. 

Name:	interpLight.jpg 
Views:	63 
Size:	28.0 KB 
ID:	1807  
    Last edited by su_liam; 11-29-2007 at 02:37 PM.

  6. #6

    Default

    Quote Originally Posted by RobA View Post
    Bricka-

    How slow is it to process a large image?
    It certainly wouldn't win any awards for speed; a file of a million pixels takes a few minutes.

  7. #7
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,201
    Blog Entries
    8

    Post

    In terms of stitching arbitrary height maps may I point you at some work done by Howard Zhou who has been working on this sort of thing for a while...

    http://terrain.cg-arts.org/forum/ind....msg821#msg821
    http://www.howardzzh.com/research/terrain/

    To keep it simple, I believe he is finding the closest path between two maps and cutting along them - a bit like photo stitching I think. I reckon there is a lot more to it tho. Its unbelievably awesome actually. Anyways there is a world machine plug in to do it.

  8. #8
    Professional Artist
    Join Date
    May 2007
    Location
    Wisconsin
    Posts
    186

    Post

    Quote Originally Posted by Redrobes View Post
    That looks amazing. Being a professional cartographer I have a very large supply of real-world DEMs to use as source files, and it looks like this is just the application to create the mountain ranges, valleys, canyons, etc. for my world. But I could not find the download.

    I WANT.

  9. #9
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,201
    Blog Entries
    8

    Post

    The public interface to this utility is a plugin for WorldMachine.

    http://www.terrainsynthesis.org/worl...rger/index.htm

  10. #10
    Guild Artisan su_liam's Avatar
    Join Date
    Aug 2007
    Location
    Port Alberta, Regina(IRL: Eugene, OR)
    Posts
    798

    Post SDA: a first test.

    Okay, here's my experiment.

    First, I took the quantized image and applied a 2.5-pixel Gaussian Blur to start. Next, I applied the Spatter filter at a radius of 8 and a smoothing of 1.

    Next, I tried a smaller 1.3-pixel blur, and a spatter at the same settings as before. I repeated this a couple times.

    I finally did a blur at 2.8 pixels to reduce the spots a bit.

    This is what I was thinking of calling my Stochastic Deterrace Algorithm. I'm not sure how satisfactory this is. What do you think?
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	hf_q_SDA.png 
Views:	52 
Size:	29.8 KB 
ID:	2331  

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •