Load a mlt and obj

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.

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.

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.

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.

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:

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?

Sorry; i’m a little bit late.

Well here is the program :
https://wetransfer.com/downloads/abac648bc63cfb8c7fb5a77a513c963b20181119101327/55ff8d

Can you tell me what is the problem?

thannk you very much.

V.

sorry,

  • even after moving the UF2-00114.jpg up
    and changing the mtl file
  • or even disable the mtl file in obj file

i not come further as:

Unsupported format: NicetoClub.obj

i hope now the specialists can jump in.

If I edit the .mtl file and replace

map_Kd -o 0.000000 -1.000000 0.000000 tex\\UF2-00114.jpg                                                                                
map_d -o 0.000000 -1.000000 0.000000 Octobre 2018\\NICETOCLUB\\tex\\UF2-00114.jpg

with

map_Kd tex/UF2-00114.jpg                                                                                
map_d tex/UF2-00114.jpg

it works for me. Maybe in Windows it’s \\ instead of /.

Why? I don’t know :slight_smile: I looked at http://paulbourke.net/dataformats/mtl/ and found map_Kd and map_d. The -o argument should be valid, but for some reason it’s not working.

Surprising, though, is that the frameRate I get with the texture is 1 fps, even if I scale it down to 10% of its size. On a GTX 1060. Very strange.

1 Like

Thank you very much, it’s finally working :slight_smile:

well, i do not know too… that’s strange, maybe i can ask to unload the texture while i’m moving the model…?