0
$\begingroup$

Rosanswers logo

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


Originally posted by m4nh on ROS Answers with karma: 26 on 2016-10-28

Post score: 0


Original comments

Comment by William on 2016-10-28:
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.

Comment by m4nh on 2016-10-29:
Yes! It looks like flat from every vantage point. Reversing order of triangle makes all mesh go away.

Comment by gvdhoorn on 2016-10-29:
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?

Comment by m4nh on 2016-10-29:
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?

Comment by gvdhoorn on 2016-10-29:
If RViz is set to use world as the Fixed Frame, then things should be ok. Make sure RViz doesn't complain about anything.

Comment by OzzieTheHead on 2021-08-11:
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

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by m4nh with karma: 26 on 2016-10-29

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by gvdhoorn on 2016-10-29:
hm. Is that as this is/was intended @William?

Comment by William on 2016-10-29:
I don't know. So you're saying the per color vertex is broken?

Comment by m4nh on 2016-10-29:
the result of "per color vertex" method is the one shown in the attached figure

Comment by gvdhoorn on 2016-10-30:
Could you perhaps add a MWE to your question, or make one available on github? That would make reproducing this a lot easier.

Comment by m4nh on 2016-10-30:
@gvdhoorn this is the example node: https://dl.dropboxusercontent.com/u/18830822/triangles_bug.cpp there is an external parameter per_vertex_color (bool) to activate/deactivate the malfunctioning.

$\endgroup$

Your Answer

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