# Load a mlt and obj

**URL:** <https://discourse.processing.org/t/load-a-mlt-and-obj/5222>\
**Category:** Libraries\
**Created:** [November 5, 2018, 11:47am UTC](https://discourse.processing.org/t/load-a-mlt-and-obj/5222 "2018-11-05T11:47:34Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![MarsatAE](https://avatars.discourse-cdn.com/v4/letter/m/85e7bf/32.png) [@MarsatAE](https://discourse.processing.org/u/MarsatAE)\
**Post date:** [November 5, 2018, 11:47am UTC](https://discourse.processing.org/t/load-a-mlt-and-obj/5222/1 "2018-11-05T11:47:34Z")

</div>

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 😕 ?

thank you very much

V.

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [November 5, 2018, 12:30pm UTC](https://discourse.processing.org/t/load-a-mlt-and-obj/5222/2 "2018-11-05T12:30:20Z")

</div>

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

```auto
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.

---

<div class="post-metadata">

**Author:** ![MarsatAE](https://avatars.discourse-cdn.com/v4/letter/m/85e7bf/32.png) [@MarsatAE](https://discourse.processing.org/u/MarsatAE)\
**Post date:** [November 8, 2018, 4:59pm UTC](https://discourse.processing.org/t/load-a-mlt-and-obj/5222/3 "2018-11-08T16:59:08Z")

</div>

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 😕

Do you know witch software i have to use?

thank you very much

V.

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [November 9, 2018, 1:10am UTC](https://discourse.processing.org/t/load-a-mlt-and-obj/5222/4 "2018-11-09T01:10:03Z")

</div>

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

- 
  - mtl file contains material (look) information.  
more how they look and what they can contain  
[Wavefront .obj file - Wikipedia](https://en.wikipedia.org/wiki/Wavefront_.obj_file)

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.

---

<div class="post-metadata">

**Author:** ![MarsatAE](https://avatars.discourse-cdn.com/v4/letter/m/85e7bf/32.png) [@MarsatAE](https://discourse.processing.org/u/MarsatAE)\
**Post date:** [November 9, 2018, 1:35pm UTC](https://discourse.processing.org/t/load-a-mlt-and-obj/5222/5 "2018-11-09T13:35:27Z")

</div>

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 😕

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [November 9, 2018, 1:50pm UTC](https://discourse.processing.org/t/load-a-mlt-and-obj/5222/6 "2018-11-09T13:50:36Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![MarsatAE](https://avatars.discourse-cdn.com/v4/letter/m/85e7bf/32.png) [@MarsatAE](https://discourse.processing.org/u/MarsatAE)\
**Post date:** [November 19, 2018, 10:15am UTC](https://discourse.processing.org/t/load-a-mlt-and-obj/5222/7 "2018-11-19T10:15:40Z")

</div>

Sorry; i’m a little bit late.

Well here is the program :  
[https://wetransfer.com/downloads/abac648bc63cfb8c7fb5a77a513c963b20181119101327/55ff8d](https://wetransfer.com/downloads/abac648bc63cfb8c7fb5a77a513c963b20181119101327/55ff8d)

Can you tell me what is the problem?

thannk you very much.

V.

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [November 19, 2018, 10:44am UTC](https://discourse.processing.org/t/load-a-mlt-and-obj/5222/8 "2018-11-19T10:44:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![hamoid](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/hamoid/32/58_2.png) [@hamoid](https://discourse.processing.org/u/hamoid)\
**Post date:** [November 19, 2018, 2:11pm UTC](https://discourse.processing.org/t/load-a-mlt-and-obj/5222/9 "2018-11-19T14:11:12Z")

</div>

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 🙂 I looked at [http://paulbourke.net/dataformats/mtl/](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.

---

<div class="post-metadata">

**Author:** ![MarsatAE](https://avatars.discourse-cdn.com/v4/letter/m/85e7bf/32.png) [@MarsatAE](https://discourse.processing.org/u/MarsatAE)\
**Post date:** [November 29, 2018, 9:57am UTC](https://discourse.processing.org/t/load-a-mlt-and-obj/5222/10 "2018-11-29T09:57:46Z")

</div>

Thank you very much, it’s finally working 🙂

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

---

<div class="post-metadata">

**Author:** ![ProcessingOrg](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/processingorg/32/18341_2.png) [@ProcessingOrg](https://discourse.processing.org/u/ProcessingOrg)\
**Post date:** [April 22, 2025, 2:02pm UTC](https://discourse.processing.org/t/load-a-mlt-and-obj/5222/11 "2025-04-22T14:02:23Z")

</div>

13 posts were split to a new topic: [OBJ: Disabling MTL and Applying Custom Colors](https://discourse.processing.org/t/obj-disabling-mtl-and-applying-custom-colors/46265)

---

<div class="post-metadata">

**Author:** ![ProcessingOrg](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/processingorg/32/18341_2.png) [@ProcessingOrg](https://discourse.processing.org/u/ProcessingOrg)\
**Post date:** [April 22, 2025, 2:06pm UTC](https://discourse.processing.org/t/load-a-mlt-and-obj/5222/12 "2025-04-22T14:06:54Z")

</div>


