Low frame rate drawing .obj

edited December 2017 in Questions about Code

Hello, guys,

In Processing IDE, if you move to Examples > Shape > LoadShapeOBJ you'll get a code that simply load an .obj file containing a 3D model of a rocket and draw it.

However, if you just exchange that .obj with the one in the link below, sketch gets extremely slow. No loading in draw(), no pushing and popping matrices, no complex operations and still too bad. If I load it without textures, it draws ok, so the problem refers to the textures drawing. Any tips to make it more efficiently?

https://drive.google.com/open?id=1W35RJG4DvewOfsoSPPP8E5_qDJgnCqno

Thanks in advance!

Tagged:

Answers

  • edited December 2017

    I open it in Blender the UV Map looks very messy, it is too expensive to push all the data, ( crazy lines ends up to polygons not very well corresponding to the actual shape), you should manually unwrap it again then it should work.

    so i have no time to search for a good reference.
    as example how a uv map looks like:
    youtu.be/sZDMFkj8GqA?t=6m38s . .

    img


    here is your original obj i just commented the materials definition

    "# mtllib BlackRoseDragon.mtl"

    • copy +paste
    • hit run

    //

    PShape dragon;
    void setup() {
      size(640, 360, P3D);
      dragon = loadShape("https://"+"docs.google.com/uc?id=1H17owIfC1erPKLbYaybcWDTxCJYeyc6Q&export=download"+".obj");
    }
    float ry;
    void draw() {
      background(255);
      lights();
      translate(width/2, height/2);
      rotateY(ry += 0.02);
      scale(2);
      shape(dragon);
      surface.setTitle(String.format(getClass().getSimpleName()+ " [fps %6.2f]", frameRate));
    }
    
Sign In or Register to comment.