Skip to content

Fix #1120 Visualization markers ignore color and show everything as white - #1388

Closed
xbroquere wants to merge 3 commits into
ros-visualization:melodic-develfrom
xbroquere:melodic-devel
Closed

xbroquere wants to merge 3 commits into
ros-visualization:melodic-develfrom
xbroquere:melodic-devel

Conversation

@xbroquere

Copy link
Copy Markdown

Description

Fix #1120 Visualization markers ignore color and show everything as white using #752 as base patch

Checklist

  • Rendering issues:

    • Attached broken rendering image: issue

    • Attached fixed rendering image: mesh_marker_fixed

  • Source code snippet for three cases:

// display marker not using mesh material in transparent blue
marker.color.r = 0;
marker.color.g = 0;
marker.color.b = 1;
marker.color.a = 0.3;
marker.scale.x = 1;
marker.scale.y = 1;
marker.scale.z = 1;
marker.type = visualization_msgs::Marker::MESH_RESOURCE;
marker.mesh_resource = "package://my_pkg/moonwalk.dae";
marker.mesh_use_embedded_materials=false;

// display marker using mesh material and tinted with transparent green
marker.scale.x = 1;
marker.scale.y = 1;
marker.scale.z = 1;
marker.color.r = 0;
marker.color.g = 1;
marker.color.b = 0;
marker.color.a = 0.5f;
marker.type = visualization_msgs::Marker::MESH_RESOURCE;
marker.mesh_resource = "package://my_pkg/moonwalk.dae";
marker.mesh_use_embedded_materials=true;

// display marker using mesh material and not tinted
marker.scale.x = 1;
marker.scale.y = 1;
marker.scale.z = 1;
marker.color.r = 0;
marker.color.g = 0;
marker.color.b = 0;
marker.color.a = 0;
marker.type = visualization_msgs::Marker::MESH_RESOURCE;
marker.mesh_resource = "package://my_pkg/moonwalk.dae";
marker.mesh_use_embedded_materials=true;

…w everything as white

Re-integrate patch from ros-visualization#752 Color tinting for mesh markers

Signed-off-by: Xavier BROQUERE <[email protected]>
@rhaschke

Copy link
Copy Markdown
Contributor

#752 should already part of the source history. Did you have a look into #893 as well, which seems to revert the first one?

@xbroquere

xbroquere commented Jul 22, 2019 •

Copy link
Copy Markdown
Author

Hi Robert,

Thanks for pointing me #893. Seems that this issue has a long story :)

With rviz melodic release, only external image textures (like PR2 base) are displayed. When materials are fully defined inside collada file, the mesh is white.

I also used garaemon/rviz_collada_marker for my tests and added moonwalk marker (that is not using external image files for materials). https://github.com/xbroquer/rviz_collada_marker

The result of rviz melodic release (arrow and moonwalk are white):
Screenshot from 2019-07-22 11-09-00

When mesh_use_embedded_materials=True, color is not dynamically updated

Here is the result with my latest commit:
Screenshot from 2019-07-22 11-08-41

Here the 2 videos that shows the dynamic color update:
rviz-melodic-collada-test.zip

However, as you can see, the usage of passes changes the behavior when mesh_use_embedded_materials=True and a color is set.
The material from the mesh cannot be transparent. If we want the marker transparent we have to set mesh_use_embedded_materials=False (third marker).

Do you think this behavior change is acceptable ?

If not, I pushed another solution that does not use passes:
melodic-devel...xbroquer:drx-collada-mesh2

Screenshot from 2019-07-22 14-15-57

@rhaschke

rhaschke commented Sep 9, 2019

Copy link
Copy Markdown
Contributor

I don't think that adding a second pass is the right solution to the problem: It essentially just redraws the mesh with the user-defined color. As you see from the comparison, this doesn't allow to change the transparency of the mesh.
Another option is to use alpha from the user-defined color for both passes, and use the second pass to tint the mesh with the user-defined color as suggested in this PR. However, this will also modify the result for texture-colored meshes.
I think, we need to modify the color "towards" the user-defined one in first place. A single pass will suffice then for drawing. One option is to multiply with the user-defined color.

multiply current rviz pull request
mesh-multiply mesh-original mesh-pr

@rhaschke

rhaschke commented Sep 9, 2019

Copy link
Copy Markdown
Contributor

Closing in favor of #1424. @xbroquer, could you please review the new PR?

@rhaschke rhaschke closed this Sep 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Visualization markers ignore color and show everything as white

2 participants