Results 1 to 10 of 24

Thread: image processing basics

Threaded View

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

    Default

    i expect that most often the first step for map generation is height field generation, commonly using perlin noise.

    i prefer to roll my own rand() function using hal chamberlin's algorithm from 'musical applications of microprocessors' - i use unsigned INTs and perform math using INTs for speed (remember i know next to nothing about image coding, using GDIs et c., so this may be unwise) -

    nrnd = 196314165 * nrnd + 907633515;

    if you scale that sensibly and use it to generate white noise at audio rate, there is no discernible repetition. you can use 16 bit INTs and hear repetition every 2^16 samples, so SHORTs are useful for finite applications.

    here's chamberlin's chart:
    word len A B
    8 77 55
    12 1485 865
    16 13709 13849
    24 732573 3545443
    32 196314165 907633515

    perlin noise isn't the only method of generating height fields, eg. obviously each pixel could be randomly generated then the image could be blurred/smoothed. it is convenient and efficient.. interpolation is used to smooth random points at different scales (typically at 'octaves' or ^2) and then summed at amplitude 1/(n^2). the idea is also that the same data set (256*256 for unsigned CHARs?) can be used for each octave because the scale at any perspective obscures the similarity.

    ken perlin's lecture and webpage on the topic:
    www.noisemachine.com/talk1

    there are several great illustrations of the topic online, easy to find, eg.
    http://freespace.virgin.net/hugo.eli...s/m_perlin.htm

    so i'd be a ponce to repeat them all here. having generated noise by several methods in audio i can think of no method that lends itself better to the solution.
    Last edited by xoxos; 04-13-2012 at 06:29 PM.

Posting Permissions

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