We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOther Libraries › OBJ loader: model misses faces
Page Index Toggle Pages: 1
OBJ loader: model misses faces (Read 600 times)
OBJ loader: model misses faces
Apr 19th, 2008, 11:59am
 
Hi,

It's great to be able to use models made in Maya, Max and the like in processing! I've been able to load some simple models (boxes with textures) but with a more complex model (of a couch) I've experienced some difficulties: some of its faces are missing - the inner sides of the arm rests, and the top of the back/arm rests.

You can see the sketch on:
http://benmeijering.nl/obj/

You can rotate the object with the mouse.
I've tried various render modes but POLYGON works best. Does somebody know what I need to do

.ben
Re: OBJ loader: model misses faces
Reply #1 - Apr 20th, 2008, 2:06am
 
Hi Ben.

I need some information to help track down the bug. What package did you use to make he couch? Is the mesh triangulated?

If you can send through the sketch and the model I can take a crack at it and try to narrow down the problem.

MattD
Re: OBJ loader: model misses faces
Reply #2 - Apr 20th, 2008, 10:22pm
 
Hi Matt,

The mesh wasn't triangulated. I just triangulated the mesh but that doesn't solve the problem.

I used Maya 8.5 to make the object file.

I don't know your email address; if you don't mind you can get the obj, mtl and pde files (zipped) here:

http://benmeijering.nl/obj_loader_exp.zip

Thanks, Ben
Re: OBJ loader: model misses faces
Reply #3 - Apr 21st, 2008, 12:26am
 
Changing the draw mode to TRIANGLES works a treat. Also the drawMode call only needs to be made once. Dropping it into setup works fine.


Quote:

import saito.objloader.*;
import processing.opengl.*;

OBJModel model;
float rotX;
float rotY;

void setup() {
 size(400, 400, OPENGL);
 model = new OBJModel(this);
 model.load("couch.obj"); // dma.obj in data folder
 model.debugMode();
 model.drawMode(TRIANGLES);
}



void draw() {
 background(51);
 noStroke();
 lights();

 pushMatrix();
 translate(width/2, height/2, 0);
 rotateX(rotY);
 rotateY(rotX);
 scale(15.0);
 fill(255);
 model.draw();
 popMatrix();
}

void keyPressed() {
 if(key == 'a') {
   model.enableTexture();
 }
 else if(key=='b') {
   model.disableTexture();
   model.disableMaterial();
 }
}

void mouseDragged() {
 rotX += (mouseX - pmouseX) * 0.01;
 rotY -= (mouseY - pmouseY) * 0.01;
}
Re: OBJ loader: model misses faces
Reply #4 - Apr 21st, 2008, 9:27am
 
Matt, Thank you for your time. I'm a bit embarrassed not to have changed drawmode() to TRIANGLES after having the mesh triangulated in Maya.
Re: OBJ loader: model misses faces
Reply #5 - Apr 21st, 2008, 9:44am
 
Don't worry ben, I stuff that up all the time.
Page Index Toggle Pages: 1