Page 1 of 4 1234 LastLast
Results 1 to 10 of 35

Thread: My own custom world generating heightmap software

  1. #1

    Wip My own custom world generating heightmap software

    For my own enjoyment, I've been writing a piece of software to procedurally generate worlds.

    The features so far:
    Very loosely simulates tectonic faults
    Generates fractal terrain (diamond square algorithm) that combines with the faults
    Generates random island/continents (fractal radius)
    Loosely Simulates river erosion (still needs improvement)
    Simulates climate (based on latitude, earth-type prevailing winds, altitude, humidity, and proximity to ocean)

    The project is written entirely from scratch in VB6 (no plugins, libraries, etc). It hasn't been optimized at all yet, so it takes a couple of minutes to run through the whole generation process. I have been very inspired by the Shamus Young's Terrain and Project Frontier blog entries (http://www.shamusyoung.com/twentysidedtale/?cat=66)

    My wishlist
    3D viewing (I have no experience with 3D programming or textures)
    Zooming (generating a deterministic closeup of a particular region of a world map on the fly)
    Near instantaneous world generation (probably impossible)

    I'd like to hear your input on how the results looks so far, on what would be the most beneficial things to add to the simulation, etc.

    Thanks,
    Tim
    Attached Images Attached Images

  2. #2

  3. #3
    Guild Journeyer
    Join Date
    Jun 2011
    Posts
    146

    Default

    Visually they're fairly nice, if standard.

    The maps won't work on a sphere, which is a problem for world maps. Since you're coding from scratch, if you can figure out how to generate your terrain on a sphere that would be an advantage. An alternative approach may to generate a continent at a time then place it on the world map reprojecting as appropriate.

    I can see some arc-like artefacts in the topography.

    A known issue of most random terrain generators is mountains being too central. If you can reproduce situations like the Andes where appropriate that would be great.

    Regarding zooming in - I reckon if you basically use the world-scale elevation data to "seed" the fractal algorithm for generating more detailed stuff, that lets you add the detail deterministically without having to generate everything straight away.
    I am a geology nerd.

  4. #4

    Default

    I don't know how to make it wrap onto a sphere without transitioning the whole project to 3D. Which is something I'd like to do, but will require a steep learning curve first.

    The arc-like artifacts are intentional (which doesn't mean they're correct). I designed the fault lines to follow a sine curve with amplitude that varies from straight to about a half of an "S" shape. If this is wrong, what would be a more plausible shape to use?

    I can definitely do offset mountains as I am calculating the slope on each side of the fault separately. Any idea on how often this feature should appear?

    I'm working on improving the fractal seeding with a scaling factor and depth.

    Thank you for your great comments!

  5. #5
    Guild Expert eViLe_eAgLe's Avatar
    Join Date
    Feb 2011
    Location
    Washington State
    Posts
    1,059

    Default

    I could imagine using this! Maybe you should make it be able to export a wilbur MDR file? Just thought.

  6. #6
    Guild Journeyer
    Join Date
    Jun 2011
    Posts
    146

    Default

    The first thing for making the map make sense on a sphere is to remember that for a rectangular map, the top and bottom lines are actually points (the North and South poles). Therefore, the entire top and bottom edges of the map need to be either all continent or all ocean.

    Faults are usually great circles on a globe. They do indeed become sine waves on the map. I think it's rather that they're not normally so "crisp" on continents.

    Major transform boundaries - where one side moves sideways with respect to the other - are not too common on continents. The San Andreas is the best known; others include some around Turkey and one through New Zealand.
    I am a geology nerd.

  7. #7

    Default

    eVile_eAgLe, I might consider it if there was really good documentation on the MDR file format. For now the project can save BMPs (and import them too, if you wanted to use it for the climate calcs and erosion simulation).

  8. #8

    Default

    Taking a break from features in order to refactor the code and data to make it object oriented. I read a bunch about map projection equations, so hopefully I'll be able to address the wrapping issue soon.

  9. #9
    Guild Expert eViLe_eAgLe's Avatar
    Join Date
    Feb 2011
    Location
    Washington State
    Posts
    1,059

    Default

    I eagerly await the return of this!

  10. #10
    Administrator waldronate's Avatar
    Join Date
    Mar 2007
    Location
    The High Desert
    Posts
    3,605

    Default

    The MDR file format is a simple format that consists of a 1024-byte header followed by a raster block of 32-bit floating-point samples. Byte order of all fields and data is Intel order (LSB first). The VC++ structure definition for the file header is shown below:

    Code:
    
    // make sure we're aligned on 2-byte boundaries for this declaration
    #pragma pack(push)
    #pragma pack(2)
    
    // map structure definitions
    struct MDRHeader
    {
    
    	union
    	{
    
    		struct
    		{
    
    			char   Chunk[4];    // name of chunk - should be "WLBR"
    			int    Next;        // offset in file to next data (unused)
    
    			char   Name[256];   // name associated with the data (unused)
    
    			double Left;        // min longitude
    			double Right;       // max longitude
    			double Top;         // max latitude
    			double Bottom;      // min latitude
    
    			double Min;         // lowest point on surface
    			double Max;         // highest point on surface
    
    			double XRes;        // distance between X points (right - left) / XSize
    			double YRes;        // distance between Y points (top - bottom) / YSize
    
    			int    Version;     // version number (unused, should be 0)
    			int    TypeInfo;    // type information (should always be 0)
    			char   SurfName[8]; // name of data block (unused)
    			void** SurfData;    // pointer to surface data (unused)
    
    			char   PicName[8];  // name of picture block (unused)
    			void** PicData;     // pointer to image data (unused)
    
    			int    XSize;       // width of blocks
    			int    YSize;       // height of blocks
    
    		}; // struct
    
    		struct
    		{
    			char Padding[1024]; // make the structure 1024 bytes long
    		};
    
    	}; // union
    
    }; // MDRHeader
    
    #pragma pack(pop)
    There is a problem with 32-bit MDR vs. 64-bit MDR files embodied in the pointers in the structure. There will likely be an offset from 32-bit vs 64-bit files.

Page 1 of 4 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
  •