SELF PORTRAIT: So Many Ellipses

For the first weekly production assignment, I worked in Processing to make a not-so-realistic self-portrait. The objective was to work with the basic functions and primitive shapes in Processing. This process, frustrating but fun, got me accustomed to the syntax implementation. Additionally, it was a great way to involve in process of researching and discovering different implementation techniques.

Production Process:

I started the assignment with high hopes, thinking to incorporate many artistic elements unaware of how difficult it would be. I sketched some designs digitally and to make it look more cool and trendy, I tried to sketch some Snapchat filters.

Having no experience with Processing beforehand, I had no idea where to start with and how to implement my sketch. After hours of watching different tutorials and trying different things, I decided to take each element one by one and try to implement the simplistic version. Later, I could work on it more to the best of my ability.

1- Size and Background

To start off, I set the size of the canvas to 350×450, resembling a photo ID dimensions standard. Then I used loops to create a grid and ellipses to create a ripple pattern. While I tried to work with different things to incorporate a gradient, I ended up resorting to a solid color background with white strokes.

//ripple effect looking background by creating not filled ellipses using loop
  while(x<= height){
    stroke(250);
    strokeWeight(0.75);
    noFill();
    ellipse(width/2,height/2,x,y);
    x = x + 30;
    y = y + 40;
  }
  
  //grid background
  for(int z = 10; z <= width; z+= 10){
    noFill();
    stroke(250);
    strokeWeight(0.01);
    line(z,0,z,height);
  }
  
  for(int z = 10; z <= height; z+= 10){
    noFill();
    stroke(250);
    strokeWeight(0.01);
    line(0,z,width,z);
  }

2- Face and Shoulders

I tried to do my best in finding the best color to match my skin tone. While the face doesn’t look realistic any bit, but I worked with different sizes of ellipses to form basic features. To make the shoulders, I used continuous curves and filling in any remaining places using rectangles. The eyes were also made using ellipses. The nose and smile were completed using curves.

3- Hair

The most time-consuming and frustrating part was making hair. As I wanted to sort of incorporate my somewhat wavy and color-treated hair, I spent so much time trying different things. Finally, I ended up making three rectangles with different transparency for the gradient. To make some waves and blend the colors in I made some ellipses and positioned them to give the effect of highlights. That is the part where so many ellipses come into effect.  Additionally, for the forehead hair, I used curves, and rather than filling, I just used a thicker stroke. While the code for this part is long, but here is a small snippet:

//hair made using small ellipses and gradient look using rectangles
  fill(52,30,25); //dark brown
  ellipse(width/2, height/2, 190, 220);
  fill(90,42,33,60);   //light brown
  rect(80,204, 188, 150);
  fill(124,30,11,190);  //red
  rect(82,245, 187, 110);
  
  //ellipses to curve hair
  fill(90,42,33,120);
  ellipse(85, 198, 15, 40);
  ellipse(101, 202, 15, 40);
  ellipse(248, 198, 15, 40);
  ellipse(264, 202, 15, 40);
  ellipse(84, 233, 15, 60);

//forehead hair by using continuous curves
  stroke(52,30,25);
  strokeWeight(35);
  beginShape();
  curveVertex(76, 202); // the first control point
  curveVertex(110, 188); // is also the start point of curve
  curveVertex(175, 133); //last point
  curveVertex(184, 115); //last control point
  endShape();

4- Dress

To make the portrait look sort of cute, I used rectangles to make a dress top. For the same reason, I chose a lighter shade of pink and polka dot effect. Nothing fancy, just some rectangles, circles, and cute colors.

5- Accessories

To jazz it up a little more, I wanted to include my everyday accessories at least. So, there you see my most emotionally valuable necklace and my classic nerdy glasses. For the necklace, it was two lines and a circle. The glasses were a couple of rectangles and lines.

//glasses
  stroke(20);
  strokeWeight(2.75);
  rect(126,227,40,20);
  rect(185,227,40,20);
  line(126,227,105,223);
  line(224,227,244, 222);
  line(167,232,184, 232);

//necklace
  strokeWeight(1.2);
  stroke(240,198,31);
  line(148,350,174,398);
  line(174,398, 203, 349);
  noStroke();
  fill(252,20,102);
  circle(175,396,8);

Also here is a short look at the production process:

