I found an Openprocessing code of an album cover of Joy Division’s ‘Unknown Pleasures’. The code was originally written by Craig S. Kaplan. So overwhelmed by the beauty of it, I attempted to translate this to pde. However, I’m a beginner. And I’ve been bamboozled by my previous renders. The code underneath is currently where I am. (Please visit the link first, so you could see the original p5js code.)
Now the noise function became slower. It’s still a rocky mountain shape and it’s much taller…
Any function or revision to escape from rocky mountain shape to horizontal lines with Perlin noise?
Seeing you’re using the same dimensions as the original sketch, the issue isn’t with the formulas. The reason I emphasized the for(x=0;x<b;++x), is because it only contains a single line of code, which is the first vertex. The second vertex is outside of this loop!
When I try to convert the original code to Processing Java, I’m a bit closer to your desired result:
int x;
float f = 0;
void setup() {
size(300, 500);
}
void draw() {
f++;
background(0);
fill(0);
stroke(255);
for (int y = 100; y < height; y += 5) {
beginShape();
for (x = 0; x < height; ++x) {
float joyDivision = y - 80 / (1 + pow(x - 150, 4) / 8e6) * noise(x / 30 + f / 50 + y);
vertex(x, joyDivision);
}
vertex(x, 1e4);
endShape();
}
}
edit
In your linked example, put both vertices between { curly brackets }. You’ll reproduce an error similar to your first sketch.
So I emailed to professor Craig Kaplan, whom I mentioned.
The reason why I couldn’t get the exact waveform from @Tiemen was the way Java treats integer.
Javascript believes that all numbers are floating-point; Java treats integers specially, and uses integer division (with truncation) when it can. --from Craig Kaplan’s reply.