Gazebo | Ignition | Community
Ask Your Question

using custom material for an object

asked 2013-03-09 08:14:06 -0600

prasanna.kumar gravatar image

I recently migrated to ROS fuerte from electric. I have an object (floor) in ROS electric for which I used the material Gazebo/LightWood. Now that Gazebo/LightWood material is no longer supported in ROS fuerte, how do I use LightWood texture for my object. I do not want my object to look plain in one colour (brown or sienna). I tried the following code but I got errors.

<visual name='floor_3_geom_visual' cast_shadows='1' laser_retro='0.000000' transparency='0.000000'>
          <origin pose='0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000'/>
            <box size='4.465000 4.000000 0.050000'/>

            <material> <texture filename="/home/angenuser/Desktop/hardwood_floor.jpg"/>



And also, in general could someone give me the code snippet on how to add custom image to an object using a .jpg file. Eg situation: I have a tele-conferencing robot and I would like to put up a static jpg image on its screen.

edit retag flag offensive close merge delete


Found the answer for the first part from here.

prasanna.kumar gravatar imageprasanna.kumar ( 2013-03-09 08:32:06 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-03-10 08:14:37 -0600

AndreiHaidu gravatar image

updated 2013-03-10 11:55:49 -0600


here is an example of how to use different textures:


For adding an image on a model you can create a new material script, something similar to:

material pancake/2sides
  receive_shadows on

      ambient 1 1 1 1.000000
      diffuse 1 1 1 1.000000
      specular 0.03 0.03 0.03 1.000000 
      emissive 0.900000 0.900000 0.900000 1.000000

        texture pancake-sides.jpg

Where texture pancake-sides.jpg is the line where you add the image.

Or another possibility you could create a collada file, and export it with the texture. And then add it to the model as a mesh. Here is a tutorial of how to load a mesh file.

Cheers, Andrei

edit flag offensive delete link more


Why do you use Gazebo/Wood for pancake? that is confusing

mehdi gravatar imagemehdi ( 2015-06-02 11:23:51 -0600 )edit

Wood is an example of a material that is already present in Gazebo, the second one is a custom material (created for pancakes)

AndreiHaidu gravatar imageAndreiHaidu ( 2015-06-03 02:31:09 -0600 )edit

So in that case it would be <name>Gazebo/pancake</name> or <name>pancake/2side<name>

mehdi gravatar imagemehdi ( 2015-06-03 06:10:49 -0600 )edit

Question Tools


Asked: 2013-03-09 08:14:06 -0600

Seen: 12,216 times

Last updated: Mar 10 '13