63
$\begingroup$

I recently saw the film Interstellar and it was fantastic! The effects blew me away and it got me in the mood to try and re create the black hole, however I haven't been able to find any information on how you can make a spherical object warp the world around it.

Is there anyway in which you can do this? I've tried adding another sphere, making it transparent and giving it a gravitational lighting effect but it just doesn't cut it. The sphere needs to somehow warp everything around it and not itself.

I'd love to hear any tips or suggestions to try out and experiment with them!

Note that I am not great at using nodes so if that's the key, could you explain in great detail?

--

I've tried that method but the outcome is with a black sphere. I've checked all the nodes and modifiers multiple times and all is the same so I'm slightly confused as to why it's not working the same. I have a hunch that it could be the shadow being emitted by the half sphere however I've disabled it in the 'Ray Visibility' section. I've tried adding transparency nodes with ray depth, shadow ray, camera ray etc but nothing seems to be working.

enter image description here

Weird shockwave effect:

enter image description here

Here's my .blend file: Black Hole

I have the black hole working nicely now. Have made some slight changes to accommodate for jagged edges and the warp moving away from the black hole.

I've changed the bounce values to decrease the amount of dark patches. enter image description here

Here's what it now looks like. All I need to do now is figure out a way to create an inner distortion around the very edge of the black hole. Any advice on that would be great! Then I can work on an accretion disc.

I've upped the To Max value to 0.040. enter image description here

I should also note that I have chopped the black hole sphere in half. This is so the refraction sphere doesn't hide behind it when up close. It also keeps a nice warped edge when close which looks really good.

$\endgroup$
8
  • 1
    $\begingroup$ mind posting a picture of what you have to far? $\endgroup$ Nov 10, 2014 at 13:58
  • $\begingroup$ I hadn't saved anything as I didn't get too far, it was more of a quick experiment. I basically just made a sphere, made it black, turned down the intensity and specularity all the way down and that was it. Then made a bigger sphere with a star field to act as space. That was the basic gist of what I had. :) $\endgroup$
    – Stewie
    Nov 10, 2014 at 18:23
  • 2
    $\begingroup$ If you go to cgcookie/blender there's a series of transformation tutorials, in the examples at the end he shows how to create a little black hole that has a texture warped around it. Might give you a starting point. $\endgroup$
    – Neil
    Nov 11, 2014 at 9:18
  • 2
    $\begingroup$ There is a thread of the exact same thing on Blender Artists here: blenderartists.org/forum/… The OP is planning on releasing the .blend file once the project is finished. $\endgroup$
    – J Sargent
    Dec 15, 2014 at 16:56
  • 1
    $\begingroup$ There is another blender user who replicated the gravitational lensing effect by using multiple planes and a gradient texture to control the degree of refraction. Node setup at link. blendernation.com/2015/02/17/behind-the-scenes-gargantua $\endgroup$
    – Nightshade
    Mar 20, 2015 at 11:38

2 Answers 2

115
+50
$\begingroup$

The trouble with this is that you need light to "bend" in a continuous arc around the black hole.

