Activating shading for a .stl based environment in gazebo
I built a simple rolling landscape terrain using the sculpt tool in Blender and exported this as STL. Using the terrain in a launch file works ok, but I can't figure out how to activate proper shading so visualization looks nice. I tried many of the available gazebo materials (PR2/Grey1, Gazebo/PioneerBody, Gazebo/White, Gazebo/GrassFloor) but all those resulted in a monochromatic landscape.
The relevant parts of the .world file are:
<rendering:ogre>
<ambient>0.5 0.5 0.5 0.5</ambient>
<sky>
<material>Gazebo/CloudySky</material>
</sky>
<grid>false</grid>
<maxUpdateRate>10.</maxUpdateRate>
<!--<shadowTechnique>none</shadowTechnique>-->
<shadows>true</shadows>
</rendering:ogre>
<model:physical name="landscape">
<xyz>0 0 0</xyz>
<rpy>0 0 0</rpy>
<static>true</static>
<body:trimesh name="landscape_body">
<geom:trimesh name="landscape_geom">
<scale>1.0 1.0 1.0</scale>
<mesh>rolling_landscape_120m.stl</mesh>
<visual>
<scale>1.0 1.0 1.0</scale>
<mesh>rolling_landscape_120m.stl</mesh>
<genTexCoord>true</genTexCoord>
<material>Gazebo/GrassFloor</material>
</visual>
</geom:trimesh>
</body:trimesh>
</model:physical>
Screenshot (using PR2/Grey1 material, Gazebo/GrassFloor looks the same, only green)
The monochromatic visualization obviously makes judging distances of terrain features impossible. Shadows for the quadrotor UAV work (but shading apparently does not work).
The .stl, world and launch file are also available in the hector_gazebo_worlds package and can be started using
roslaunch hector_gazebo_worlds rolling_landscape_120m.launch
/edit: So I found out that terrain as well as quadrotor do not receive illumination at all, but if I spawn spheres or other objects via the gazebo toolbar, those receive proper illumination.
Update: I tried playing around with materials and found that there is a difference like night and day (literally ;) ) between built-in primitives and mesh files.
Consider this extract from a URDF file:
<link name="base_link">
<inertial>
<mass value="1.316" />
<origin xyz="0 0 0" />
<inertia ixx="0.0128" ixy="0.0" ixz="0.0"
iyy="0.0128" iyz="0.0"
izz="0.0218" />
</inertial>
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<cylinder radius="0.4" length="0.2"/>
</geometry>
<material name="DarkGrey" >
<color rgba="0.3 0.3 0.3 1"/>
</material>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://hector_quadrotor_urdf/meshes/quadrotor/quadrotor_base.stl"/>
</geometry>
</c![image description](http://img842.imageshack.us/img842/6112/gazebodisk.png)ollision>
</link>
<gazebo reference="base_link">
<material>Gazebo/White</material>
<turnGravityOff>false</turnGravityOff>
</gazebo>
Looks like this in gazebo:
The cylinder apparently receives correct illumination.
If I now use the following line instead of the cylinder (everything else stays the same, most notably the material!)
<mesh filename="package://hector_quadrotor_urdf/meshes/quadrotor/quadrotor_base.stl"/>
the same scene looks like this:
Can someone explain this? The mesh looks perfectly fine in Blender, Meshlab etc., so I doubt the normals are wrong. It seems very wrong that materials show such differences between being used for built-in primitives and external meshes.