-
Notifications
You must be signed in to change notification settings - Fork 0
Home
This page contains notes specific to building and running Ignition on macOS using the Metal render system.
In this step we build a version of Ignition that uses the Metal graphics API rather than OpenGL.
For the Qt application in ignition-gui to render a 3D scene using Metal, the MinimalScene plugin must have direct access to the rendered GPU texture. This requires a change to the Ogre::MetalTextureGPU
class in Ogre2 which has been merged into the main
branch of ogre-next, but has not yet been back-ported to ogre2.2. This patch makes the changes available in the osrf/homebrew-simulation
tap which is easier to use than manually building ogre-next from the github repo.
The patch is on this branch: https://github.com/srmainwaring/homebrew-simulation/tree/feature/ogre2.2-metal-texture-gpu and is applied using the following commands:
$ cd /usr/local/Homebrew/Library/Taps/osrf/homebrew-simulation
$ git remote add fork https://github.com/srmainwaring/homebrew-simulation
$ git fetch
$ git checkout fork/feature/ogre2.2-metal-texture-gpu
$ brew reinstall --build-from-source ogre2.2
-
Follow the Ignition Fortress instructions for a source installation on macOS up to the point just before Building the Ignition Libraries.
-
Get the Metal development branches
In the following we suppose that you have your Ignition source code in the folder ~/workspace/src
.
You need patches from the following branches:
- https://github.com/srmainwaring/ign-common/tree/feature/ign-common4-metal
- https://github.com/ignitionrobotics/ign-rendering/tree/main
- https://github.com/srmainwaring/ign-gui/tree/feature/ign-gui6-metal
- https://github.com/srmainwaring/ign-gazebo/tree/feature/ign-gazebo7-metal
These are applied as follows:
# Apply a fix to the Remotery profiling tool when using Metal
cd ~/workspace/src/ign-common
git add remote fork https://github.com/srmainwaring/ign-common
git checkout feature/ign-common4-metal
# Enable Ignition to use the Ogre2 Metal render system and add Metal shaders and examples
cd ~/workspace/src/ign-rendering
git checkout main
# Enable Ignition GUI (Qt applications) to use the Qt MetalRhi backend and the Ogre2 Metal render system
cd ~/workspace/src/ign-gui
git add remote fork https://github.com/srmainwaring/ign-gui
git checkout feature/ign-gui6-metal
# Enable Ignition Gazebo to use the Metal render system (GPU sensors will use Metal to render)
cd ~/workspace/src/ign-gazebo
git add remote fork https://github.com/srmainwaring/ign-gazebo
git checkout feature/ign-gazebo7-metal
- Confirm the source branches
Use colcon graph
to provide an overview of the library versions and dependencies:
% colcon graph
ignition-cmake2 + ***************
ignition-tools + * *. ...**
ignition-math6 + *****.*******
ignition-utils1 +* *..**.*..**
ignition-common4 + ** *******
ignition-msgs8 + * * .****
sdformat12 + * **
ignition-fuel_tools7 + *
ignition-plugin1 + ****.**
ignition-transport11 + *****
ignition-physics5 + *
ignition-rendering7 + ***.
ignition-tutorials +
ignition-gui6 + **
ignition-sensors6 +*
ignition-gazebo7 +
ignition-launch5 +
It's a good idea to check the branches being used for each Ignition library. These instructions use the following:
ign-cmake ign-cmake2
ign-common feature/ign-common4-metal
ign-fuel-tools ign-fuel-tools7
ign-gazebo feature/ign-gazebo7-metal
ign-gui feature/ign-gui6-metal
ign-launch ign-launch5
ign-math ign-math6
ign-msgs ign-msgs8
ign-physics ign-physics5
ign-plugin ign-plugin1
ign-rendering main
ign-sensors ign-sensors6
ign-tools ign-tools1
ign-transport ign-transport11
ign-utils ign-utils1
sdformat sdf12
which can be checked using
$ cd ~/workspace/src/ign-cmake
$ git branch -a
etc.
The standard method to build the libraries is to use the colcon
build tool in the workspace:
colcon build --cmake-args -DBUILD_TESTING=OFF --merge-install --continue-on-error
Edit the XML for the MinimalScene
plugin in ~/.ignition/gazebo/7/gui.config
to use the Metal render system by adding the <render_system>metal</render_system>
element:
<plugin filename="MinimalScene" name="3D View">
<ignition-gui>
<title>3D View</title>
...
</ignition-gui>
<engine>ogre2</engine>
<scene>scene</scene>
<ambient_light>0.4 0.4 0.4</ambient_light>
<background_color>0.8 0.8 0.8</background_color>
<camera_pose>-6 0 6 0 0.5 0</camera_pose>
<graphics_api>metal</graphics_api>
</plugin>
On macOS the method used to start the Gazebo server and gui by forking the process in ruby will not work. Instead you must start the processes in separate terminals.
Start the server:
source ./install/setup.zsh
export PATH=/usr/local/opt/ruby/bin:$PATH
ign gazebo -v4 -s shapes.sdf
Start the client:
source ./install/setup.zsh
export PATH=/usr/local/opt/ruby/bin:$PATH
ign gazebo -v4 -g
You should see the window: