# Revision history [back]

### How do I get my OBJ mesh material to look right?

I have a "rock" object in an OBJ file that has many triangular faces, and has an accompanying MTL file with different shades of gray for the Ka, Kd, and Ks:

newmtl RockCol
Ka 0.1 0.1 0.1
Kd 0.4 0.4 0.4
Ks 0.7 0.7 0.7
Ns 300
Ni 1.0
d 1.0
illum 0


In Paint 3D, for example, it looks like this:

In Gazebo (11.10.2), I've tried a bunch of different things to get it to display the faces/colors correctly, but no matter what I try, the rock always displays as one solid color, so you can't tell it has multiple faces (default gray box is included for reference):

It does change color when the angle changes, as if it knows there are other shades of gray associated with ambient/diffuse/specular, but at any given angle, it's a solid color--here it is looking slightly lighter gray when turned:

Some things I've tried:

Referencing the .mtl file directly:

<visual name='visual'>
<pose>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<uri>/home/MyName/Documents/ObjectFiles/rock_x2y3_1.obj</uri>
<scale>1 1 1</scale>
</mesh>
</geometry>
<material>
<lighting>1</lighting>
<script>
<uri>file:/home/MyName/Documents/ObjectFiles/RockColor.mtl</uri>
<name>RockGray</name>
</script>
</material>
<transparency>0</transparency>
</visual>


Putting nothing in <material></material> and hoping it finds the .mtl file as referenced in the .obj file (keeping the rest of the <visual></visual> section the same as above).

Referencing the same script that is used for the default box:

  <material>
<lighting>1</lighting>
<script>
<uri>file://media/materials/scripts/gazebo.material</uri>
<name>Gazebo/Grey</name>
</script>
</material>


Specifying the colors in the sdf:

  <material>
<lighting>1</lighting>
<script>
<uri>file://media/materials/scripts/gazebo.material</uri>
<name>Gazebo/Grey</name>
</script>

I'm new to this, and at this point am just stabbing in the dark. Maybe the problem isn't the material section, but something else entirely. Maybe it's just one line in the <visual> section that I've ignored and needs changing. Maybe what I'm trying to do just can't be done with OBJ meshes, or in Gazebo 11. I haven't found a lot of info on all the options of how to set up the appearance of things from OBJ files, so any pointers for things to try would be welcome. Thanks!