Rosanswers logo

I have a COLLADA (.dae) file that I have exported from blender. Its just a cube that has been shaded green.

However, whenever I try to get rviz to display this mesh (using a Marker display) all I get is a white cube.

I have set the marker colours to RGBA = {0, 0, 0, 0} in the message. I have set /mesh_use_embedded_materials to true. I read somewhere that if there is an ambient colour in the mesh file with one of its components set to 0 that rviz wont render it properly, I checked that and there were no zeros.

This link has the mesh file and screenshots from blender and rviz.

Can someone tell me how to get rviz to render my mesh using the coulours specified in the mesh file?

I am using the lastest version of Blender (2.72, downloaded just the other day). I am running Ubuntu 14.04 and ROS Indigo 1.11.9


Originally posted by Bidski on ROS Answers with karma: 96 on 2014-12-03

Post score: 2


1 Answer 1


Rosanswers logo

Blender export materials with a null ambient lightning, this is probably why your meshes don't look like expected.


I do not know what to change in the Blender material to set the ambient so I manually edit the exported dae files; Replace

  <color sid="ambient">0 0 0 1</color>


  <color sid="ambient">0.1 0.1 0.1 1</color>

Python script

Here is a script that copies the diffuse color to the ambient color, first edit a new script file (this is for Nemo, not Nautilus):

gedit ~/.local/share/nemo/scripts/RViz\ collada

Use the following script:


# Check if xml-twig-tools is installed
pkg_ok=$(dpkg-query -W --showformat='${Status}\n' xml-twig-tools|grep "install ok installed")
if [ "" == "$pkg_ok" ]; then
    notify-send "Missing package" -t 1 "Please install xml-twig-tools"
    exit 0


# Reads Nautilus / nemo arguments to detect which file have to processed
# Processes only selected files with .dae extension (case insensitive)
for file in $(find ${NEMO_SCRIPT_SELECTED_FILE_PATHS} -iname '*.dae'); do
    # Fetches all "diffuse" properties from materials accross the file into a single string
    diffuse_properties=`xml_grep 'diffuse' $file --text_only`

    # Splits diffuse_properties string into an array of strings
    readarray -t properties_array <<<"$diffuse_properties"

    # Replaces only the first occurence in the file each time
    for element in "${properties_array[@]}"
        sed -i "0,/ambient\">0\ 0\ 0\ 1/s//ambient\">$element/" $file


# Notify user
notify-send "RViz collada" -t 1 "$count files tweaked"
exit 0

Make the script executable:

chmod +x ~/.local/share/nemo/scripts/*

Originally posted by VictorLamoine with karma: 1505 on 2015-02-06

This answer was ACCEPTED on the original site

Post score: 2

Original comments

Comment by gvdhoorn on 2015-02-06:
See also rviz/issues/836.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.