The reason why this bending is problematic is that cycles assumes light always travels in straight lines. Light does travel only in straight lines, but it can be bent by gravity.
Gravity is a distortion of spacetime around objects. The more massive the object, the more distortion.
So light is always going straight (from it's point of view), but to us it appears to bend as it follows the "straight lines" of distorted space.

Normally these distortions are very small, even with such big and massive objects like the sun. However with such a ridiculously massive object as a black hole, this effect can be quite extreme.

I don't know of any render engines which take into account such corner-case complications like the bending of spacetime near gravitational bodies :P
This is why a special render engine had to be written to render the effects in Interstellar.

 

TL;DR: Light is bent around black holes the same way the paths of planets around the sun are bent. Cycles doesn't have any support for simulating this kind of phenomenon.

So, how can we render it with cycles anyway?

In cycles the only way we can "bend" light is via refraction, which occurs when light exits one medium and/or enters another. It should be noted that refraction a completely different phenomenon from gravitational lensing.

This is really the same problem as Is it possible to change the IOR inside a volume?. can only bend light at a surface, via the refraction shader. We need to make light bend continuously, sort of as if it's in a medium with a changing IOR. However we can only change it's direction at a surface.

To visualize the difference, take this example image.

  • The inner circle represents the event horizon, from which no light can escape (i.e. the black part).

  • The outer circle represents the approximate distance at which the bending of light becomes noticeable. In the version on the left this circle represents a refracting sphere as described by Nightshade.

  • The lines represent the paths of light rays as they travel near the black hole.

Note: While thinking of how to set up some kind of material or effect, it's often useful to think of the scene in the same way that the render engine does. Cycles is a backwards path tracer, meaning it traces rays from the camera out into the scene. So try thinking of these rays in the same way.
See How is Cycles different from Blender Internal? for more info on the workings of cycles.

enter image description here

Example is only a rough hand made visualization, not accurate.

As you can see, rays which hit the refracting sphere are bent all at once at a single point, then continue going straight. It's more like a "direction change" than a curve.

One way to get around this problem is to use a lot of refracting surfaces (black lines) which change the direction the ray (yellow line) a little bit at a time, resulting in an approximation of a smooth curve:

enter image description here

To procedurally create such an object:

  1. Create a single edge.

Add a plane (⇧ ShiftA > Mesh > Plane), then switch to edit mode (↹ Tab), rotate it 90° around the X axis (RX90), and scale it to 0 on the Z (SZ0). Remove doubles by pressing W> Remove Doubles(R).

enter image description here

  1. In object mode (↹ Tab), add an empty (⇧ ShiftA> Empty) and rotate it a small amount around the Z (I rotated mine by -2°).

  2. Add an Array modifier to the line object:

enter image description here

The number for the array modifier Count can be determined like this:
360 / absolute_value(empty_rotation) / 4 + 1

Which gives 46 when empty_rotation = 3.

To add more surfaces and increase the accuracy (and rendertimes!) of the approximation, rotate the empty less and adjust the array count accordingly.

  1. Add a Screw modifier:

enter image description here

It should look like a strange sort of half-sphere.

  1. Add the hole itself by adding a sphere at the center of the front most surface of the half-sphere (⇧ ShiftA> Sphere):

enter image description here

For the material, give it a diffuse shader set to black. This will totally absorb any light which hits it, so zero light will be reflected off of it, making it completely black.

  1. Add a material to the half-sphere.

enter image description here

I've used a spherical gradient texture to control the IOR in order to make light bend more when closer to the center, and less when farther from the center.
This is a very approximate and artistic approach, not very accurate by any means.

If the scale of your object is (1,1,1), the Scale of the mapping node should be set to the diameter of the half-sphere object in BU. This way the gradient texture just fades to black before the edge of the half-sphere object:

enter image description here

To quickly preview nodes in a material, enable the Node Wrangler addon in User preferences > Add-ons, then ⎈ Ctrl⇧ ShiftLMB LMB on any node to quickly connect it to a "preview" emission shader.

In my case the diameter is 5 BU, as can be seen with Length enabled in 3D view > Properties region (N) > Mesh display while in edit mode:

enter image description here

The Map Range node is a node-group which I created based on the implementation in the compositor:

enter image description here

The To Max and To Min values can be adjusted to control the maximum and minimum amounts of refraction. Setting To Max to a higher value will result in more distortion.

Remember to set the color of the refraction node to pure white, so light doesn't get absorbed while bending through the refraction object.

  1. As each ray will have to go through many surfaces, make sure the maximum bounces is set high enough in Render settings > Light paths.

enter image description here

  1. You may want to disable the effects of the refraction object on other objects, as they won't be correct. Light is only bent the way we want it when it enters through the front (thinking in terms of backwards tracing). If a ray bounces off another object and then hits the refraction object from the side, it won't bend anywhere near how it should.

Of course, it's not any more correct to just disable it, but this should help with rendertimes a bit if there are lots of other objects in your scene.

enter image description here

See the manual for more detail on ray types.

  1. Make the black hole always face the camera.

Now our light bending setup is almost complete, but for it to work properly it must rotate so only the front is visible to the camera.

To do this, add another empty (⇧ ShiftA> Empty > Sphere) and parent the refraction object, array empty, and diffuse sphere to it with ⎈ CtrlP:

enter image description here

Add a Copy Rotation constraint to the empty, with your camera object as the target. You may need to enable Offset and rotate the empty in order to get the flat side of the half-sphere face the camera:

enter image description here

If you're wondering why we're not using a Track To constraint, see Planes rotating to face the camera, but only along one axis

Result:

Animated black hole

Note that this only covers the lensing part of the black hole. I'll leave the high-energy matter and the accretion disk to you, as I wouldn't want to take all the fun away ;)

$\endgroup$
17
  • $\begingroup$ A refraction shader with an IOR of 1.2 fakes the effect, though not completely. Not as accurate as the movie but you can see a disc shaped object surrounding the sphere appear to encircle the permimeter. Using a transparent shader and layer weight node with 0.6 (facing) fakes the gradual increase in refraction closer to the hole. I recommend using a NURBS sphere instead of a UV or icosphere. The movie used a special renderer that bent the rays in the scene around the object. The majority of ray tracers do not bend rays (their path gets skewed when hitting a refractive object, but they do not a $\endgroup$
    – Nightshade
    Dec 17, 2014 at 5:43
  • $\begingroup$ Almost done :) Additional stuff: youtube.com/…, youtube.com/… Thanks for this nice answer! $\endgroup$
    – p2or
    Jan 22, 2015 at 10:12
  • $\begingroup$ Actually, there are rendering engines that are specifically designed to handle relativity: fourmilab.ch/cship . But I am not surprised that it is left out of otherwise-full-featured rendering software. However, I can imagine a cycles node that takes over ray path calculation when the ray enters a space. The simplest would allow you to easily render scenes from the Portal video game. $\endgroup$
    – Mutant Bob
    Jan 22, 2015 at 15:51
  • $\begingroup$ This is brilliant! However I'm quite new to Cycles so would you mind explaining how you gave the background a texture? $\endgroup$
    – Stewie
    Jan 23, 2015 at 12:23
  • $\begingroup$ I followed the tutorial step by step, but all I got was a completely black mesh. Even if I put only the refraction node, it ends up like this. What could that be? $\endgroup$
    – user11194
    Jan 24, 2015 at 16:01
34
$\begingroup$

I guess military budgets can cover simulations of anything from a quorn to the physically impossible, but when we're doing "black hole propaganda" for our clients in Langley, we always take the easiest and cheapest route lol.

Fake black hole can be done with a simple setup and a node material: World set to a black Background shader, Plane with texture for visible background, smaller sphere with Holdout shader only, and larger sphere with a Glass shader, IOR controlled by the inverse of Facing ray with about 0.95 Blend value. Spheres need good subdivision. That's it.

Note that what we're pursuing here is a particular Hollywood vision of a BH, in reality a BH would look like an energetic star, you wouldn't see the blackness. (Which leads some evil Russion scientists to claim BHs are just that, stars. But that's a matter for the military to deal with, I don't know anything about it!!!)

Hope this helps.

BH settings and renders

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .