edited December 2015 in Library Questions

i have several OBJ files from my 3D CAD Design and i will like to bring it in to processing for interactive gui for arduino project


  • There is an example in Basics->Shape->loadDisplayOBJ

  • edited November 2015

    no yes i just noticed this tho it was not there i stumble across it by messing around with the ide add library, but i have a model obj file of a brain and i want to know how do i increase rendering speed or size of model in processing ? or do i gotta do all that in my 3d modeling prog?

  • Easiest way is to just add scale(); - see the edited example below. This simply imports the rocket in the example twice the size i.e. scale(2);

     PShape rocket;
        float ry;
        public void setup() {
          size(640, 360, P3D);
          rocket = loadShape("rocket.obj");
        public void draw() {
          translate(width/2, height/2 + 100, -200);
          ry += 0.02;
  • @PDF197 does scale() takes any arguments in the constructor? i mean am i putting the brain obj inside the "scale(brain)"?

  • No, scale(brain) would not work.

    I do not know how far you have gone with this, or how much you know already so a hint... Someone might have a better way, but if you want to change the scale using a sensor input from Arduino think this way this...

    The scale(); function needs a float (number) to know how much to scale the model that is being imported. For example, scale(2); would import your model at double the original size.

    What you can do is define your own float at the start of your sketch, e.g. float ScaleBrain = 1. Use scale(ScaleBrain) to create a variable, you can then control with your Arduino input.

    This uses the same example, but with a few changes. This assumes your brain file is called brain.obj.

        PShape brain;
        float ScaleBrain = 1;
        //float ScaleBrain = random(1,5);
        float ry;
        public void setup() {
          size(640, 360, P3D);
          brain = loadShape("brain.obj");
        public void draw() {
          translate(width/2, height/2 + 100, -200);
          ry += 0.02;
  • i hear you ill keep this info in mind BUT this is not a arduino in or output this is just a obj model ONCE im close to done then the arduino will communicate via rs232 to processing but this is not where im at NOW im simply trying to have the brain model "imported" then i want to have it interact with the serial com port....

    tho as in now i did try your sketch above but i got this error about memory ? im not sure i uploaded a screenshot hope this helps you help me,Screenshot (72)

  • edited December 2015

    That suggests the file you are importing is quite big. How many vertices/faces etc. does it have? Try this:

    Open Processing > Go to preferences > Tick the "Increase Maximum Memory... box > increase to 512Mb (or more) > OK > Run sketch again.


  • hmmm i never thought of the memory increase, ill try that tho the obj is 45mb wow i dint even kno that ! im not sure about the vertices tho i did found all this other info tho. that memory in Processing was @256 ill jacked it up to 1000mb i did not noticed a diff, i even got this sketch that run in draw six gif and a face dtection sketch i merged to it from a example and the gif are all lagging like as 1 fps even tho i have it set to 100 frames here is the setup & draw but the facedetection dont even do its job the cam opens up but dont detect squat! ughh


    public void setup() 
      size(1280, 900);
      video = new Capture(this, 640, 360,"Microsoft LifeCam Front" ); // this,640,480"USB2.0 Camera"
      //                     Side.0-Down.0   
      opencv = new OpenCV(this, 900,900);//width/scl, height/scl
      faceList = new ArrayList<Face>();
      println("Cortan Visual GUI " + Gif.version());
      Cortan = new Gif(this, "Cortan.gif");
      b1= new Gif(this, "b1.gif");
      c= new Gif(this, "c.gif");
      x= new Gif(this, "x.gif");
      aa= new Gif(this, "aa.gif");
      bb= new Gif(this, "bb.gif");
      cc= new Gif(this, "cc.gif");
      ccc= new Gif(this, "ccc.gif");
      silo= new Gif(this, "silo.gif");
    void draw() 
      image(video, 0, 0 );
      //      X.0-Y.0    
      image(b1, 650, 0);
      image(c, 650, 100);
      image(aa, 10, 700);
      image(bb, 0, 400);
      image(cc, 0, 550);
      image(ccc, 900, 100/2);
      image(silo, 900, 300);
      image(x, 900, 200);
      image(Cortan, 400, 360);//, 0, width / 2 - Cortan.height / 2);
      //image(animation[(int) (animation.length / (float) (width) * mouseX)], width - 10 - animation[0].width, height / 2 - animation[0].height / 2);
      // Draw all the faces
      for (int i = 0; i < faces.length; i++) 
        stroke(255, 0, 0);
        rect(faces[i].x, faces[i].y, faces[i].width, faces[i].height);
        saveFrame("DBase/Meet-####.jpg");//********I ADDED THIS**********
      for (Face f : faceList) 

    Screenshot (68)

This discussion has been closed.