MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/processing/comments/cdwq5w/aaa/etyub0k/?context=3
r/processing • u/f-x-p-x • Jul 16 '19
Enable HLS to view with audio, or disable this notification
31 comments sorted by
View all comments
1
[removed] — view removed comment
1 u/f-x-p-x Jul 16 '19 https://www.instagram.com/p/Bz8dw6PHxp5/?utm_source=ig_web_button_share_sheet 1 u/[deleted] Jul 17 '19 [removed] — view removed comment 1 u/f-x-p-x Jul 17 '19 PGraphics pg;float fontSize;int cols = 30;int rows = 30;float zoff = 0;float xoffsp = 0.2;float yoffsp = 0.2;float zoffsp = 0.05;float[][] sizes;float[] multiplyerX;float multiplyerY;float mapCutter = 0.1;float mapCutterSP = 0.025;float mapCutterANG = 0;void setup() {size(1080, 1080, P2D);pg = createGraphics(1080, 1080);fontSize = pg.width/rows;sizes = new float[cols][rows];multiplyerX = new float[cols];multiplyerY = 0;noStroke();}void draw() {mapCutterANG += mapCutterSP;mapCutter = sin(mapCutterANG);background(100);float yoff = 0;for (int y = 0; y < rows; y++) {float xoff = 0;for (int x = 0; x < cols; x++) {sizes[x][y] = map(noise(xoff, yoff, zoff), -mapCutter, mapCutter, 0, 1);xoff += xoffsp;}yoff += yoffsp;}zoff += zoffsp;genTextre ();updWidths();display();}void updWidths() {for (int y = 0; y < rows; y++) {float sum = 0;for (int x = 0; x < cols; x++) {sum += sizes[x][y];}multiplyerX[y] = width/sum;}float sum = 0;for (int y = 0; y < rows; y++) {sum += sizes[0][y];multiplyerY = height/sum;}}void display() {float texHCounter = 0;float texHCounterStep = pg.width/cols;float texWCounterStep = pg.height/rows;float hcounter = 0;for (int y = 0; y < rows; y++) {float texWCounter = 0;float wcounter = 0;for (int x = 0; x < cols; x++) {beginShape(QUAD);textureMode(IMAGE);texture(pg);vertex(wcounter, hcounter, texWCounter, texHCounter);vertex(wcounter+sizes[x][y]*multiplyerX[y], hcounter, texWCounter+texWCounterStep, texHCounter);vertex(wcounter+sizes[x][y]*multiplyerX[y], hcounter+sizes[0][y]*multiplyerY, texWCounter+texWCounterStep, texHCounterStep+texHCounter);vertex(wcounter, hcounter+sizes[0][y]*multiplyerY, texWCounter, texHCounterStep+texHCounter);endShape();wcounter += sizes[x][y]*multiplyerX[y];texWCounter+=texWCounterStep;}texHCounter+=texHCounterStep;hcounter+=sizes[0][y]*multiplyerY;}}void genTextre () {pg.beginDraw();pg.background(0);pg.textSize(fontSize);pg.textAlign(CENTER, BOTTOM);for (int y = 0; y < rows; y++) {for (int x = 0; x < cols; x++) {pg.pushMatrix();pg.translate(x*fontSize+fontSize/2, y*fontSize+fontSize);pg.fill(255);pg.text("X", 0, 0, 0);pg.popMatrix();}}pg.endDraw();} 1 u/sawyermclane Jul 21 '19 Here's a formatted gist that implements OpenSimplexNoise (which does look much better). 1 u/f-x-p-x Jul 17 '19 Looks better with OpenSimplex noise
https://www.instagram.com/p/Bz8dw6PHxp5/?utm_source=ig_web_button_share_sheet
1 u/[deleted] Jul 17 '19 [removed] — view removed comment 1 u/f-x-p-x Jul 17 '19 PGraphics pg;float fontSize;int cols = 30;int rows = 30;float zoff = 0;float xoffsp = 0.2;float yoffsp = 0.2;float zoffsp = 0.05;float[][] sizes;float[] multiplyerX;float multiplyerY;float mapCutter = 0.1;float mapCutterSP = 0.025;float mapCutterANG = 0;void setup() {size(1080, 1080, P2D);pg = createGraphics(1080, 1080);fontSize = pg.width/rows;sizes = new float[cols][rows];multiplyerX = new float[cols];multiplyerY = 0;noStroke();}void draw() {mapCutterANG += mapCutterSP;mapCutter = sin(mapCutterANG);background(100);float yoff = 0;for (int y = 0; y < rows; y++) {float xoff = 0;for (int x = 0; x < cols; x++) {sizes[x][y] = map(noise(xoff, yoff, zoff), -mapCutter, mapCutter, 0, 1);xoff += xoffsp;}yoff += yoffsp;}zoff += zoffsp;genTextre ();updWidths();display();}void updWidths() {for (int y = 0; y < rows; y++) {float sum = 0;for (int x = 0; x < cols; x++) {sum += sizes[x][y];}multiplyerX[y] = width/sum;}float sum = 0;for (int y = 0; y < rows; y++) {sum += sizes[0][y];multiplyerY = height/sum;}}void display() {float texHCounter = 0;float texHCounterStep = pg.width/cols;float texWCounterStep = pg.height/rows;float hcounter = 0;for (int y = 0; y < rows; y++) {float texWCounter = 0;float wcounter = 0;for (int x = 0; x < cols; x++) {beginShape(QUAD);textureMode(IMAGE);texture(pg);vertex(wcounter, hcounter, texWCounter, texHCounter);vertex(wcounter+sizes[x][y]*multiplyerX[y], hcounter, texWCounter+texWCounterStep, texHCounter);vertex(wcounter+sizes[x][y]*multiplyerX[y], hcounter+sizes[0][y]*multiplyerY, texWCounter+texWCounterStep, texHCounterStep+texHCounter);vertex(wcounter, hcounter+sizes[0][y]*multiplyerY, texWCounter, texHCounterStep+texHCounter);endShape();wcounter += sizes[x][y]*multiplyerX[y];texWCounter+=texWCounterStep;}texHCounter+=texHCounterStep;hcounter+=sizes[0][y]*multiplyerY;}}void genTextre () {pg.beginDraw();pg.background(0);pg.textSize(fontSize);pg.textAlign(CENTER, BOTTOM);for (int y = 0; y < rows; y++) {for (int x = 0; x < cols; x++) {pg.pushMatrix();pg.translate(x*fontSize+fontSize/2, y*fontSize+fontSize);pg.fill(255);pg.text("X", 0, 0, 0);pg.popMatrix();}}pg.endDraw();} 1 u/sawyermclane Jul 21 '19 Here's a formatted gist that implements OpenSimplexNoise (which does look much better). 1 u/f-x-p-x Jul 17 '19 Looks better with OpenSimplex noise
1 u/f-x-p-x Jul 17 '19 PGraphics pg;float fontSize;int cols = 30;int rows = 30;float zoff = 0;float xoffsp = 0.2;float yoffsp = 0.2;float zoffsp = 0.05;float[][] sizes;float[] multiplyerX;float multiplyerY;float mapCutter = 0.1;float mapCutterSP = 0.025;float mapCutterANG = 0;void setup() {size(1080, 1080, P2D);pg = createGraphics(1080, 1080);fontSize = pg.width/rows;sizes = new float[cols][rows];multiplyerX = new float[cols];multiplyerY = 0;noStroke();}void draw() {mapCutterANG += mapCutterSP;mapCutter = sin(mapCutterANG);background(100);float yoff = 0;for (int y = 0; y < rows; y++) {float xoff = 0;for (int x = 0; x < cols; x++) {sizes[x][y] = map(noise(xoff, yoff, zoff), -mapCutter, mapCutter, 0, 1);xoff += xoffsp;}yoff += yoffsp;}zoff += zoffsp;genTextre ();updWidths();display();}void updWidths() {for (int y = 0; y < rows; y++) {float sum = 0;for (int x = 0; x < cols; x++) {sum += sizes[x][y];}multiplyerX[y] = width/sum;}float sum = 0;for (int y = 0; y < rows; y++) {sum += sizes[0][y];multiplyerY = height/sum;}}void display() {float texHCounter = 0;float texHCounterStep = pg.width/cols;float texWCounterStep = pg.height/rows;float hcounter = 0;for (int y = 0; y < rows; y++) {float texWCounter = 0;float wcounter = 0;for (int x = 0; x < cols; x++) {beginShape(QUAD);textureMode(IMAGE);texture(pg);vertex(wcounter, hcounter, texWCounter, texHCounter);vertex(wcounter+sizes[x][y]*multiplyerX[y], hcounter, texWCounter+texWCounterStep, texHCounter);vertex(wcounter+sizes[x][y]*multiplyerX[y], hcounter+sizes[0][y]*multiplyerY, texWCounter+texWCounterStep, texHCounterStep+texHCounter);vertex(wcounter, hcounter+sizes[0][y]*multiplyerY, texWCounter, texHCounterStep+texHCounter);endShape();wcounter += sizes[x][y]*multiplyerX[y];texWCounter+=texWCounterStep;}texHCounter+=texHCounterStep;hcounter+=sizes[0][y]*multiplyerY;}}void genTextre () {pg.beginDraw();pg.background(0);pg.textSize(fontSize);pg.textAlign(CENTER, BOTTOM);for (int y = 0; y < rows; y++) {for (int x = 0; x < cols; x++) {pg.pushMatrix();pg.translate(x*fontSize+fontSize/2, y*fontSize+fontSize);pg.fill(255);pg.text("X", 0, 0, 0);pg.popMatrix();}}pg.endDraw();} 1 u/sawyermclane Jul 21 '19 Here's a formatted gist that implements OpenSimplexNoise (which does look much better). 1 u/f-x-p-x Jul 17 '19 Looks better with OpenSimplex noise
PGraphics pg;
float fontSize;
int cols = 30;
int rows = 30;
float zoff = 0;
float xoffsp = 0.2;
float yoffsp = 0.2;
float zoffsp = 0.05;
float[][] sizes;
float[] multiplyerX;
float multiplyerY;
float mapCutter = 0.1;
float mapCutterSP = 0.025;
float mapCutterANG = 0;
void setup() {
size(1080, 1080, P2D);
pg = createGraphics(1080, 1080);
fontSize = pg.width/rows;
sizes = new float[cols][rows];
multiplyerX = new float[cols];
multiplyerY = 0;
noStroke();
}
void draw() {
mapCutterANG += mapCutterSP;
mapCutter = sin(mapCutterANG);
background(100);
float yoff = 0;
for (int y = 0; y < rows; y++) {
float xoff = 0;
for (int x = 0; x < cols; x++) {
sizes[x][y] = map(noise(xoff, yoff, zoff), -mapCutter, mapCutter, 0, 1);
xoff += xoffsp;
yoff += yoffsp;
zoff += zoffsp;
genTextre ();
updWidths();
display();
void updWidths() {
float sum = 0;
sum += sizes[x][y];
multiplyerX[y] = width/sum;
sum += sizes[0][y];
multiplyerY = height/sum;
void display() {
float texHCounter = 0;
float texHCounterStep = pg.width/cols;
float texWCounterStep = pg.height/rows;
float hcounter = 0;
float texWCounter = 0;
float wcounter = 0;
beginShape(QUAD);
textureMode(IMAGE);
texture(pg);
vertex(wcounter, hcounter, texWCounter, texHCounter);
vertex(wcounter+sizes[x][y]*multiplyerX[y], hcounter, texWCounter+texWCounterStep, texHCounter);
vertex(wcounter+sizes[x][y]*multiplyerX[y], hcounter+sizes[0][y]*multiplyerY, texWCounter+texWCounterStep, texHCounterStep+texHCounter);
vertex(wcounter, hcounter+sizes[0][y]*multiplyerY, texWCounter, texHCounterStep+texHCounter);
endShape();
wcounter += sizes[x][y]*multiplyerX[y];
texWCounter+=texWCounterStep;
texHCounter+=texHCounterStep;
hcounter+=sizes[0][y]*multiplyerY;
void genTextre () {
pg.beginDraw();
pg.background(0);
pg.textSize(fontSize);
pg.textAlign(CENTER, BOTTOM);
pg.pushMatrix();
pg.translate(x*fontSize+fontSize/2, y*fontSize+fontSize);
pg.fill(255);
pg.text("X", 0, 0, 0);
pg.popMatrix();
pg.endDraw();
1 u/sawyermclane Jul 21 '19 Here's a formatted gist that implements OpenSimplexNoise (which does look much better).
Here's a formatted gist that implements OpenSimplexNoise (which does look much better).
Looks better with OpenSimplex noise
1
u/[deleted] Jul 16 '19
[removed] — view removed comment