Home | Tutorials | Wiki | Issues
Ask Your Question
0

using custom material for an object

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

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'/>
          <geometry>
            <box size='4.465000 4.000000 0.050000'/>

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

          </geometry>

        </visual>

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

Comments

Found the answer for the first part from here.

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

1 Answer

Sort by ยป oldest newest most voted
2

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

AndreiHaidu gravatar image

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

Hi,

here is an example of how to use different textures:

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



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

material pancake/2sides
{
  receive_shadows on

  technique
  {
    pass
    {
      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_unit
      {
        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

Comments

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

mehdi gravatar imagemehdi ( 2015-06-02 11:23:51 -0500 )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 -0500 )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 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

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

Seen: 8,353 times

Last updated: Mar 10 '13