Processing-Tutorial: Rasterize 3D

YouTube

By loading the video, you agree to YouTube’s privacy policy.
Learn more

Load video

In this tutorial I show you how to create abstract 3D portraits from any image file. Here you will learn many basics about 3D and generative image rasterization.

Please let me know what you think! I am very curious about your ideas. And as always, feel free to share your results on Instagram or Twitter.

Here’s the final code:

PImage img;

void setup() {
  size(900, 900, P3D);
  img = loadImage("venus.jpg");
  img.resize(900, 900);
}

void draw() {
  background(#f1f1f1);
  fill(0);
  noStroke();
  sphereDetail(3);
  float tiles = 100;
  float tileSize = width/tiles;
  push();
  translate(width/2,height/2);
  rotateY(radians(frameCount));
  
  for (int x = 0; x < tiles; x++) {
    for (int y = 0; y < tiles; y++) {
      color c = img.get(int(x*tileSize),int(y*tileSize));
      float b = map(brightness(c),0,255,1,0);
      float z = map(b,0,1,-150,150);
      
      push();
      translate(x*tileSize - width/2, y*tileSize - height/2, z);
      sphere(tileSize*b*0.8);
      pop();
      
    }
  }
  pop();
}

Enjoy!

Recommended tutorial: Video-Export

If you want to know how to render videos from your sketches, check this post:

Exhibition

Pranav Sakhalkar

Published by Tim on Friday March 20, 2020

Last modified on July 15th, 2020 at 18:15


Related

27. July 2020

The Magic Triangle

The Magic Triangle is a powerful creativity technique that can be applied to many different areas.

15. March 2020

Alpha-Release: “Creative Coding Essentials”

After more than 7 months of experimentation, planning and creating i am finally abled to release a first Alpha-version of […]

6. December 2019

Processing-Tutorial: Image-Rasterizer

Level: Beginner & intermediate In this tutorial i’ll guide you through all the necessary steps to rasterize an image with […]

4. November 2019

Processing-Tutorial: WAVES pt. 1

This is the first part of a brand new tutorial-series about Waves, a fundamental skill and feature in Generative Design […]

19. July 2019

Getting started with Creative Coding

I quite get often asked for advices on how to get started with creative coding. These are my most essential […]

16. April 2019

Processing-Tutorial: Kinetic Typography 1

In the last years i’ve observed a new tendency in typography and graphic design which has been made possible by […]

14. April 2019

Processing-Tutorial: Video Export

One of the most powerful features of Processing in comparison to all web-based approaches and frameworks (like p5.js) is the […]

1. March 2019

How to rasterize an image with Processing

In this post i’ll teach you how to access the data of an image and how to use it to […]

28. February 2019

My 10 favorite Processing-libraries

So called “libraries” extend the functionality of the software-development-enviroment Processing. Please handle those extensions with care: If you are a […]

18. December 2018

Processing or p5.js? My opinions

In this video i share my opinions about the benefits of p5.js and Processing. I also talk about how i’ve […]