Migration support for models with material scripts

Hi all, we have an update that will help with migrating from Gazebo Classic to the new Gazebo!

Since the new Gazebo can be used with multiple rendering engines, it does not support Ogre specific material files like Gazebo Classic does. That means arbitrary materials defined within a <script> tag aren’t supported.

To ease migration of model files, we have developed capabilities to automatically parse plain solid colors. If your model file has a <uri> file://media/materials/scripts/gazebo.material </uri> or <name> used without a <uri> we match it with pre-defined materials in a gazebo.material file that’s shipped with gz-sim.


  • Any other installation or modification of the gazebo.material file will not work.
  • This is currently available in Harmonic.

This feature is limited to plain solid colors, other colors and materials would be rendered with a default <material> value.

In the future, we might be able to support textures and reading custom .material scripts provided by users.

See usage details in the migration guide and implementation in gz-sim PR #2269.

1 Like

Sounds great, thanks!

I remember that there was a big difference between the color presentation in Classic vs. Ignition (probably because of the default lights). The Ignition colors used to be much darker. Do you plan having a special treatment for this issue?

This is the code we used to get at least a bit similar colors:

subt/submitted_models/ctu_cras_norlab_absolem_sensor_config_1/urdf/utils.xacro at 083c6a8acb0c25aa1a35e34517e628cd3b52ae77 · osrf/subt · GitHub .

Also, why not parsing <material><color rgba=""/></material> ?

Hey @peci1, regarding your second comment, I tried an URDF <material><color rgba=""/></material> and sdformat already parses it to Gazebo understandable <material><ambient>...</material>. Is that what you intended to address?

The Ignition colors used to be much darker. Do you plan having a special treatment for this issue?

Some background info: Underneath the hood, ogre 1.x (classic) uses a different rendering algorithm from ogre 2.x, (default in new Gazebo) so it’s difficult to get the models to look the same when loading the same model SDF. At one point, we started tuning some default rendering params to make new Gazebo / Ignition match Gazebo-classic better to help with migration, e.g we tried to make models brighter in ogre2 by reducing the default metalness, etc. On the other hand, we risked producing results that are become more and more inconsistent with other PBR based 3D modeling tools or game engines.

So to answer the question, I think instead of internally tuning default rendering params to make the results consistent, it may be easier to have a special flag to indicate whether the values specified in SDF are from Gazebo-classic. If so, we can apply some multipliers (like you did) to the SDF values. This is not in the plan / roadmap yet though.

I’ve also had some luck with the workaround of setting the <intensity> value of the Sun light to ~1.5. This is a new SDF element so it will be ignored by Gazebo-classic, but it could help brighten up the scene and get a good match.

Yes, that was exactly my use case. So maybe it wasn’t supported in Dome for which we did our models, but got supported some time later…

So maybe it should get added to the migration guide, too?