# Show obj with mtl

**URL:** https://discourse.paraview.org/t/show-obj-with-mtl/2932
**Category:** ParaView Support
**Created:** [November 8, 2019, 9:28am UTC](https://discourse.paraview.org/t/show-obj-with-mtl/2932 "2019-11-08T09:28:36Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![gilcu2](https://discourse.paraview.org/user_avatar/discourse.paraview.org/gilcu2/32/2183_2.png) [@gilcu2](https://discourse.paraview.org/u/gilcu2)
#### Post date: [November 8, 2019, 9:28am UTC](https://discourse.paraview.org/t/show-obj-with-mtl/2932/1 "2019-11-08T09:28:36Z")

</div>

Hi, there is a direct way to show obj files file using the information in the associated mtl files. I have read about transforming the data to vtks and save in state files but is a problematic to process large files in parallel.  
Ospray can manage the obj and mtl files directly. Why paraview can not?  
Thanks  
Reynaldo

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [November 8, 2019, 9:34am UTC](https://discourse.paraview.org/t/show-obj-with-mtl/2932/2 "2019-11-08T09:34:18Z")

</div>

You can just open the .obj file and load the .png as textures for the object.

---

<div class="post-metadata">

### Author: ![gilcu2](https://discourse.paraview.org/user_avatar/discourse.paraview.org/gilcu2/32/2183_2.png) [@gilcu2](https://discourse.paraview.org/u/gilcu2)
#### Post date: [November 8, 2019, 9:45am UTC](https://discourse.paraview.org/t/show-obj-with-mtl/2932/3 "2019-11-08T09:45:17Z")

</div>

It is not about png. For example, I have the attached geometries4.obj file associated with geometries.mtl. What is the way to show the plane using Yellow material and the box using IndianRed with all its color, texture, and reflection maps.[geometries4.obj](https://discourse.paraview.org/uploads/short-url/tR8glFkMfeBiJBivZqg0b1Szd47.obj) (8.5 KB) [geometries.mtl](https://discourse.paraview.org/uploads/short-url/fSIzurrdYAKcKMkBMB8B4cPdSxE.mtl) (13.1 KB)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [November 8, 2019, 10:02am UTC](https://discourse.paraview.org/t/show-obj-with-mtl/2932/4 "2019-11-08T10:02:40Z")

</div>

Indeed, not supported by ParaView.

@Michael

---

<div class="post-metadata">

### Author: ![jourdain](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jourdain/32/11_2.png) [@jourdain](https://discourse.paraview.org/u/jourdain)
#### Post date: [November 8, 2019, 5:27pm UTC](https://discourse.paraview.org/t/show-obj-with-mtl/2932/5 "2019-11-08T17:27:28Z")

</div>

Some improvements have been made in the scripts for ParaView that are available inside vtkjs.

We have a path that use this [Python file](https://github.com/Kitware/vtk-js/blob/master/Utilities/ParaView/apply-materials.py) to load the geometry and apply the representation settings without dealing with the state file.

Also the convert script should produce less geometry files when their material definition remain consistent.

---

<div class="post-metadata">

### Author: ![gilcu2](https://discourse.paraview.org/user_avatar/discourse.paraview.org/gilcu2/32/2183_2.png) [@gilcu2](https://discourse.paraview.org/u/gilcu2)
#### Post date: [November 11, 2019, 8:07am UTC](https://discourse.paraview.org/t/show-obj-with-mtl/2932/6 "2019-11-11T08:07:14Z")

</div>

Hi, thanks. This script have a function that process a json file. What I have is an obj and an mtl files. How to do?  
Thanks  
Reynaldo

---

<div class="post-metadata">

### Author: ![jourdain](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jourdain/32/11_2.png) [@jourdain](https://discourse.paraview.org/u/jourdain)
#### Post date: [November 11, 2019, 2:38pm UTC](https://discourse.paraview.org/t/show-obj-with-mtl/2932/7 "2019-11-11T14:38:51Z")

</div>

You need to run [that one](https://github.com/Kitware/vtk-js/blob/master/Utilities/ParaView/obj-mtl-importer.py) first.

---

<div class="post-metadata">

### Author: ![gilcu2](https://discourse.paraview.org/user_avatar/discourse.paraview.org/gilcu2/32/2183_2.png) [@gilcu2](https://discourse.paraview.org/u/gilcu2)
#### Post date: [November 13, 2019, 8:38am UTC](https://discourse.paraview.org/t/show-obj-with-mtl/2932/8 "2019-11-13T08:38:51Z")

</div>

Hi, thanks. I see how it works. The problem is that I need to process several large obj, mtl files in parallel in the server. This scripts run in the client. have you some solution for this case?  
Thanks  
Reynaldo

---

<div class="post-metadata">

### Author: ![jourdain](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jourdain/32/11_2.png) [@jourdain](https://discourse.paraview.org/u/jourdain)
#### Post date: [November 13, 2019, 4:34pm UTC](https://discourse.paraview.org/t/show-obj-with-mtl/2932/9 "2019-11-13T16:34:40Z")

</div>

Unfortunately, I don’t.

---

<div class="post-metadata">

### Author: ![wsherman](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/w/8797f3/32.png) [@wsherman](https://discourse.paraview.org/u/wsherman)
#### Post date: [December 5, 2019, 10:40pm UTC](https://discourse.paraview.org/t/show-obj-with-mtl/2932/10 "2019-12-05T22:40:39Z")

</div>

Sabastien,

A followup question from not the OP. So I’ve used the “obj-mtl-importer.py” script with “pvpython”, and that did generate a folder with a handful of .vtp files, along with the “representations.json” file. I wasn’t able to get the .pvsm to successfully load as a state file, and I don’t see where the “representations.json” file is referenced in .pvsm, but that’s neither here nor there for my current question.

My current question then is how do I make use of this “apply-materials.py” script? The comments at the top are not clear to me. First question is: is it a “Programmable Source”, or a “Programmable Filter”. And next question is: how do I specify the folder or the .vtp files along with the .json file?

```
Thanks,
Bill
```

---

<div class="post-metadata">

### Author: ![gilcu2](https://discourse.paraview.org/user_avatar/discourse.paraview.org/gilcu2/32/2183_2.png) [@gilcu2](https://discourse.paraview.org/u/gilcu2)
#### Post date: [December 6, 2019, 7:06am UTC](https://discourse.paraview.org/t/show-obj-with-mtl/2932/11 "2019-12-06T07:06:41Z")

</div>

Hi, I have been struggling with the obj mtl problem for some months. I have two results:

- Use the obj-mtl-importer in an script that load the files, apply the materials through mapping the color, transparency, etc and create an output image. It has the problem that can not be used in Paraview app directly (Only pvpython and pvbatch) and can not executed in parallel
- Use the steps in [Paraview Ospray different results with materials](https://discourse.paraview.org/t/paraview-ospray-different-results-with-materials/3116). In theorie it should work in Paraview but right now the color are different. Only applicable to Ospray backend.

---

<div class="post-metadata">

### Author: ![jourdain](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jourdain/32/11_2.png) [@jourdain](https://discourse.paraview.org/u/jourdain)
#### Post date: [December 9, 2019, 10:07am UTC](https://discourse.paraview.org/t/show-obj-with-mtl/2932/12 "2019-12-09T10:07:50Z")

</div>

```auto
loadFiles('/path/to/the/root/directory/of/the/export')
applyMaterials()

```