And there you have the final self-portrait. Although I am kinda disappointed that I was unable to make it look like what I originally intended, I am proud that I got to learn something new and put that in effect. One of the weaknesses of the code is surely the hard-coded position coordinates, which I am in no way proud to do. My takeaway from this production is to practice more and try to be more creative in the implementation. Hopefully, with each production, I would learn more and find ways to enhance my code.

Cheers to a great semester ahead! 

 

 

 

Week1 : Self Portrait

Description

Make a self-portrait from basic shapes using simple drawing functions learned in class. The basic shapes includes but not limited to line, ellipse, rectangle, arc, and circle.

Process

The first step I took in drawing the self-portrait was to sketch the portrait. Having a visual of what I wanted to draw improve my pace overall.

In this project, I realized how useful rectangles can be. In drawing my face, I could have used an ellipse omitting my prominent jaws but I used a rectangle curving the bottom left and bottom right to properly show my jaws. Setting the rectangle mode to center, in the beginning, reduced significantly the time I would have spent experimenting with the right coordinates to use.

The top-to-down execution of Processing code helped a lot in coloring the portrait and in hiding unwanted parts of the shapes used. The execution made drawing and coloring my head, hands, and neck possible.

Using variables played an important role in centering the pupil for the eyes and the nose, eyes, mouth, and eyebrows for the face.

Challenges

The first challenge I faced was drawing my hair. The initial plan was to use an arc on top of my face and fill it with small black circles to depict afro hair. After hours of failing to fill the arc with small circles, I decided to used curly lines which also failed. Finally, I settled on using an ellipse and filling it with black color.

Another challenge I faced was centering my nose. Working with triangle function was hard, I had to read the reference and try out a lot of options before I finally got the nose in the center of the face

Last but not least, coloring my hands was a challenge because filling the torso which was a single arc with the shirt color filled the hand with the same color. I duplicated the arc for the torso and reduced its starting and stopping angles so that filling the color of the shirt won’t affect that of the hands.

Final Work

Code

int centerX;
int centerY;
float faceCenterX;
float faceCenterY;
float earWidth = 20;
float earHeight = 40;

void setup() {
  size(640, 480);
  background(180, 235, 52)
  centerX = width / 2;
  centerY = height / 2;
  faceCenterX = centerX;
  faceCenterY = centerY -100;
};

void draw() {
    stroke(0,0,0);
  rectMode(CENTER);
     fill(197, 140, 133); // skintone
   //neck
   rect(centerX,centerY, 55, 55);
   
   // ears
   ellipse(centerX-80 , centerY-100, earWidth, earHeight);
   ellipse(centerX +80, centerY-100, earWidth, earHeight);

  
   // hair 
    fill(0,0,0);
    ellipse(centerX,centerY-150,180,150);
   
  
   // face
   fill(197, 140, 133); // skintone
   rect(centerX,centerY-100, 150, 150, 3, 6, 50, 50);

   // eyebrows
   arc(faceCenterX-50,faceCenterY - 30, 50, 15, radians(193), radians(347));
   
   arc(faceCenterX+50,faceCenterY -30, 50, 15, radians(193), radians(347));
   
   // mouth
   
   fill(184, 105, 106);
   ellipse(faceCenterX,faceCenterY + 40, 60, 30);
   line(faceCenterX-30, faceCenterY + 40 , faceCenterX +30 , faceCenterY+40);
   
   
   // eyes
   fill(255,255,255); // eye color
   ellipse(faceCenterX -50, faceCenterY -20, 30, 10 );
            // pupil
           fill(0,0,0); // pupilcolor
           ellipse(faceCenterX - 50 , faceCenterY -20, 10, 10 );
           
   fill(255,255,255); //eye color 
   ellipse(faceCenterX + 50, faceCenterY -20, 30, 10 );
           // pupil
           fill(0,0,0); //pupil color
           ellipse(faceCenterX + 50 , faceCenterY -20, 10, 10 );
   
   
   fill(197, 140, 133); // skintone
   
   // nose
   triangle(faceCenterX-20,faceCenterY +20, faceCenterX, faceCenterY-20, 20+faceCenterX, faceCenterY+20);
   
   // torso

   //hands
   fill(197, 140, 133); // skintone
   arc(centerX,centerY+250,350,400,radians(160),radians(400));
   
   //shirt
   fill(43,58,222); //shirt color
   arc(centerX,centerY+200,350,400,radians(180),radians(360));
   line(centerX -170,centerY+150, centerX+170, centerY+150);
   stroke(43,58,222);
   rect(centerX,centerY+160, 250, 200);
 
   
}
  

 

