Gazebo | Ignition | Community
Ask Your Question

imported mesh (.dae) with texture too dark in gazebo

asked 2015-04-14 10:04:46 -0500

edith gravatar image


I acquired a point cloud with the kinect and generated a mesh with texture in meshlab leading to a dae-file and a png.

First, the object was completely black in gazebo. I changed the ambient value from 0 0 0 1 to 1 1 1 1. Now, I can see the texture but it is still darker than it should be.

Visualizing the object with rviz it looks as I would expect (it is a little darker if i set the ambient value to 0 0 0, but still fine).

This is how it looks like in rviz: rviz

and here with gazebo: gazebo

Is this a normal behavior?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2020-01-08 21:00:50 -0500

wongrufus gravatar image

updated 2020-01-08 21:08:30 -0500

Open your .dae file in a text editor and search for the location where the texture file is specified (e.g. tex.png)

The surrounding lines should look something like the following

    <image id="tex_png" name="tex_png">
    <effect id="tex_png-effect">
        <newparam sid="tex_png-surface">
          <surface type="2D">
        <newparam sid="tex_png-sampler">
        <technique sid="common">

              <color sid="emission">0.2 0.2 0.2 1</color>
              <color sid="ambient">0.9 0.9 0.9 1</color>
              <color sid="specular">0.5 0.5 0.5 1</color>
              <float sid="shininess">50</float>
              <float sid="index_of_refraction">1</float>

              <texture texture="tex_png-sampler" texcoord="tex_png"/>

Make sure the <ambient> tag within the <phong> tags exist (since it seems gazebo defaults the ambient value to be some low value).

All the others are optional and can be tweaked to your own content. The values above were taken from the box_target_green example in the gazebo models repo and seems to work good enough.

If someone knows how to set these settings from blender, do enlighten us

PS:: Please enable the use of ``` for quoting code similar to stack overflow...

edit flag offensive delete link more

answered 2015-04-14 13:14:06 -0500

nkoenig gravatar image

Shading in gazebo depends on:

  1. Material properties of the object being rendered. This is found in your dae file, and possibly in your SDF file.
  2. Lighting properties, which includes ambient light and any lights
  3. Normals of the object being rendered.

Try to visualize the normals of you mesh in blender, and possibly recalculate the normals in blender to see if the problem is fixed.

edit flag offensive delete link more

Question Tools


Asked: 2015-04-14 10:04:46 -0500

Seen: 5,291 times

Last updated: Jan 08 '20