Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 36

Thread: Working on a ambitious world generating tool...

  1. #21
      Nickadimos is offline
    Guild Apprentice Nickadimos's Avatar
    Join Date
    Oct 2008
    Posts
    40

    Post Breakdown

    This is a simple as I can make to show the difference between the My method and the L3dt method..

    The Blue line is the path that L3DT would take.

    The Red Line is the path mine would take.

    Terry
    Attached Thumbnails Attached Thumbnails Working on a ambitious world generating tool...-paths.jpg  

  2. #22
      Wordman is offline
    Guild Member
    Join Date
    Sep 2007
    Posts
    58

    Post

    Quote Originally Posted by Nickadimos View Post
    This is a simple as I can make to show the difference between the My method and the L3dt method.
    That's exactly the correct image to illustrate the difference. Unfortunately, if you spilled water on the white triangle, the vast majority of it would almost certainly follow the blue line, not the red one.

  3. #23
      covatex is offline
    Guild Novice
    Join Date
    Nov 2008
    Posts
    16

    Post

    Let me see if I get Nickadimos's algorithm right:
    1.- Find the highest, lowest and mid points
    2.- Let one highpoint be the actual pixel
    3.- Starting from an actual pixel, test the 8 non-used adjacent pixels looking for the lower color (or altitude) that is the closest to the starting center point. (Not the lowest one, but the color closest one, in other words look for the minimun nonnegative difference between the center and the 8 neighbors)
    4.- Mark this neighbor "used" and make it the actual one.
    5.- Repeat from 3 until we reach one nonmarked midpoint pixel, or we get out of the map. Mark this midpoint
    6.- Do the same, but in reverse order from a lowpoint until we reach a midpoint

    Is that correct?

    If so, I'm not getting the expected results... Look at the pic...
    Attached Thumbnails Attached Thumbnails Working on a ambitious world generating tool...-test.jpg  

  4. #24
      Redrobes is offline
    Software Dev/Rep Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    4,763
    Blog Entries
    4

    Post

    If your able to run this through then it would be great. I was expecting to have to write something to show what it might do later this evening so if you have the framework available that would save me some time. Are you able to show whats happening with zoomed up tiles so that the black line doesn't obscure the height map underneath. If not, are you able to show the height map before the line was drawn too so that we could clip out that section and follow it through ? What we need to do is pin down either why its not working or why what your doing is different to what we think we need to do to follow the algorithm.

    I agree with Wordman in that water would flow to lowest point and thats what most people have done but we also know that it tends to stall quickly by hitting locally low points with higher pixel values all around it. You can avoid this by accumulating water in that ditch, filling it up until it overflows and that's what Aaron of L3DT has called a continuum model instead of the drip model. This is the kind of model I think he has programmed and not released because its a lot slower as it means you have to iterate a lot before it starts to overflow. It is the basis of how I do it in GTS however which is why it takes hours for my app to run.

    Heres a link to Aarons posts on L3DT, its a bit old tho - maybe he has done more work in this area.
    http://www.bundysoft.com/phpBB2/viewtopic.php?t=404

  5. #25
      covatex is offline
    Guild Novice
    Join Date
    Nov 2008
    Posts
    16

    Default

    The original heightmap (without black lines) is attached in the first message of the thread...

    Here is the code I'm using:
    actualX and actualY are the starting point coordinates. W is the width and h is the height or the image. Sealevel is... well... guess what!
    Code:
        actual = (GetPixel(picMap.hdc, actualX, actualY) And &HFF)
        Do
            used = False
            modX = 0
            modY = 0
            dif = 255
            min = 255
            For i = -1 To 1
                For j = -1 To 1
                    used = ((GetPixel(picMap.hdc, actualX + i, actualY + j) And &HFF) = 0)
                    If actualX + i > 0 And actualY + j > 0 And actualX + i < w And actualY + j < h And Not used Then
                        testValue = (GetPixel(picMap.hdc, actualX + i, actualY + j) And &HFF)
                        dif = actual - testValue
                        If dif >= 0 And dif <= min Then
                            If i = 0 And j = 0 Then
                            Else
                                min = dif
                                modX = i
                                modY = j
                            End If
                        End If
                    End If
                Next
            Next
            actualX = actualX + modX
            actualY = actualY + modY
            actual = (GetPixel(picMap.hdc, actualX, actualY) And &HFF)
            Call SetPixel(picMap.hdc, actualX, actualY, 0)
            picMap.Refresh
        Loop Until (modX = 0 And modY = 0) Or (actual < seaLevel) Or actualX < 0 Or actualY < 0 Or actualX > w Or actualY > h
    Last edited by covatex; 11-24-2008 at 03:12 PM.

  6. #26
      Redrobes is offline
    Software Dev/Rep Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    4,763
    Blog Entries
    4

    Post

    Sorry didnt spot that. I took the height field that you posted and your color and made a 3D view. Also, I took the output from the river run and put that on top for reference. If you like these images then you can have the app - its a freebie.

    Anyway - here's some pics. I guess Nick will have to verify if you have the right method.

  7. #27
      Redrobes is offline
    Software Dev/Rep Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    4,763
    Blog Entries
    4

    Post

    I did some more tests using my GTS to see if it could predict the river flow but it struggled with this height map too. The first image is what its like if I set it like soft mud and let it erode wildly. It cuts deep channels into it because of the large drops in height.

    Trying again with lower erosion and also adding what I call frost erosion in that when the gradient gets too high it smooths out steep cliffs then it drops out those spikes and also does a better job with the erosion. I was having fun so I rendered it with some textures too. I really like the result - looks like a waterfall type scene. Anyway - either of the two images get some basic similarities in the water flow so there's some general / vague consensus here about where the water might go. Its still a sim tho - its all guesswork.

  8. #28
      covatex is offline
    Guild Novice
    Join Date
    Nov 2008
    Posts
    16

    Post

    Off Topic
    Redrobes, I've downloaded ViewingDale. I put the Height.bmp and Color.bmp, but only see grayscales... What's happening?

  9. #29
      Redrobes is offline
    Software Dev/Rep Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    4,763
    Blog Entries
    4

    Post

    Don't know ! Can you resize or make the dimensions of the images 512x512 each ? And it might be helpful if using full color images though its not supposed to matter. Other than that you might have an older type of graphics card or a driver issue.

  10. #30
      RobA is offline
    Administrator RobA's Avatar
    Join Date
    Apr 2007
    Location
    Niagara, Canada
    Posts
    5,530

    Post

    Cova-

    Can you provide the source greyscale in png? the jpg artifacts mess up any processing.

    Attached is a incise based precip run using wilbur to show where it places rivers.

    Working on a ambitious world generating tool...-w_incise.png

    -Rob A>

Page 3 of 4 FirstFirst 1234 LastLast

Posting Permissions

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