Noise!

Noise!

Down Rodeo
Cap'n Moth of the Firehouse

Find the Hole II Participation Medal
2007 Oct 19 • 5486
57,583 ₧
It's probably about time I let someone see my code. So here it is: GET SOME

At the moment, it is nothing more than a simple command-line program to produce Perlin noise and FBM of various octaves. It's all pretty simple but is completely uncommented. You run it like
code
./noise size cellsize octaves output_file


The images are all square, so that's what size is, the cellsize defines what scale the noise is on, larger cellsizes make large noise features, smaller makes it more intricate. The octaves thing... broadly speaking, adding more octaves (you can leave it at zero for instance) will add higher-frequency noise but at a smaller amplitude. At the moment that's not hugely modifiable.

I've just realised what I've said is lies. I've added some domain warping and at the moment, it can't be turned off. The plan for the next bit is to add support for a file that all the data is read from, because there are only so many pieces of data you can put on the command line. If you want to remove the domain warping it will require a little source editing. If anyone is really interested I'll tell you what to do. Expect pictures in the next few days, perhaps!
 
 
 
2012 Jan 17 at 03:15 UTC — Ed. 2012 Jan 17 at 03:15 UTC
sprinkles

Chrome Whore
2009 Sep 6 • 2547
10 ₧
I see we meet again Mr. McBain.
 
 
 
2012 Jan 17 at 04:07 UTC
SuperJer
Websiteman

2005 Mar 21 • 6666
gcc --std=c99 -lm -o noise noise.c

./noise 400 50 1 a.pgm


./noise 400 50 5 b.pgm


./noise 400 50 10 c.pgm


./noise 400 200 5 d.pgm


NEAT.
 
 
 
2012 Jan 18 at 02:29 UTC — Ed. 2012 Jan 18 at 02:33 UTC
Down Rodeo
Cap'n Moth of the Firehouse

Find the Hole II Participation Medal
2007 Oct 19 • 5486
57,583 ₧
I compile with -pedantic and -Wall and it's still fine! You'll notice that, at the moment, there's a fairly severe bias toward vertical lines - I am not sure why. But I have one idea; it might be related to the noise function I use (repeatedly, which I think is the issue). I'm bust right now but I'm going to do a little this evening, see if I can't do some function pointer magic to change which type of fbm is produced.
 
 
 
2012 Jan 18 at 13:15 UTC
Down Rodeo
Cap'n Moth of the Firehouse

Find the Hole II Participation Medal
2007 Oct 19 • 5486
57,583 ₧
Found it. Of course it was a p that should be q. So you get this now:
./noise 700 50 10 output.pgm

Interestingly, this image is actually larger when compressed using PNG. I mean it might be the program I used, but perhaps I have finally found my pathologic image! Of course as we know for any given lossless compression format there will always be some sequence of bytes that is larger when "compressed" by that format. So maybe I've found one of them.

This is what happened when I added the second domain warping:
./noise 400 25 10 output.pgm


As you can see it's not working here, there is far too much random noise. Compare with the stuff going on in this page.

It's also going to need optimisation soon. It's a little slow. There's a really easy one, that being to cache the vectors generated at each grid point. At the moment they're recomputed each pixel and they involve a call to a fairly complex function and quite a bit of trigonometry. So that really ought to help, I hope. When I can be bothered/have time.
 
 
 
2012 Jan 19 at 02:56 UTC
Down Rodeo
Cap'n Moth of the Firehouse

Find the Hole II Participation Medal
2007 Oct 19 • 5486
57,583 ₧


:o

Supes, I think I might need your help with this, at some stage. Say I wanted configurability to the max - how might I go about creating some small config file that can change lots of the program, rather than a couple of numbers? Anyway, now's not the time. I might ask more in a few days.
 
 
 
2012 Jan 20 at 03:07 UTC
Rockbomb
Dog fucker (but in a good way now)

2009 Nov 14 • 2045
That looks like a puddle full of oil... I like it :D
Also, you should make a GUI at some point... I don't like typing. In fact, I'm not even going to finish typing this sente
 
 
 
2012 Jan 20 at 05:15 UTC
Down Rodeo
Cap'n Moth of the Firehouse

Find the Hole II Participation Medal
2007 Oct 19 • 5486
57,583 ₧
Rockbomb said:
you should make a GUI at some point

Fuck off! You should make a GUI. I'd be impressed if you could write one that was worth the complexity! :p

Apart from anything else the current method makes it considerably easier to rerun the program with different parameters and is in fact scriptable.
 
 
 
2012 Jan 20 at 10:09 UTC
Rockbomb
Dog fucker (but in a good way now)

2009 Nov 14 • 2045
Down Rodeo said:
You should make a GUI.


What language are you doing this in?
If it's C++, I could prolly make something in VB.NET for it.
 
 
 
2012 Jan 20 at 17:11 UTC
sprinkles

Chrome Whore
2009 Sep 6 • 2547
10 ₧
Are you going to make it move like in the last video of that page?
 
 
 
2012 Jan 20 at 17:58 UTC
Down Rodeo
Cap'n Moth of the Firehouse

Find the Hole II Participation Medal
2007 Oct 19 • 5486
57,583 ₧
Rockbomb said:
What language are you doing this in?
If it's C++, I could prolly make something in VB.NET for it.


