ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

how to display a mesh with texture in RViz?

asked 2011-03-05 11:01:03 -0600

blueskin gravatar image

Hello All, All am trying is loading an OBJ model from a file and display/visualize using RViz. Or consider I have a node that publishes a new mesh and corresponding texture data @30Hz. Is there a way to display this 3D mesh with texture in RViz? Thank you for any help.

Best, CV

edit retag flag offensive close merge delete

4 Answers

Sort by ยป oldest newest most voted

answered 2011-03-06 12:01:30 -0600

adasta gravatar image

updated 2011-03-06 12:11:28 -0600

It is possible to display an arbitrary mesh in Rviz, but you cannot currently display a OBJ mesh. Currently you can display a collada, stl, and Ogre mesh file. You display them using a marker message. You can find out more about displaying meshes with markers by looking at the Mesh Resource marker .

edit flag offensive delete link more

answered 2022-08-20 20:28:58 -0600

vonunwerth gravatar image

Based on the visualization_msgs markers of RViz I wrote a small package that makes it easy to load meshes into RViz as textured objects.

It simply loads all files which were put inside its meshes folder and publishes them to the visualization_marker topic. And even dynamically! When a new object is added to the folder, it appears (or is published) in RViz. If an object is deleted, it also disappears from the published models.

It also contains a launch file which just takes everything which is inside the meshes folder, opens up RViz with a suitable perspektive and visualizes the 3D files.

Just check it out here:

image description

edit flag offensive delete link more

answered 2022-04-02 15:07:10 -0600

You can display OBJ meshes now with the mesh resource on Marker messages. Here are the important bits

from visualization_msgs.msg import Marker

msg = Marker()
msg.mesh_resource = "package://my_package/path/to/my/mesh.obj"
msg.mesh_use_embedded_materials = True   # Need this to use textures for mesh

And then note you can still color the textured mesh by setting msg.color but you can set the RGBA values all to zero if you just want to display the texture. It works, but I find the lighting options unsatisfying: image description

edit flag offensive delete link more

answered 2012-10-26 06:35:28 -0600

Xpecttrum gravatar image

I have the same problem, I am using markers to display a mesh that comes form a .3ds file. The mesh is shown correctly, but without texture.

If I don't set the colors, it appears in black, if I set colors it appear the entire mesh in that color.

I know that the .3ds file carries the color information, is there anyway to show it properly in Rviz?


edit flag offensive delete link more

Question Tools



Asked: 2011-03-05 11:01:03 -0600

Seen: 10,048 times

Last updated: Aug 20 '22