How to include bitmap images in CairoMakie?

I have a big figure panel which consists many smaller 2D/3D figures. As I would like vector graphics for the 2D parts (and if possible the axes labels, titles, etc for the 3D parts) I use CairoMakie. However, I find that the 3D surface plots generated by GLMakie looks better than CairoMakie (and in some cases CairoMakie gives the ‘wrong’ color, for example in the 2nd example 'here) for my data.

So my question is, is it possible to have a 3D surface plot generated by GLMakie, and then incorporated (as a bitmap) into a vector graphics generated by CairoMakie saved as pdf? Since they are different backends, so I guess it is impossible to do so in one single step. If that’s indeed the case, are there ways to accomplish this sequentially? (e.g. first export the 3D surface plot as .jpg or .png using GLMakie, then import the bitmap, and generate the final figure as .pdf using CairoMakie).

I had a PR up which did exactly this, which I am looking to revive. You can indeed do this sequentially, but it’s nontrivial. If you’re OK with using a dev branch, I can clean it up today ish and you could probably use it then.

The interface would be similar to rasterize=true in CairoMakie, but would also include the ability to rasterize a whole Scene (so that you get the benefits of e.g. depth buffering).