How to get correct alpha blending in gazebo?

asked 2017-04-05 02:45:41 -0600

Tofle90 gravatar image

updated 2017-04-06 09:20:39 -0600

Hello everyone!

I'm facing some problems with alpha blending in gazebo. When loading an sdf model into gazebo, which uses a collada file, the alpha blending does not seem to work properly. I already tried to include an ogre material script in order to explicitely turn alpha blending on. The script is the following: https://ufile.io/5d6221 Nevertheless this is only partially helpful.

When semi-transparent objects appear in a scene, the blending still does not work correctly.
The following picture shows the result: https://ufile.io/a92141

Additionally it seems that other people also have/had similar issues, for instance see the following links:

1) https://bitbucket.org/osrf/gazebo/iss...

2) https://bitbucket.org/osrf/gazebo/iss...

I am using gazebo 7.6, which should solve the problem according to [1] (should be fixed from 7.4.0 on). Unfortunately, I'm still experiencing glitsches, which I guess are related to wrong entries in the z buffer of the renderer.

Have you also experienced behavior like this? Do you have any recomendations how to solve this problem? Is there a gazebo version, which can handle alpha blending correctly?

Thanks for your suggestions!

edit retag flag offensive close merge delete

Comments

Can you try gazebo8? There have been a few collada transparency fixes merged in gazebo8 recently: https://bitbucket.org/osrf/gazebo/pull-requests/?state=MERGED&query=transparency

iche033 gravatar imageiche033 ( 2017-04-06 12:07:03 -0600 )edit

Thanks for your reply. I tried gazebo8 as well, but the problem still remains for me. Because my frustration increases I'm sharing some other thought with you: As far as I understand, it is possible to define multiple "passes" in an ogre material script, which might solve the problem. Nevertheless gazebo does not seem to make use of multiple passes in the code, but instead only performs the first pass. Can someone confirm this? I'm thankful for any kind of advice!

Tofle90 gravatar imageTofle90 ( 2017-04-06 15:37:12 -0600 )edit

could you share the model and texture files here or post to gazebo issue tracker? I'll then try it out

iche033 gravatar imageiche033 ( 2017-04-07 18:16:31 -0600 )edit

I created a minimal example with a collada model I tried to load into gazebo: https://ufile.io/4cfa1. The model contains several trees and the ogre material script, which is referenced in the sdf file of the model sets alpha blending to enabled. Generally the blending works, but it seems that the objects are drawn in the wrong order, since trees in the back occlude trees in the front. Can you try to help me? The result I am getting is the following: https://ufile.io/9e8a91. I use gazebo 8.0.0.

Tofle90 gravatar imageTofle90 ( 2017-04-10 08:55:31 -0600 )edit

I tested it a little and saw the depth problem. The dae file is loaded as one big mesh into ogre and looks like self occlusion of a transparent object doesn't work well when depth write is off. I think as a workaround you'll probably need to break up the trees into individual meshes.

iche033 gravatar imageiche033 ( 2017-04-13 13:59:55 -0600 )edit