pygame is
Python
Simple DirectMedia Layer
 
 
pygame.org is
Site Swing
noiselib

noiselib - 1.5.0

Chandler Armstrong (omnirizon)

Tags:

Description

noiselib provides noise generators and manipulators. noiselib is modeled after libnoise, the C++ coherent noise library. noise generators are wrapped in 'modules' that manipulate, modify, filter, and combine noise generators. Each module expects and returns noise; thus modules can be stacked to create complex noise output.

Changes

corrected errors:
* gradient hash indices wrapping were hardcoded for a permutation table of size 256; fixed.
* simplex_noise3 function possessed extensive errors; all fixed.
* noiselib.init procedure did not double the size of supplied permutation tables; fixed.

An experimental module named TorusNoise has been added as an example script. The module is not yet implemented in the trunk. TorusNoise is used to create seamlessly tiled noise by sampling the noise from the surface of a torus. The method works, but is very distorted due to projecting the torus surface onto a 2d plane. I am researching projection methods that modify the nature of the distortion so that the projected 3d noise better approximates typical 2d noise.

Run the script "tiled.py" to see torus noise.

I've also added a script, "simplex.py", that demonstrates the minimum script to produce some noise. The script "complex.py" demonstrates using multiple noise generators and modules to produce much more complex noise.

A final note for windows users. I will make an msi distribution shortly. The source-code contains C files that will need to be compiled. This is not a problem for Linux or OS X, both packaged with GCC. Windows users will need VS or GCC installed to install noiselib. With an msi distribution all files will come pre-compiled.

Links

Home Page: http://code.google.com/p/noiselib/
Source: http://code.google.com/p/noiselib/downloads/list

Screenshot


click to view original size

Releases

noiselib - 1.5.0 - Jul 27, 2011
noiselib - 1.4.0 - Jun 8, 2011

Pygame.org account Comments

If you wish to leave a comment with your pygame.org account, please sign in first.

May 28, 2011 3:37pm - Chandler Armstrong - nickname: (omnirizon)
the interface will only change in one place. the 'f' parameter, a callback function for the fBm procedure to modify per-octave noise, will change to accept the function object rather than a string. this is so users can make their own callback functions.

I have finally gotten everything to compile with no errors. I may test tonight and then release if all goes well.
May 24, 2011 8:05pm - Bugme Not - nickname: (bugmenot) - 5/5
Ooh, I'd really like to see that pre-compiled installer; I'm trying to share my game with my friend right now and he has to install mingw32 and everything.

Will the python interface be at all different for the new fBm? I just hope that nothing is broken.
May 23, 2011 1:20pm - Chandler Armstrong - nickname: (omnirizon)
thanks for the catch on the mistake, bugme not!

I'm updating this package to implement the fBm in C. I'll fix the mistake you found, and add a comment to the scale function, if its logic is unclear. You basically stated why the scale function looks the way it does; I wanted a particular signature. A saner way of implementing the function may exist; I'll look into it.

The update will be released today or tomorrow. I'll distribute it with an actual installer, code compiled and all.
May 22, 2011 4:44pm - Bugme Not - nickname: (bugmenot)
The code is completely undocumented; the most important thing I figured out is:

The scale() function is actually a line in y=mx+b form, equivalent to the line between the two given points. So give RescaleNoise a line f and it'll transform all of the noise points x (in range -1 to 1) to new noise points f(x) in the range f(-1) to f(1).

Why is the line given as two points instead of as a y-intercept and a slope? Because of the convenience of this:
source = RescaleNoise((-1, 1), (0, 1), source) means that noise between -1 and 1 is mapped to noise between 0 and 1, which can be used by RGBLerpNoise
May 22, 2011 3:44pm - Bugme Not - nickname: (bugmenot) - 3/5
In your AbsNoise function, you have:

def __call__(self, coords):
source = self.source
return abs(noise(coords))

But there is no `noise' in scope. Do you mean:

def __call__(self, coords):
source = self.source
return abs(source(coords))
spotlight

 
our projects
pygame.org welcomes all python game, art, music, sound, video and multimedia projects. If they use pygame or not.
 
recent releases
Dec 16, 2014


Dec 14, 2014

Dec 9, 2014

Dec 6, 2014

Dec 5, 2014

Dec 3, 2014

Nov 27, 2014


Nov 13, 2014

Nov 11, 2014


... more!
 
for pygame related questions, comments, and suggestions, please see help (lists, irc)