Robotics StackExchange | Archived questions

Texture only showing as one color

Hello,

I was following the tutorial on colors and texutres http://gazebosim.org/tutorials?tut=color_model.

I am using the Ogre Material Scripts, which btw appears to work with stl files too, and there is no error that the texture cannot be loaded or what so ever. The object appears in the color sceme of the texture but thats it. Color information looks binary. I have tested different textures.

image description

The png used as a texture looks like this:

image description

When I use a grass file the object looks green.

Thats the model.sdf file:

<?xml version="1.0" ?>
<sdf version="1.5">
    <model name="BOX">

      <static>true</static>

      <link name="box_link">
        <visual name="visual">
          <meta>
            <layer>1</layer>
          </meta>
          <geometry>    
            <mesh><uri>model://BOX/materials/meshes/box.dae</uri></mesh>
          </geometry>
          <material>
            <script>
              <name>Sand/Diffuse</name>
              <uri>model://BOX/materials/scripts/gas_station.material</uri>                          
            </script>
                        <script>
              <name>Sand/Normal</name>
              <uri>model://BOX/materials/scripts/gas_station.material</uri>                          
            </script>
          </material>
        </visual>
        <collision name="collision">
          <geometry>
            <mesh><uri>model://BOX/materials/meshes/box.dae</uri></mesh>
          </geometry>
        </collision>
      </link>

    </model>
</sdf>

This is the sand.material file in the scripts folder:

material Sand/Diffuse
{
  receive_shadows off
  technique
  {
    pass
    {
      texture_unit
      {
        texture ../textures/sand.png
        scale 1 1 1 1 1 1
      }
    }
  }
}

material Sand/Specular
{
  receive_shadows off
  technique
  {
    pass
    {
      texture_unit
      {
        texture ../textures/sand.png
      }
    }
  }
}

material Sand/Normal
{
  receive_shadows off
  technique
  {
    pass
    {
      texture_unit
      {
        texture ../textures/sand.png
      }
    }
  }
}

Basically I have used the gas_station model as a template for the scripts file. Do I need serveral pngs for Normal, Specular etc. or is one script applying the texture sufficient?

I have tried different scaling factors without any visible effect. Can anybody see the mistake I am making?

Is more information required?

BR

Asked by Eisenhorn on 2019-02-20 06:30:28 UTC

Comments

Did you manage to solve this? If yes, how? I am currently having the same problem.

Asked by fmeccanici on 2020-06-02 09:06:50 UTC

I also have the same issue using material scripts with STL files in Gazebo 9

Asked by nathan5802 on 2020-06-08 15:27:06 UTC

I am also having this same issue? Has anyone managed to figure this out yet?

Asked by kumarhans on 2020-12-21 23:59:40 UTC

Are you using the same texture for normal maps and diffuse? It might be a problem. And one mistake I can find in your material script is that the code of scale 1 1 1 1 1 1

It think general format must be something like scale <uscale> <vscale> For more information try to look at https://wiki.ogre3d.org/Materials

Asked by Shravista Kashyap on 2021-06-01 11:23:30 UTC

Answers