So, yesterday while I was in bed, I couldn't fall asleep. So I figured out the way that the S-curve works, and I played with it a little while today. I managed to make my perlin noise work! It would need some improvement though. I'm still using java.Random class. If I wasn't using it, maybe performance would improve. What I have done differently from my first attempt, is now I generate random direction values that are length of 1. Also, I swapped the interpolation values a little. First, I calculate interpolated value between SV and TU using xd00.y as my weight. Then I interpolate based on xd00.x weight. This magically worked, but I don't know why, but my noise looks kinda crappy. Not in sense of quality, but Simplex Noise looks a lot better for some reason. Anyway, here is the code. If there is some kind of expert here, please do tell if this is actually Perlin's Noise correct algorithm.

Attempt to search the forum now and then. Look at the local wiki page. (required yet again repeat: this is not perlin noise)

I guess this should be only called "height map". What I'm thinking you're trying to imply, is that Perlin Noise is a height map, which is generated by a specific technique, which was developed by Perlin.Then I will call this Chris Noise.

First off, Perlin Noise is an algorithm, not a heightmap. You can generate other besides height maps with noise algorithms.

The difference? Perlin Noise would probably produce much 'cooler' height maps. Using Perlin Noise you can generate different types of images, including cloud like heightmaps, which makes for realistic terrain in games. The one you have right now would be very 'spiky', and not really realistic at all.

Your noise effect has an odd grid pattern built in. But it does look nicely noisy and all that. And the implementation looks pretty fast, too, which could be a very useful tradeoff. My head-cold's a little too painful right now to look at your code more closely and try and figure out if the noise is "gradient" or "value" noise.

There is a GREAT article explaining the mathematics behind Ken Perlin's gradient noise:

The wiki page Roquen was referring to on our site brings all this up and more and is well worth checking out.

The Perlin algorithm's are cool to a large degree because of the level of control they give the programmer to sculpt various textures. I'm not sure if "value" noise can be so easily sculpted. (The concept of octaves in Perlin noise is very useful. Can value noise bands be created at multiples of a given frequency as easily as with Perlin noise?)

I have a tool up (java applet) that will probably become unavailable at the end of the year thanks to new signing requirements. It has a gallery of various effects.

Ah, there is a link that allows the download of the jar. That is probably a better way to run it, anyway.

Clicking on the gallery image (Menubar: View/Gallery) will set up the tool with the parameters for that image, and allows you to edit/tweak the settings and see what happens. There is also a demo-template to help explain how the settings in the app tie into the algorithm. But I don't go into explaining the algorithm itself. Gustavson is my favorite for that.

We had a code generator working, but I broke it when I 'improved' the way gradients are used as the subject of noise modulation, and it hasn't been rebuilt.

"We all secretly believe we are right about everything and, by extension, we are all wrong." W. Storr, The Unpersuadables

Your noise effect has an odd grid pattern built in. But it does look nicely noisy and all that. And the implementation looks pretty fast, too, which could be a very useful tradeoff. My head-cold's a little too painful right now to look at your code more closely and try and figure out if the noise is "gradient" or "value" noise.

It seems to be comprised of squares approximately 1x1mm in size on my screen. But not exactly that, more like I'm looking through a semi-opaque glass with a grid pebbling on it, with obvious vertical and horizontal gradations occurring at that frequency. Maybe this has to do with the resolution of this algorithm.

The Simplex implementation I've been using tends to lead more towards hexagons and triangles. And they are not as obvious.

The tradeoff I was referring to was between performance and the graphical effect. Perlin's algorithms are pretty efficient, but they still have a significant cost in terms of cpu. Something that can give "good enough" noise that takes less cpu than Perlin noise could be useful in some contexts.

"We all secretly believe we are right about everything and, by extension, we are all wrong." W. Storr, The Unpersuadables

It seems to be comprised of squares approximately 1x1mm in size on my screen. But not exactly that, more like I'm looking through a semi-opaque glass with a grid pebbling on it, with obvious vertical and horizontal gradations occurring at that frequency. Maybe this has to do with the resolution of this algorithm.

The Simplex implementation I've been using tends to lead more towards hexagons and triangles. And they are not as obvious.

The tradeoff I was referring to was between performance and the graphical effect. Perlin's algorithms are pretty efficient, but they still have a significant cost in terms of cpu. Something that can give "good enough" noise that takes less cpu than Perlin noise could be useful in some contexts.

Umm..... I don't think you understand the problem here. This image was done in 64x64 or 128x128 resolution. That is why it is "blocky". What I mean is that those squares are individual pixels, stretched on 512x512 image.

Here is a smooth looking image:

And my implementation is really slow. Here is my current code. It allows to adjust the size of these noise areas. You can make a first heightmap really small, and then stretch it onto huge height-map and resample it a lot of times (64 and more) and it will give you a really smooth height-map with huge noise areas.Here is an example:

if I want to generate a 512x512 smooth image with "huge" noise areas, it takes about 5 seconds... It is really slow.. I will need to learn Perlin / Simplex noise for proper use.

@trollwarrior1 Yes, the smooth image looks more like what I'd expect. Sorry to hear the implementation is so slow. Definitely check out Roquen's link, and consider using Gustavson's Simplex implementation (I cited earlier--it is linked in his article).

No, its not diamond square, its far simpler and way less CPU intensive. I believe its gradient noise, but someone else already said it could also be value noise. I don't know much about this certain algorithm type, so I could not tell you.

Blending pixels only 1 time doesn't do the trick, so you need to blend them a few times over and over again. After blending them a few times, you get something that looks like Perlin Noise. Just read the code plox. It is pretty simple..

Stop messing around with this. Look at the wiki. This is filling an array with white noise then doing multiple passes of a bad box filter. This is insanely slow and very poor quality...you're wasting your time. Use a real noise generation function from from the last 30 years.

Take a look at the simplex noise code I linked you to. With this code, it can generate a 512x512 in 79ms. It can also generate 10000x10000 (10 billion) points in 39.8s. With the code you have, generating a (smooth) 512x512 takes 5s. If you tried to generate 10000x10000, it would take almost 53 HOURS.

Take a look at the simplex noise code I linked you to. With this code, it can generate a 512x512 in 79ms. It can also generate 10000x10000 (10 billion) points in 39.8s. With the code you have, generating a (smooth) 512x512 takes 5s. If you tried to generate 10000x10000, it would take almost 53 HOURS.

THanks, I didn't notice the link to stackoverflow earlier. I just copy/pasted the code and it works perfectly. My head is going to break at the awesomeness of people who can create such maths. I want to able to do something like that too some day.

Thanks for giving an explanation of the code. Earlier, I only read as far as seeing the array being filled with randoms, and things got "fuzzy" with the box filter step. I definitely have room to improve with my code reading skills.

I think it is neat that a decent noise/cloud can be generated this way. It does has the benefit of using very little code. But the inefficiency is pretty awful compared to other techniques that are readily available.

Math is awesome. Do stick with it in school! (I didn't do so as much as I now wish I had.) I think that the path to being able to create maths comes not just from study, but from playing with it, exploring on the way, as you are already doing.

"We all secretly believe we are right about everything and, by extension, we are all wrong." W. Storr, The Unpersuadables

Thanks for the code.I implemented it. I might be doing something wrong, but the performance is 3-4 times worse than it was with just generating an array. My method has its limitations, but for small stuff it is pretty slick.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org