C. Moreover, C on GNU/Linux. GUIs are by and large pointless, it is much easier to fire all the data into a file, read it and run it.

sprinkles said:
Are you going to make it move like in the last video of that page?


Ideally. But it will require some more smarts that I am not sure I currently own. Neither do I have the time for that, of course. But I'll do a little more work on the colours.
 
 
 
2012 Jan 20 at 19:42 UTC — Ed. 2012 Jan 20 at 19:43 UTC
SuperJer
Websiteman

2005 Mar 21 • 6666
Down Rodeo said:
how might I go about creating some small config file that can change lots of the program, rather than a couple of numbers?


With fopen() and fscanf().

That's how I usually do it, anyways.
 
 
 
2012 Jan 21 at 03:03 UTC
Down Rodeo
Cap'n Moth of the Firehouse

Find the Hole II Participation Medal
2007 Oct 19 • 5486
57,583 ₧
Well yes, I get that. It's more... how do I structure my program intelligently such that I can use a file to configure the program? I've done quite a bit of file IO in Java, and a small amount in C. But I always feel that saying something along the lines of "look for parameter -> save into variable -> find code path" is a bit... inefficient. And I always seem to find that either lots of code is duplicated or there are if statements EVERYWHERE. And that is definitely inefficient.
 
 
 
2012 Jan 21 at 03:21 UTC
SRAW
Rocket Man

2007 Nov 6 • 2525
601 ₧
How do you get the code from bitbucket?
Free Steam Games
 
 
 
2012 Jan 21 at 03:23 UTC
Rockbomb
Dog fucker (but in a good way now)

2009 Nov 14 • 2045
SRAW said:
How do you get the code from bitbucket?

install mercurial: link
then use
code
hg clone https://bitbucket.org/DuncanMcBain/noise
 
 
 
2012 Jan 21 at 03:26 UTC
SuperJer
Websiteman

2005 Mar 21 • 6666
They also have a link on the downloads page.
 
 
 
2012 Jan 21 at 03:30 UTC
SRAW
Rocket Man

2007 Nov 6 • 2525
601 ₧
Soooo I tried compiling it in msvc++ 2008, and it failed, WHY
Free Steam Games
 
 
 
2012 Jan 22 at 04:27 UTC
Rockbomb
Dog fucker (but in a good way now)

2009 Nov 14 • 2045
Because you tried compiling it in msvc++ 2008, presumably.
Try GCC? Or if you're only using Windows, try MinGW?
 
 
 
2012 Jan 22 at 04:34 UTC
Down Rodeo
Cap'n Moth of the Firehouse

Find the Hole II Participation Medal
2007 Oct 19 • 5486
57,583 ₧
I actually have no idea how to make programs like this work in Windows. I'd have thought there would be some sort of console app configuration or something similar, but there you go. Also you'll need to link the math library. What kind of errors does it spit up?
 
 
 
2012 Jan 22 at 04:41 UTC
SRAW
Rocket Man

2007 Nov 6 • 2525
601 ₧
Ok, I got it to compile, but how Im too lazy to search how to open pgm files
Free Steam Games
 
 
 
2012 Jan 22 at 19:52 UTC
Rockbomb
Dog fucker (but in a good way now)

2009 Nov 14 • 2045
SRAW said:
Ok, I got it to compile, but how Im too lazy to search how to open pgm files

GIMP supports PGM files: linkzor

Or if you have Photoshop, you can install CartaPGM Sausage Link
 
 
 
2012 Jan 22 at 20:01 UTC
Down Rodeo
Cap'n Moth of the Firehouse

Find the Hole II Participation Medal
2007 Oct 19 • 5486
57,583 ₧
I used pgm because it is braindead-simple. They look like this:
code
PX //X is a number 1-6, depending on type: monotone, greyscale, colour and ASCII/binary
xsize ysize if it's binary
maximum intensity (say, 255)
from now, data. One line per line of image, if it's ASCII, otherwise it's a big lump of binary.

Oh yeah, each thing is a char. Including each channel for colour images. Whatever, it's really simple. The stuff I've not posted here yet is slightly different again so you might want to update.
 
 
 
2012 Jan 23 at 01:16 UTC
SRAW
Rocket Man

2007 Nov 6 • 2525
601 ₧
Could you NOT declare the ints in the for loops also, because noobs even worse at programming than me might not know how to compile this thing in sexually transmitted disease '99 standard or fix it...
Free Steam Games
 
 
 
2012 Jan 23 at 04:16 UTC
Down Rodeo
Cap'n Moth of the Firehouse

Find the Hole II Participation Medal
2007 Oct 19 • 5486
57,583 ₧
I'll declare the ints where I like. And I refuse to use a standard that's about as old as I am.
 
 
 
2012 Jan 23 at 05:30 UTC
Down Rodeo
Cap'n Moth of the Firehouse

Find the Hole II Participation Medal
2007 Oct 19 • 5486
57,583 ₧
The most recent version has support for mixing between colours! Take a look. At the moment, the colours are hardcoded, but I will work on that sometime next week maybe.
 
 
 
2012 Jan 26 at 10:59 UTC
Page [1]