Gazebo | Ignition | Community
Ask Your Question

Texture does not work properly

asked 2019-08-21 09:11:19 -0500

kumpakri gravatar image

I am trying to put a texture defined in PNG file to a custom made model in defined by OBJ file.

I have this folder structure with the model

├── materials
│   ├── scripts
│   │   └── model_name.material
│   └── textures
│       └── floor0.png
├── meshes
│   └── model_name.obj
├── model.config
└── model.sdf

this is the image floor0.png

image description

This is the model.sdf file content

<?xml version="1.0" ?>
<sdf version="1.6">
  <model name="model_name">
    <link name="link">
      <pose>0 0 0 0 0 0</pose>
      <collision name="collision">
                    <fdir1>0 0 0</fdir1>
      <visual name="visual">

this is the model_name.material file content

material Floor0
                texture ../textures/floor0.png
                scale 1.0 1.0

And this is the resulting view in Gazebo when I launch spawn this model

image description

It is only one color (the color in the bottom left corner of the PNG file). Couriously if I change the scale in the material file, the color might change to orange (the color in the middle of the PNG file) but the color stays homogeneous.

What is happening and how do I make the Gazebo render the texture correctly?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2019-08-21 11:43:34 -0500

chapulina gravatar image

The problem seems to be on the UV mapping of your OBJ file.

We usually use MTL files to set the material of OBJ meshes, see an example here. I would try to export an MTL file together with your OBJ from the modelling software you used.

edit flag offensive delete link more



Thank you! I had to make the UV map for my model inside Blender by hand following this tutorial and after that the textures applied to the model are showing correctly.

kumpakri gravatar imagekumpakri ( 2019-08-22 03:40:19 -0500 )edit

Question Tools



Asked: 2019-08-21 09:11:19 -0500

Seen: 1,180 times

Last updated: Aug 21 '19