How to remove portions of a background in compositing?

Hello. I’m new to compositing, and I’m wondering if I can solve a problem, using it.

I have been modelling a Black Hole, following the guidelines provided by the Iridesium group. It works fine and I have been getting acceptable results, which have been enhanced by some mild compositing. The problem I have is when I use a background HDRI image I composed (some nebulas stitched together and wrapped spherically).

The black hole is just that: a hoje on a transparent sphere with tweaked IOR as material, which renders fantastically on a black background. The problem arises when I use a background, which shows through (and heavily distorted) the blackhole, which should be only visible as an utterly black and unreflective/non-refractive portion of space. Here is the visual:

I tried inserting a black sphere inside the transparent sphere, but it wreaks havoc on the effect the black hole is supposed to exhibit, regarding the “folding” of the accretion disc.

So, I believe the answer would be to “black-ou” the black sphere through compositing.

I tried with a heavily brightened and contrasted demonising shadowing mask, as shown in the nodes below (which yields a totally black sphere surrounded by a totally white background), but when I try to multiply the mask by the composited image, it either results in a mask (factor larger than zero) or the unchanged composited image (factor equal zero).

So, I guess my questions are:

  1. Am I correct in assuming I can solve this problem through compositing?
  2. If the answer to (1) is “yes”, how should I do it?
  3. If the answer to (1) is “no”, how else can I have a completely black background on my backhoe? I guess one way would be to render two sets of images and later integrating them, but if there is some other way, I’d love to learn about it.

As always, thanks a lot.

The way I would do it is in your World Settings Node Tree and add in a Light Path and Camera as the factor…

Or I suppose you could check Transparent in the Scene Film setting.

hanks, @RSEhlers for the tip. A variation of it almost does what I need it to do.

Here’s the result of applying your method:

It’s almost the opposite of what I’m aiming for. However, if instead of “is Camera Ray” I choose “is Transmission Ray”, I get very close:

The only remaining problem is that the sphere I have for the black hole is larger than the effect of the accretion disc, which leaves a “black aura” on the outside.

So, the question now is: is there a way to restrain the blocking of the transmission rays to a smaller sphere? If so, how?

OK…I think I found a solution…I had to find the vid tutorial and re-create the scene…so your background is just an image composited into the scene…I was thinking it was an actual HDR in the Background Nodes…

Your compositing nodes are just about right…Try One Scene, and use a Holdout on the icosphere…that will block the sphere and what’s behind it…
Run another scene and add a transparent Background…and the icosphere
see if then you can composite both renders together…I think it will work…but you might have to Hold out both the icosphere and plane with just background and composite that in as well…

Hope I didn’t lose you with this idea…

Actually, I don’t understand why “One Scene” is. My nebula background is, indeed an HDRI background.

Here is the result after I compositing it:

The added blackhole just leaves, well, a hole—a darning see-through hole—where I want a black sphere.

So, can you help me understand what One Scene is? (Provided it will help me given my background is an HDRI 360-image?

Typing ERROR!!! SCENE
Sceen

When you render it (F12), it will render all scenes. This is One Scene with Holdout on the sphere and Another Scene with sphere. BOTH have HDRI!!!

So…if you do the above and add a THIRD SCENE, with just the sphere, you could adjust the sphere with say, a glossy shader or specular and make the edges reflect the HDRI to make the sphere show up…only problem is the sphere is larger, than the hole in the hold out and I am not sure what effect that will have…Try it and see…

Just tried it…had a bit of difficulty getting all the renders…seemed to only want to render 2 images not all…but by switching to another scene and changing the slots got them all…might want to render out to disk…
End result is not as bad as I thought and I just rendered, no changes to sphere…

For what I think you want…the HOLE to BE a Black Sphere ?
I took and added in another Scene copy of the Full scene…
Duplicated the original sphere and cleared the material add new…Black, Metalic, Full Rough, and just a hint of Specular…with it selected you just scale it down till it fits the Black HOLE that was created…hide Everything but the Dull Sphere block from Camera also…then use the setting from the Original Post for the world setting…HDRI hidden and solid Black Background…render this and composite into the final…I still have that Emissive ring from the tutorial…but yours is way out on the edge so you will be able to do this better than I ended up…