Week 1 : Self Portrait Assignment

Introduction:

As for the assignment, I played around with basic shapes on processing using java and got to know about coordinate systems and basic drawing functions which support sketching the idea on canvas with specified dimensions. In short, processing takes a long-term step to make life easier for artists. As from my perspective coding and programming with different languages consists of art and processing going hand in hand with programmers and artists to work under the same umbrella.

The inspiration behind MY self-portrait:

Although I am not a tennis player myself, my sister is a tennis enthusiast and enjoys playing tennis on a weekly basis. Last week, she had a session that I attended with her as a guest to consider signing up with her. She took a video of me as I was messing around in the end of the session, and it gave me an idea to construct this portrait.

The red dot on my face is used to portray how red I was in the field. I am naturally allergic to the sun and the tennis class consumed my energy which led to me looking like a tomato by the end of the day. My orange shirt and tied ponytail are there to replicate how I looked in the video. The tennis ball is placed on the other side of the field to show that I hit the ball and it fell on the other side of the tennis net , and the purple tennis racket is also inspired from the same video.

Challenges and Problems:

The setup and configuration of the processing software are very easy, and it doesn’t take much time. The problem I faced was during the arc () function and the cutting of ellipse and circle shapes. Understanding the angles and implementation of curves on the right place of both face and body was a challenge on its own. I spent most of my time trying to understand the measurements of the shape and parameters of functions. It was even challenging to spend time learning the functions documentation published on processing. Thus, I did customization on some common shapes like the nose, neck, mouth, and ears by cutting the circular shapes on some angles. Finally, I felt challenged to handle the indentation point as it is not as efficient as other IDEs.

Procedure:

First of all, I worked on the two basic functions of processing which are setup() and draw() functions. Then, with a color selector, I selected relevant colors hex values and initialized global variables for each color with the specified naming convention. I put the colors as a global variable to remember the colors further in code. I researched and understood the 2D coordinate system and began coding global variables for the face and initialized the measurements in setup() functions. By initializing variables in setup() functions, it enhances the reusability of measurements throughout the code and my coding speed.

In the draw() function, I drew the face of the girl by using 2D primitive shapes including ellipse, rectangle, circle, arc, and line. I utilized global variables to fill up the shapes function parameters and do some mathematics by adding and subtracting values from the given parameters. For the face sketching, stroke() and fill() functions were used while the arc() function was mostly to draw the face and other body parts. I played with multiple parameters of the same functions to customize the shape accordingly. By joining multiple shapes, I succeeded to sketch out the girl’s body parts. Subsequently, I worked around the background environment for the ground part, the back sky as illustrated, and sketched the tennis net on it. The reason I placed the tennis net in the foreground was to visualize that the girl is standing on the other side of the tennis net. On the other hand, I drew a tennis ball by utilizing a circular shape that is placed on the frontal side of the ground to mimic my idea more accurately.

To draw the tennis bat, I first stored the hand position in terms of x and y coordinates in temporary variables and then used them to act as a placemark for the tennis bat. Moving on, a series of lines with equal distances on the tennis bat was drawn by using nofill() to give the tennis bat a sensible look. For the girl’s arms, two rectangles were drawn with a specified radius by using the body’s central point. The rectangles were later placed on the right and left sides of the body. For the legs, I calculated the distance from the body central point to place the legs under the body. To outline the shapes drawn, I utilized the strokeweight() function. When it comes to the face, I stored its central point x and y values as global variables. I drew the ear, nose, and eyes using the arc() function with extra parameters to customize the arc shape per the face posture.

//Colors
color haircolor,facecolor,shirtcolor,shoescolor, backgroundcolor,groundcolor,tenniscolor;

//BodyParts Measurements
float faceheight;
float facewidth;

float headheight;
float headwidth;

float hairbandheight;
float hairbandwidth;

float facex;
float facey;

void setup()
{
size(700,700);

//Colors
haircolor=#462218;
facecolor=#DDD6D1;
shirtcolor=#CD7324;
shoescolor=#985036;
backgroundcolor=#4AB7F7;
groundcolor=#557A06;
tenniscolor=#7525CB;


background(backgroundcolor);

//BodyParts Measurements
faceheight=150;
facewidth=200;

headheight=100;
headwidth=200;

hairbandheight=30;
hairbandwidth=30;

facex=250;
facey=400;

}


