We have two simulations in Gazebo: A pendulum and an acrobot.
We have the simulations arranged such that the arms are facing the camera. However, at runtime it appears random what ordering the links are actually rendered at. Without making any changes, if the simulation is started many times, each run of the simulation will start with an unpredictable ordering.
From one run, here you can see a pendulum with an expected ordering:
The black link of the pendulum is in front of the brown post.
Randomly, on different runs, we'll see the opposite configuration, where the black link is rendered behind the brown post:
With an acrobot, that has more parts in the Z direction, there end up being more unpredictable outcomes. Here's one example:
The dark blue link is the top link (drawn behind the post). The bottom link is light blue, drawn in front of the post. This configuration of parts is physically impossible.