Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maintain original mesh materials for RobotLinks #1704

Merged

Conversation

AndreasR30
Copy link
Contributor

@AndreasR30 AndreasR30 commented Jan 30, 2022

Currently, rviz modifies a custom material setting loaded together with a mesh model, e.g. within updateAlpha().
This destroys, for example, transparency within those original materials.

With this pull request, the original material is stored additionally to the active one, such that the original one can be restored if needed. This allows to correctly render e.g. glass:

old new
Screenshot from 2022-01-30 17-26-22 Screenshot from 2022-01-30 17-15-24

Previously all materials are set opaque when alpha option is set to 1. With this commit the materials are set to their original state when alpha is set to 1.
Copy link
Contributor

@rhaschke rhaschke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The resulting screenshots are convincing. But I don't yet understand what's happening.
Also, I noticed that the car is partially translucent, uncovering the underlying grid...

src/rviz/robot/robot_link.cpp Outdated Show resolved Hide resolved
@AndreasR30
Copy link
Contributor Author

Also, I noticed that the car is partially translucent, uncovering the underlying grid...

I do not understand what you mean here. Maybe it is a bit confusing that the wheels of the car are below zero level, while the vertices of the roof have a positive z value. So the grid cuts the car into two halves.

@rhaschke
Copy link
Contributor

So the grid cuts the car into two halves.

Ah. That explains it. Thanks.

@rhaschke
Copy link
Contributor

rhaschke commented Feb 4, 2022

Could you send me a simple urdf example illustrating the problem? Thanks.

@AndreasR30
Copy link
Contributor Author

Here you go. Please don't forget to source package. Otherwise Rviz/Ogre won't find included materials. Execute *.launch file:
roslaunch robot_model_glass_test robot.launch

robot_model_glass_test.zip

@rhaschke rhaschke changed the title Add support for transparent materials in robot model Maintain original mesh materials for RobotLinks Mar 7, 2022
Copy link
Contributor

@rhaschke rhaschke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good in general. Thanks for the contribution.
I have added a few performance improvements, committed as a PR to your fork: UniBwTAS#2
Please test it on your side and merge the PR here.

@rhaschke rhaschke merged commit 69c7cf7 into ros-visualization:noetic-devel Mar 25, 2022
rhaschke added a commit that referenced this pull request May 27, 2022
rsinnet pushed a commit to MisoRobotics/rviz that referenced this pull request Jul 20, 2022
…1704)

rviz modifies a custom material (loaded together with a mesh model) within several functions, e.g. updateAlpha().
This destroys the original properties of this material, e.g. transparency.
To be able to restore the original material, we store it additionally to the active one.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants