Gazebo | Ignition | Community
Ask Your Question
0

Can Textures be added to simple objects from my own source?

asked 2013-02-22 15:27:16 -0500

techy gravatar image

If I build a simple object such as a cylinder or a box I can add texture from the gazebo.material file e.g.:

     <script>
        <uri>file://media/materials/scripts/gazebo.material</uri>
        <name>Gazebo/CeilingTiled</name>
      </script>

And this is matched with the block from the gazebo.material file:

material Gazebo/CeilingTiled { receive_shadows on

technique { pass { ambient 0.5 0.5 0.5 1.000000

  texture_unit
  {
    texture ceiling_tiled.jpg
  }
}

} }

... and then I can get a nice textured and properly lit object in Gazebo.

But this seems to be limited to just the materials in this particular file - about 20 of them. How can I specify my own .material file to map my own texture onto the object model?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
3

answered 2013-02-22 21:00:58 -0500

ThomasK gravatar image

updated 2013-02-22 21:04:57 -0500

So there's two ways (that I know of) that you can do this:

  • Within the model directory: create a materials/scripts and materials/textures directory in the directory of the corresponding model and put the texture into materials/textures and the corresponding *.material into materials/scripts ... have a look at your very own brick_box_3x1x3 for example. ;)

  • If you want to specify materials that can be used by multiple models you can create a folder "media" that, again, contains "materials/scripts" and "materials/textures" as sub-directories and then add the directory that your "media" directory is part of to your GAZEBO_RESOURCE_PATH. So for example with the default setup you have a "/usr/local/share/gazebo-1.4/media" directory (compiled from source, debian package installation would be in /usr/share/...) and "/usr/local/share/gazebo-1.4" is in the GAZEBO_RESOURCE_PATH. To add your own materials you simply create a "<my_package>/media/materials/" directory with the desired scripts and textures and add "<my_package>" to the GAZEBO_RESOURCE_PATH.

edit flag offensive delete link more
0

answered 2013-02-25 09:43:18 -0500

techy gravatar image

Thanks Thomas, that's perfect. maurice

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2013-02-22 15:27:16 -0500

Seen: 7,998 times

Last updated: Feb 25 '13