Load a mlt and obj


#1

Hi

My name is Vincent and i’m trying to build a software that can simply display a 3D that i make with Cinema4D.
The problem i have is: i cannot load the Mtl with my obj.

Here is the code :

import java.io.FileOutputStream;

import peasy.*;

PeasyCam camera;
PShape s;

void setup() {
size(1000, 1000, P3D);
orientation(LANDSCAPE);

// The file and all other data (extracted from the zip file) must be in the data folder
// of the current sketch to load successfully
s = loadShape(“NicetoClub.obj”);

camera = new PeasyCam(this, 200);

background(0);
}

void draw() {
background(255);
rotateY(90);
scale(10);
//translate(width/2, height/2);
lights();
shape(s, 0, 0);
}

Does someone can help me with this i do not understand why it does not work :confused: ?

thank you very much

V.


#2

pls reduce the code to the minimum
where still the error occures
like

PShape s;
//make sub dir /data/
// copy from
// ... Processing\examples\handbook_2e\examples\17 Shapes\Ex_07\data\teapot.obj
String shapefile = "teapot.obj";     //"NicetoClub.obj";

void setup() {
  size(500, 500, P3D);
  s = loadShape(shapefile);
  println(" loaded: "+shapefile);
}

void draw() {
  background(255);
  translate(width/2,height/2);
  //scale(20); 
  shape(s, 0, 0);
}

if a good .obj file loads and shows
test your file,
if it not works pls. show the error messages.
possibly also the file content.


#3

Yes, it’s working, but not with my 3D.

But i do not know what types of settings i need to put on my mtl file to match the processing one :confused:

Do you know witch software i have to use?

thank you very much

V.


#4

sorry, that is not anything i ever play with,
but i try google that for you and got following idea ( pls correct me if i am wrong):

  • you have a 3D CAD tool and make a 3D object
  • you are able to export from it to 2 files
    • obj file contains the vertex information

with this understanding i would say
there is no way to use a .mtl file ( alone )
to draw something in processing
if you find the corresponding .obj file try that first

if you have both files there are some rules like
in the .obj file is a reference to the .mtl file ( so check file name and that entry )

and pls try first

processing 3.4 / File / Examples / + Basics / + Shape / LoadDisplayOBJ

    • also from file manager,

YOURDRIVE:\YOUR_INSTALL_DIR\processing-3.4\modes\java\examples\Basics\Shap\LoadDisplayOBJ\data\

in /data/ will find 3 files, rocket .mtl .obj .png
and the .obj calls the .mtl and that ( at the end ) calls .png

sorry, but you read again in my first answer that i asked you to

show us the error messages and the file content

so some experts might be able to help you.


#5

Sorry, i did’nt answer you.

Here is the error message :
The texture map “P:_\05-Recherches\04-Processing\sketch_3D_visual_net\data-o" in the materials definition file "P:_\05-Recherches\04-Processing\sketch_3D_visual_net\data\NicetoClub.mtl” is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.

But the mtl file is inside the data file, and i try with C4D and Blender, i can’t import it to processing :confused:


#6

actually it looks like NiceToClub.obj calles NiceToClub.mtl and that try to call a other file what is missing??
that

\data-o"

looks bad to me??
can you zip ( only the test program ) with the /data/ directory and the 2 files
and make it available?