Modeling URDF files using Blender and exporting to COLLADA format
I'm currently trying to get a nicer looking robot model by adding color to the geometry of a robot body in blender (2.61) and exporting to .dae (COLLADA) instead of plain .stl mesh. My first try was to do this not by adding textures, but setting the material of different parts of the model to be colored differently. I'm talking about the model for a single link only, and everything works fine if exporting to stl (but there's no color then, obviously).
Now, if I add the colors and export to collada using blender I get the following:
- Reimport to Blender: Looks fine, exactly as exported
- Open with Meshlab: Parts of the geometry are scaled by a factor of ~30. Some vertex coordinates are very wrong.
- Open with g3viewer: The rotations between different parts of the model are off
- Use in URDF/gazebo: Model is not recognizable at all, there are a few polygon here and there
- Use in URDF/rviz: Geometry is fine, material seems be interpreted not quite correctly (too bright), but the color settings seem to work (a red part is a little bit red)
ROS version used is electric from .debs on Natty/64bit.
Any tips on how to improve the results are greatly appreciated.
/edit: Image of gazebo and rviz side by side (for gazebo on the left, the bounding box is on, which is based on the .stl mesh). Obviously, in gazebo only a small fraction of faces is visualized, while geometry in rviz is fine.
/edit2: The above was done by selecting all different needed parts of the model in Blender and then exporting to .dae. If I instead first join all different parts inside Blender by selecting them and pressing CTRL+J and then export, the model looks much better. It works in Meshlab and g3viewer, only gazebo still gives severe problems as can be seen here (even if it looks better than before):
This actually looks kind of similar to the Pelican model posted in this question.
/edit: Update with latest insights: So far it looks like Blender 2.61 Collada export is somewhat broken, at least for me on my 64 bit Natty system (I stated oneiric above before, was wrong due to working on too many different machines :) ).
/edit: As it turned out, this is related to gazebo not coping well with quad based polygons that get exported into COLLADA files by Blender 2.61. See my answer below for details.
By opening .stl or .dae generated from Blender and re-saving as .dae using meshlab one can also get get .dae files that look non-broken in gazebo. Unfortunately, the vertex materials defined in Blender seem to get lost in the process. Another example:
.dae exported from Blender: gazebo result
.dae by opening Blender export and resaving in meshlab: gazebo result
DimitriProsser confirmed that the Blender export does not work for versions > 2.49 here
/edit: Comparison: Blender 2.61 export, gazebo on the left, rviz ...
I reuploaded both, they should appear now.