void draw()
{
  
//drawing face
fill(facecolor);
strokeWeight(5);
arc(facey, facex,facewidth,faceheight,radians(0),radians(360));

//drawing head
fill(haircolor);
arc(facey, facex,facewidth,faceheight,radians(180),radians(370));

//drawing hairband
float hairsposy=facey;
float hairposx=facex-125;
fill(shirtcolor);
arc(facey, facex-90,hairbandwidth,hairbandheight,radians(0),radians(360));

//drawing hairs
fill(haircolor);
ellipse(hairsposy, hairposx,80,40);

//drawing eye
fill(#FFFFFF);
ellipse(facey-55, facex+15, 20, 20);
fill(#000000);
ellipse(facey-55, facex+20, 10, 10);

//drawing eye
fill(#FFFFFF);
ellipse(facey+55, facex+20, 20, 20);
fill(#000000);
ellipse(facey+55, facex+25, 10, 10);


//drawing delight smile
fill(facecolor);
arc(facey, facex+40,40,40,radians(40),radians(150));

//drawing nose
fill(facecolor);
arc(facey, facex+25,20,20,radians(90),radians(180));

//drawing blush on cheeks
fill(#DE3C3C);
strokeWeight(0);
arc(facey+50, facex+45,20,20,radians(0),radians(360));


strokeWeight(5);

//drawing ears
fill(facecolor);
arc(facey-90, facex+30,20,20,radians(70),radians(240));
fill(facecolor);
arc(facey+98, facex+30,20,20,radians(270),radians(500));
//drawing body
fill(shirtcolor);
float bodyposy=facey;
float bodyposx=facex+75;
rect(bodyposy-40,bodyposx,80,100,5);

//drawing right arm
fill(facecolor);
rect(bodyposy+40,bodyposx,20,100,5);
//drawing right hand
fill(shoescolor);
arc(bodyposy+50, bodyposx+100,20,20,radians(0),radians(360));



//drawing left  arm
fill(facecolor);
rect(bodyposy-140,bodyposx,100,20,5);

//drawing left hand
fill(shoescolor);
arc(bodyposy-140, bodyposx+10,20,20,radians(0),radians(360));

//Drawing tennis racket
float handposy = bodyposy-140;
float handposx = bodyposx+10;
fill(tenniscolor);
rect(handposy-15,handposx-100,20,100,20);
noFill();
rect(handposy-40,handposx-200,70,100,35);
float nety=handposy-40;
float netx=handposx-200;
line(nety,netx+20, nety+70,netx+20);
line(nety,netx+30, nety+70,netx+30);
line(nety,netx+40, nety+70,netx+40);
line(nety,netx+50, nety+70,netx+50);
line(nety,netx+60, nety+70,netx+60);
line(nety,netx+70, nety+70,netx+70);
line(nety,netx+80, nety+70,netx+80);
//drawing slight showing neck
fill(facecolor);
arc(facey, facex+80,40,20,radians(0),radians(190));

//drawing legs
fill(facecolor);
rect(bodyposy-40,bodyposx+100,30,80,5);
rect(bodyposy+10,bodyposx+100,30,80,5);

//drawing shoes
float footposy=bodyposy-40;
float footposx=bodyposx+100;
fill(shoescolor);
arc(footposy+15, footposx+85,30,30,radians(0),radians(360));
arc(footposy+65, footposx+85,30,30,radians(0),radians(360));

//drawing grassy ground
fill(groundcolor);
float groundx=footposy+170;
float groundy=footposx-500;
rect(groundy,groundx,800,800,5);

//drawing tennis ball
fill(#25CB2E);
arc(footposy+75, footposx+200,40,40,radians(0),radians(360));



//drawing fence
fill(shoescolor);
rect(footposy-250,footposx-140,30,300,5);
fill(shoescolor);
rect(footposy+250,footposx-140,30,300,5);
stroke(5);
line(footposy-250,footposx-80, footposy+250,footposx-80);
line(footposy-250,footposx-60, footposy+250,footposx-60);
line(footposy-250,footposx-40, footposy+250,footposx-40);
line(footposy-250,footposx-20, footposy+250,footposx-20);
line(footposy-250,footposx, footposy+250,footposx);
line(footposy-250,footposx+20, footposy+250,footposx+20);

}

 

 

 

 

 

 

 

 

 

My Self-Portrait Final Edition:

Conclusion:

Working on this assignment allows me to dive into the basics of programming. To understand the basics of computer graphics and math behind the pixels. I learned my way by drawing basic shapes using simple coding on processing. Processing ensures the testing of coding most conveniently and more simply which I like most. There are no debugging configurations in processing. I tested each shape drawing simply by running the code efficiently and reliably.

 

 

Self Portrait – Jade

WEEK 1 Documentation

 

In this project, I used some basic functions of Processing and shapes like lines, quads, ellipses, triangles and rectangles to make a self-portrait. I also included a little animation using knowledge learned from class. I intended to portrait my face in an angle, so in my project, my face has turned right a little bit.

Throughout the whole process, I faced some difficulties, like appropriately locating the points. I had to adjust the coordinates several times so that they can finally make up the shape I want. And when I was doing the animation of my mouth, it was strange that as my mouth moved, there appeared a black triangle, so I had to place a rectangle of the background color behind my mouth triangle. That’s why I have this line of code:

rect(width/2 - 60, height/2 + 50, 100, 70);

However, among all the difficulties, I found depicting my hair most challenging. I first tried to use curves and the BezierVertex, but unfortunately since I didn’t master these functions, it didn’t go well. So then I used arcs, and to make it more me, I added some quads at the back.

From this project, I think I have learned and improved a lot as I tried using various functions and shapes in Processing. Although my work might not be artistic or elaborate, I think it captured some of my features. I am sure that I still have got a lot to learn in Processing since I kept coding in a stupid way, and I look forward to learning more of it!

 

My Code:

int mouth_height = 50;
int speed = 1;
PFont f;


void setup() {
  size(640, 480);
  background(#FFFFAD);
  
  // hair
  noStroke();
  fill(#4B2D0E);
  quad(286, 100, 243, 60, 181, 122, 188, 264);
  quad(398, 110, 454, 95, 460, 283, 300, 283);

  // head
  stroke(0);
  strokeWeight(2);
  fill(249, 236, 228);
  ellipse(width/2, height/2 - 10, 270, 300); 
  quad(269, 360, 274, 433, 422, 440, 401, 360);
  noStroke();
  rect(268, 353, 120, 15);
  fill(255);
  stroke(0);
  quad(252, 400, 281, 450, 322, 435, 296, 415);
  triangle(322, 435, 425, 400, 425, 460);
  
  // eyebrow
  noStroke();
  fill(#4B2D0E);
  triangle(227, 156, 220, 145, 290, 156);
  triangle(329, 152, 378, 140, 390, 153);
  
  // front hair
  noStroke();
  fill(#4B2D0E);
  arc(260, 109, 160, 130, radians(135), radians(315));
  arc(356, 110, 200, 180, radians(200), radians(360+45));
  
  // eyes
  stroke(0);
  fill(255);
  ellipse(240, 180, 70, 30); 
  ellipse(370, 180, 80, 30); 
  
  fill(#461414);
  ellipse(240, 180, 30, 30);
  ellipse(370, 180, 40, 30);

  fill(255);
  ellipse(236, 183, 7, 7);
  ellipse(364, 182, 7, 7);
  

  // nose
  fill(0);
  strokeWeight(2);
  line(width/2 - 20, height/2 - 40, width/2 - 35, height/2 + 10);
  line(width/2 - 10, height/2, width/2, height/2 + 10);
  line(width/2 - 35, height/2 + 10, 298, 256);


  // glasses
  fill(206, 209, 227, 118);
  stroke(#F2E662);
  rect(180, 140, 110, 80, 12, 24, 48, 72);
  line(290, 180, 320, 180);
  rect(320, 142, 115, 80, 12, 24, 48, 72);
  line(435, 180, 450, 160);

  // ear
  stroke(0);
  fill(249, 236, 228);
  arc(455, 229, 35, 50, TWO_PI - HALF_PI, TWO_PI + HALF_PI);
  

  // sign
  f = createFont("AmericanTypewriter-Semibold", 48, true);
}

void draw() {
  println(mouseX + ", " + mouseY);

  // mouth
  fill(249, 236, 228);
  noStroke();
  rect(width/2 - 60, height/2 + 50, 100, 70);
  
  if (mouth_height == 80 || (mouth_height == 50 && speed < 0)) {
    speed *= -1;
  }
  
  mouth_height += speed;
  fill(#FFD3D3);
  stroke(0);
  strokeWeight(2);
  triangle(width/2 - 40, height/2 + 50, width/2 + 30, height/2 + 50, width/2 - 30, height/2 + mouth_height);

  fill(0);
  textFont(f, 30);
  text("Jade Zhou", 480, 389);
}

 

My work: