How would you do this in a game engine?
I guess the rendering of the cubemap itself is fine, but I would separate the cubemap rendering from rendering the black hole, because you can save a bit of texture bandwidth, shader instructions and fillrate by only generating fragments within the circular region occupied by the black hole effect.
Since rendering a circle/sphere is unnecessary/bad, you could render a billboard quad with its center at the position of the black hole and its edge size being just the diameter of the black hole's projected circular area of influence.
That would actually not be _that_ complicated. You just need to project the corner vertices of the quad correctly.
Additionally, with this method you can have arbitrarily many little black holes. Together with instancing and probably large point sprites instead of the billboard quads would be the most efficient solution I can think of currently.
Next, I would change the clip space depth of the fullscreen quad to be at max depth so that one can render all other visible scene objects first and then depth-test away the parts of the cubemap that are occupied by scene geometry.
Can I apply this post-processing to a 2D image of the scene? I do that anyway for some graphical effects.
Doing this as a 2D image post-processing effect has the disadvantage that you must obviously be careful with the distortion/bending of the ray/view direction so as not to exceed the bounds of the 2D image, because things outside of your viewport cannot be made visible through the black hole effect.
This is of course not an issue when using cubemaps.
But cubemaps need to sample more texels and use quite a lot more GPU memory. So performance-wise a 2D image is a better solution, but more tricky to get good results with.