On Jul 30, 2008, at 4:35 AM, Knapp wrote:
On Wed, Jul 30, 2008 at 10:48 AM, DR0ID <[EMAIL PROTECTED]> wrote:
Hi
I think Perlin noise exist already for python, unless you really
want to do it by yourself.
Here is one I know of: http://code.google.com/p/caseman/downloads/list
There are porbably more implementations out there.
~DR0ID
That looks like a really neat lib! Glad to know about it.
Hugo arts also had some thought about this
>I'm not sure Perlin Noise would belong in the base pygame package.
Though useful in some cases, it's not a critical/elementary function
for game development. It might be a better idea to offer the
functionality as an auxiliary library, >or perhaps bundle it
together with other procedural generation tools.
.
I agree that this is not a basic function but I don't see it as
being less basic than pygame.transform.laplacian - find edges in a
surface. Perlin noise has a LOT of uses with game writing: surfaces,
shapes, and movement can all be made better using it.
I have not checked out that Caseman lib in full but from what I see
it only has 3d perlin and not other dimensions and I don't know how
fast it is.
It has 1D, 2D and 3D noise functions all of which support fBm. I plan
to add 4D simplex noise (and perhaps improved as well, though that's
where the original algorithm starts to get slow) at some point.
The noise functions are all written in C, and are certainly fast
enough to be useful. They are fairly close to the "textbook"
implementations, but with more inlining. I'd like to look into
vectorizing the code to make it faster still, but so far it's fast
enough for me. If someone needs more performance, I can be pretty
easily encouraged to do some more optimizing.
There is also a python implementation of the same algorithms in there
for comparison. It's fair to say that performance-wise it doesn't
compare.
fwiw, there is also a GLSL implementation of "fast fake noise", so you
can push the execution off onto the GPU. As implemented, it requires
pyglet, but the meat of the code is generic GLSL and some Python to
build a source texture that it uses. This implementation is fast
enough for real-time shading and bump-mapping duties.
Anyhow, give it a go and let me know what you think. If you think it's
missing something, let me know. I'd also be interested in opinions on
its current performance.
-Casey