Results 1 to 4 of 4

Thread: Scripting Wilbur Functions with a Hotkey Manager

Hybrid View

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

    Link Scripting Wilbur Functions with a Hotkey Manager

    As part of an ongoing project (It'll eventually be a post on my blog) I've been working with very high-resolution heightmaps and got a bit tired of waiting for long erosion runs to finish, so I worked out a way to automate the process using AutoHotkey, a program that lets you build and run scripts of keyboard and mouse input. I've built [this script](https://www.dropbox.com/s/ffieiv3v1n...200.4.ahk?dl=0) that includes a library of functions that navigate the Wilbur menus to apply specific commands, as well as an example of a script built with these functions.

    Each function works by assuming Wilbur is open and the mouse is placed over "Select" on the menu bar. The function inputs the proper commands to navigate through the menus and select the option for a specific command (or just uses hotkeys if they're available) and then, if necessary, also inputs the proper options in any configuration windows. It will wait for any progress windows to close, and check that the program is ready to run again (by trying to open the "map info" window) before starting the next function. For long functions this may sometimes make the program look like it's crashing and not responding. Not every Wilbur process is included--some would be very complex to code out and a few are simply inaccessible from keyboard inputs alone--but pretty much all the most commonly used ones are.

    So in short, to run the example script, you would:

    - Download and install AutoHotkey

    - Download the erosion pasta script linked above

    - Change the x and y values within the example script to the resolution of your heightmap.

    - Start the script by double-clicking the script

    - Open Wilbur, load the heightmap you wish to erode, and make sure it's set to the proper vertical scaling and sea level.

    - Make sure that there is a greyscale mask named "noise.png" that is in the same directory as that heightmap (maybe also load that mask as a selection once before you start to make sure Wilbur looks at the right directory later).

    - Place the mouse over "select" in the menu bar.

    - Press Ctrl-f

    The script should run through and then show a message once it completes. You can pause it any time with Ctrl-p, and unpause it the same way (but there's really no guarantee it will properly continue if interrupted in the middle of a function) and stop it and unload the script with Ctrl-x.

    You can construct your own script using the functions in a similar way to the example. They key is that every script should start with a global speed variable (which sets the timing of various pauses throughout the functions; a speed of 1 should usually be fine but higher values may help prevent the functions executing too quickly on slower computers or larger maps), and the "checksel" function (which loads a selection to clear an issue with the "load selection" window behaving oddly the first time it is opened, and so must be given an existing greyscale image to load, but the image itself isn't important). If your script involves loading and saving of files, you may also want to check that Wilbur is looking into the right directories first before running it.

    This is a bit of a hack, of course, so there are some major downsides and caveats:

    - Wilbur must be left open as the main window and the mouse must not be moved while a script executes.

    - I have not extensively tested every function here so cannot guarantee that they are all working perfectly.

    - Even if the functions work right on my computer, I can't guarantee they will work right on other computers that may behave differently.

    - This script is built for Wilbur version 1.90; Older or later versions may have different menu layout or behavior that breaks these functions (I know specifically that the precipiton function with multiple passes probably won't work right on older versions).

    The example script is one I've been using for large maps at roughly 2 km/pixel resolution. Basically I start with a sketch like this:

    weg test2.png

    (Note the exponential elevation scaling)

    I convert that to greyscale and smooth it out and noise it up in Gimp (and threw in a trench just for testing):

    test2 c.png

    And then apply the script (with an additional exponential scaling at the end, which I didn't include in the script because I like to place those reference elevations in the upper-left first) to get a result like this:

    test2 out river.png

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

    Default

    Is there anything in particular that you don't like about the noise functions in Wilbur?

  3. #3

    Default

    Applying fractal noise to an existing heightmap doesn't always quite seem to work right with areas of the map selected (unless I'm not using it right), hence the workaround in the example script of saving a noise heightmap to file and then applying that as an image later (though that also allies me to overlay multiple fractal noise maps at different scales). But when I referred to "noising up" the map in Gimp, I meant more in the sense of applying lots of little peaks, ridgelines, and troughs with the dodge/burn tool; the sort of thing you don't want to be truly random but would be tedious to do in the initial sketch with discrete levels. I also like the "pick" noise option there, though I only use a very light pass of it so I'm not sure it actually has any impact on the final product.

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

    Default

    Perfectionism can be a real pain in the behind. I've never been able to muster the focus for more than a few simplistic masks myself.

    Selections in Wilbur are a bit twitchy at times and I may have missed an item or two in the last conversion. I'll try to take a look at it again one of these months, but no promises.

Posting Permissions

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