Mapping 3D noise in Processing

None of these are specifically related to that example, however it should give you some insight into how to code your own. These example make use of a triangle strip to create terrain, which you could replace by simple text and adjust the text size.

example one

int cols, rows;
int scl = 20; //scale
int w = 1200; //width, adjustable
int h = 900; //height, adjustable

int atX = 0;
int atY = 0;

float [][] z;

float moveOffX = 0;
float moveOffY = 0;

void setup() {
  size(1100, 660, P3D);
  frameRate(60);


  cols = w / scl;
  rows = h / scl;
  z = new float[cols][rows];
  float yoff = 0; //small float offset for smooth changes in value
  for (int y = 0; y < rows; y++) {
    float xoff = 0;
    for (int x = 0; x < cols; x++) {
      z[x][y] = map(noise(xoff, yoff), 0, 1, -100, 100); //output of map(last numbers) controlled for height of mountains.
      xoff += 0.2;//change offsets to control smoothness.
    }
    yoff +=0.2;
  }
}

void draw() {
  background(0);
  stroke(255);
  fill(111, 222, 55);

  translate(width/2, height/2); //prepares to rotate everything relative to center of window
  rotateX(radians(45));


  translate(-w/2, -h/2); //offsets beginning of coordinates so that all of them appear in the screen.

  //TRIANGLE_STRIP: LAND
  for (int y = 0; y < rows-1; y++) {
    beginShape(TRIANGLE_STRIP);
    for (int x = 0; x < cols; x++) {
      vertex(x*scl, y*scl, z[x][y]);
      vertex(x*scl, (y+1)*scl, z[x][y+1]);
    }
    endShape();
  }

  for (int y = 0; y < rows-1; y++) {
    for (int x = 0; x < cols; x++) {

      if (x == atX && y == atY) {
        fill(255, 0, 0);
        pushMatrix();
        translate(x*scl, y*scl, z[x][y] + 9); //the addition makes the ellipse not intersect the mountains for the most part.
        ellipse(0, 0, 19, 19);
        popMatrix();
      }
    }
  }

  //these are the coordinates now. I can control these to control the thing's movement.
  atX = int(map(mouseX, 0, width, 0, cols));
  atY = int(map(mouseY, 0, height, 0, rows));

}

1 Like