Processing example looks different in OF

Hi, I just replicated this Processing example
with OF and found out the result looks quite different.

Here’s the code I rewrote in OF. (which is almost identical to the original code)

float xoff, yoff;

void ofApp::setup(){
    yoff = 0.0f;

void ofApp::update(){

void ofApp::draw(){
    // We are going to draw a polygon out of the wave points
    float xoff = 0;       // Option #1: 2D Noise
    // float xoff = yoff; // Option #2: 1D Noise
    // Iterate over horizontal pixels
    for (float x = 0; x <= ofGetWidth(); x += 10) {
        // Calculate a y value according to noise, map to
        float y = ofMap(ofNoise(xoff, yoff), 0, 1, 200,300); // Option #1: 2D Noise
        // float y = map(noise(xoff), 0, 1, 200,300);    // Option #2: 1D Noise
        // Set the vertex
        ofVertex(x, y);
        // Increment x dimension for noise
        xoff += 0.05;
    // increment y dimension for noise
    yoff += 0.01;
    ofVertex(ofGetWidth(), ofGetHeight());
    ofVertex(0, ofGetHeight());

And here’s the screenshot when I run with Processing.

And this is the screenshot when I run with OF.

As you can see, it fluctuates in much wider range when I run with OF.
Can someone please explain to me why the result is different?
Could this be OF using different Perlin noise algorithm than Processing’s?

Thank you so much in advance!

Maybe Simplex noise vs the original Perlin noise?

With Perlin Noise (Processing) you can specify the number of octaves, which generates noise at different scales.

I think this is a Perlin Noise implementation in C++ but it doesn’t seem to use octaves as the one in Processing.

1 Like

yes, OF uses simplex noise.

you need to multiply by something the parameter you pass to ofNoise in order to “scale” it.


1 Like

Hi guys, Thanks for the replies.

I didn’t know OF uses simplex noise since I read many OF documents saying ofNoise() uses Perlin noise. But maybe it’s not so important. :slight_smile: