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

Rviz Marker Triangle List: bad shader

asked 2016-10-28 06:52:59 -0600

m4nh gravatar image

updated 2016-10-29 04:33:44 -0600

gvdhoorn gravatar image

Why if i create a Mesh triangle-by-triangle by using visualization_msgs::Marker (type=TRIANGLE_LIST) the shader doesn't take into account normals ? Surface shader is not working. See attached image:

image description

edit retag flag offensive close merge delete


Does it look like that from all angles? Sometimes the order of the points will determine the normal face, i.e. clockwise will give you a normal in one direction and counterclockwise will give you a normal in the opposite direction.

William gravatar image William  ( 2016-10-28 14:45:41 -0600 )edit

Yes! It looks like flat from every vantage point. Reversing order of triangle makes all mesh go away.

m4nh gravatar image m4nh  ( 2016-10-29 04:02:34 -0600 )edit

RViz will not show any material / texture if there is no valid transform from whatever Fixed Frame is set to and the value you have set in the header.frame_id field. Could you include a snippet of how you setup your Marker msg? And describe the rest of your TF tree?

gvdhoorn gravatar image gvdhoorn  ( 2016-10-29 04:32:36 -0600 )edit

In this example is just a simple node with no TF tree behind. I just set frame_id as "world" and set "world" as base frame in Rviz.. so i think is an Identity transform... could this be the problem?

m4nh gravatar image m4nh  ( 2016-10-29 06:17:42 -0600 )edit

If RViz is set to use world as the Fixed Frame, then things should be ok. Make sure RViz doesn't complain about anything.

gvdhoorn gravatar image gvdhoorn  ( 2016-10-29 07:44:19 -0600 )edit

This looks like how a mesh shows up when it doesn't have any transforms. e.g. a RobotModel with no state publisher or tf publisher behind it

OzzieTheHead gravatar image OzzieTheHead  ( 2021-08-11 12:36:08 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-10-29 09:07:07 -0600

m4nh gravatar image

The issue is resolved by removing colors per each vertex! If you resize marker.colors array to the same size of marker.points array (and choose some color for each vertex) the color of rendered faces is forced to ignore light and shader. Leave colors array void and change only the marker.color parameter to paint your mesh.

edit flag offensive delete link more


hm. Is that as this is/was intended @William?

gvdhoorn gravatar image gvdhoorn  ( 2016-10-29 09:21:09 -0600 )edit

I don't know. So you're saying the per color vertex is broken?

William gravatar image William  ( 2016-10-29 15:01:03 -0600 )edit

the result of "per color vertex" method is the one shown in the attached figure

m4nh gravatar image m4nh  ( 2016-10-29 15:17:23 -0600 )edit

Could you perhaps add a MWE to your question, or make one available on github? That would make reproducing this a lot easier.

gvdhoorn gravatar image gvdhoorn  ( 2016-10-30 03:29:01 -0600 )edit

@gvdhoorn this is the example node: there is an external parameter per_vertex_color (bool) to activate/deactivate the malfunctioning.

m4nh gravatar image m4nh  ( 2016-10-30 08:35:47 -0600 )edit

Question Tools



Asked: 2016-10-28 06:52:59 -0600

Seen: 1,340 times

Last updated: Oct 29 '16