Create Realistic Black Holes in Blender | Full Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
foreign [Music] [Music] [Music] what's up everybody welcome back to the channel so one of my favorite movies of all time is Interstellar and ever since I started learning blender I've wanted to recreate the iconic black hole Gargantua so in this video I'm going to show you how you can make an incredibly realistic and cinematic black hole in blender that thanks to some optimization actually renders pretty quickly too and as you can see from some of these 4K renders this setup has some serious detail so you can have a great looking shot from just about any point of view as you've probably noticed by now this video is a bit longer than my usual content so you may want to grab a snack first but with that let's jump in so I've got a fresh project file here and the first thing I'm going to do is switch over to Cycles GPU compute and I'm going to lower my render samples to 128. then I'm going to come down here to my color management and I'm going to switch my look to medium high contrast and while you're here you'll want to make sure that you're in the filmic view transformation uh this is like a general rule for basically everything but make sure that that is checked on then I'm going to come over here and delete the default light and now so for building the black hole a black hole isn't really like an object if you think about it at least what we're seeing what we see is the effect of light being bent so extremely that it can't escape and so we need to simulate gravity affecting light and the issue with that is that blender considers light to be a perfectly straight line because for 99.999 of all situations it is effectively a straight line so we need to make the straight light rays look like they're being bent and the easiest way to do this is just a bunch of discrete iterations for example I just added this curve Circle here and you can see it looks like a circle like a nice curve but of course it's just a set of discrete straight lines that bend ever so slightly between them to look like they're curved so that's how we're going to get away with it so the way we're going to bend the light is we're going to create a bunch of nested spheres and each of those spheres is going to bend the light a little bit and that'll create the effect of light actually being bent around the world origin and so if we tab into edit mode with our default Cube selected right click subdivide give this nine cuts then select everything and press shift alt s this will let us use the two sphere transform to make this into a sphere Tab out of edit mode shade smooth then add a subdivision surface modifier and just set this to one then you can go ahead and apply this tab into edit mode again shift alt s to sphere make it a sphere again and that's pretty good tab back out and then we're going to rename this to Shell then add in a another Cube hide the shell hop over into geometry nodes and add a new geometry nodes modifier now I'll grab my shell from up here and a transform geometry node and just set this up like that I'm also going to scale this down by 0.8 then I'm going to grab a geometry to instance node I'll plug this into a duplicate elements node and then make sure this is set to instance and I'm going to slide all of this on over now I'm going to grab an integer node and plug this into the amount and I'm going to set this to 64. this integer is going to control basically how many shells we have and then in order to make this noticeable because right now they're just all in the same space perfectly overlapping each other so we have to alter them a little bit so grab a math node set to divide plug this in here divide by 4.25 duplicate this again plug the duplicate index and this value into here like that shift d set this to power then plug this value into the base and set your exponent to 2.5 now just grab an add node and we're going to add 1 to this so now if we grab a scale instances node plug this in and we zoom out you can see we have a bunch of nested shells and now the reason I used a power node here is because this lets us distribute the shells more compactly toward the center and further apart out here because if you think about it the lensing of the gravity is going to be much much more intense down here toward the center compared to out here and so we want to have more shells so that we have a more realistic solution there so that's why we have that then you're going to want to grab a realize instances node click that into there and actually while I'm at this you're going to want to make sure to save your file just in case things can get a little bit heavier during the process later and I don't want you to lose your progress now we're just going to plug in a set shade smooth node and a set material node plugged in like that and I'll assign myself a material over here now with that done we can hop over into our Shader editor jump over to rendered View and I'm actually going to hide our set of spheres I'll also rename this to lens so now in order to see the lens actually working we need something for it to welt to lens so I'm going to add in sort of a stand-in accretion disk by adding in a circle scaling this up a bit pressing es to scale this out even further and there we go give this a new material set this to an emission Shader then I'm going to grab a checker texture set this to be a little bit darker there we go and I'm going to grab a texture coordinate node so you don't really need to do this right now but it'll speed things up later I'm just going to plug in the object coordinates set this scale to something much much much lower and I'm just going to bring into node groups that we're going to need later just that you guys can see them you don't really need to know how they work so I'm just going to show you them and you can copy them directly so I just appended these two nodes here and so I'm just going to link these for free in the description but this spherical coordinates node what it does is it takes like the object coordinates which are in Cartesian so you have your X Y and Z and it converts them to spherical coordinates which is your radius your distance from the origin your Theta which you can think of as like your angle above or below the Horizon and then there's this fee which is like your rotation around the z-axis and so then this Cartesian coordinates node just converts them back again I'm going to link these in the description there's not really anything here you have to understand it's just converting a couple mathematical equations into like blender nodes so you can see if we plug these in directly one for one then into here we don't have any difference but one little neat thing is that if we just grab a combined XYZ node and plug our radius Theta and Phi into the X Y and Z respectively and plug this in and then we grab a math node and multiply our fee value you can see we get this like sort of radial texture which can be pretty useful for visualizing our black hole for now so yeah just download these in the description and we're going to be using these later in our accretion disk too so now we can click our lens back on click onto here and click to our material that we have assigned delete the principled bsdf and we're going to grab a refraction Shader and now this ior value this controls how much the light's going to bend when it hits the sphere so if I set this to 1 we get no bending but you'll notice we actually get this weird artifact of these dark lines and the reason we're getting that is because blender by default is only set to calculate 12 transmission passes and over here in our geometry nodes we created 64 of these shells and so we need to be able to calculate exactly double that amount and so if we set transmission and total to 128 you can see that resolves the problem now as we increase this ior it'll bend the light more but the thing is we don't want the light to bend just evenly across every sphere we want it to bend more intensely toward the center so I'm going to grab a coordinates node and a vector math node set this Vector math to length then plug the object coordinates into here then if we plug this into the ior slot grab a math node set this to add 1 and you can see we're getting nothing and that's because we have to do a lot more math to this real quick so grab another math node set this to subtract and subtract 1.4 I'm going to be using a couple values that are going to seem kind of arbitrary here by the way these are not just random values I've selected I've just done a lot of fine tuning to this over the last couple weeks so if at any point you think to yourself that altering one of these values makes it look better by all means do that again this is a lot of my personal preference going into here but it is also a lot of refinement so it's not just completely random selection now with that we're going to set our power to minus 0.5 come over here set this to divide and we're going to divide by our sort of like resolution amount if you want to think about it whatever we put into this integer slot and so now we've got this effect you can see it's like kind of working but not really the first thing we want to fix is this weird effect that's happening at the edges of all the Spheres so let's grab ourselves a layer weight node and a color ramp plug the facing value into here set this blend to like 0.9 and if you can see what this looks like it just looks like this and we're just going to make the light intensity very small toward the edge plug this back in so if we duplicate this set it to multiply and plug in our color ramp then we can set this white value to something pretty high pretty close and you can see this has gotten rid of that weird Edge effect now I'm going to hop over here and after my ADD node I'm going to set a power node to 2. because in real life of course it is a squared fall off as you get further away grab another math node set this to multiply and I'm going to set this to 2.8 now if you duplicate your power node and we're gonna have to set this to something smaller I'm going to set this to 1.74 I found a value of like 1.7 to 1.8 to be pretty good then we're just going to multiply this again by a whole lot I'm going to go like 22. maybe a little bit more and that looks pretty darn and good to me but now one thing you're going to notice is that the center of our black hole isn't actually really black and so what we're gonna do is we're just going to add a regular old UV sphere shade it smooth shrink it down to something like 0.1 and we're just going to add an emission Shader to it with a strength of zero and that'll prevent those like erroneous sort of light bounces and I do want to reiterate by the way this is like extremely realistic this is basically how it's done by like people who made Interstellar obviously they were using a special rendering engine not just shells of glass but yeah this is an extremely realistic result and I also want to add before I go any further like credit where it's due this lensing setup I by no means I'm the person who came up with this I do want to say the person I learned about this from was Samuel Krug you've maybe heard of his channel but I know he also heard about it from somewhere else this has been around on the internet for a while now just want to make sure credit where credit is due now one more thing I do want to add is I want to make a sharp sort of Halo ring around my black hole and to do that again we're going to grab our friend the texture coordinate node and a vector math node plug this into here get the length again then grab a map range node plug this value into here then set your two Min value to 2 and leave your max at one and we're going to plug this into the color slot on our refraction and we're just going to kind of artificially amplify the light right here near the edge and so in order to isolate that edge we're going to set this to 2.37 for our min and our from Max is going to be four and just like that you can see we have like this just beautiful halo effect yeah it really is just amazing what blender can do I mean this is just honestly amazing as is but now we're going to add in the accretion disk and this thing is going to be beautiful and so now before we actually do that I'm going to scale this down a bit just to make the scale a bit more workable then I'm going to click on my camera and I'm going to set my focal length to 300 millimeters and the reason I'm making this so telescopic is that if you think about it even in space when something is like close by to you it's still thousands and thousands of kilometers away and so at that length even something that's nearby you need basically a telescope in order to zoom in on it and so by making our focal length more telescopic we're going to get a much more realistic result so now I'm just going to line up my view and if you select render region over here then that'll make this render a little bit quicker you'll also want to adjust this clip start and clip end on your camera just like that maybe rotate the disk and yeah that looks pretty good to me for now maybe zoom in a little bit more there we go now I'm going to hide my stand-in accretion disk and I'm going to make my world absolute black hopping back into our layout I'm going to add in a cube tab into edit mode scale then shift Z to only scale on the X and Y and scale this by like 60 and that should be good this looks like laughably huge but don't worry all the effects are going to come from the volumetrics so as long as this is just really big you'll have no issues now I'm going to rename this to accretion disk and give it a new material then I'm going to give this a copy rotation constraint and just select our accretion disk stand in now for the Shader delete the principled bsdf and add an emission into the volume so starting out we're going to make a mask for how intense the emission should be based on its distance from the center so we're going to create sort of like a donut and so at this point you might know how we're going to do this we're going to grab a texture coordinate node and a vector math node set this to length object into the vector slide this over again grab a float curve node and a map range node so this length obviously goes all the way to effectively like infinity or the largest number blender can calculate but our float curve works on values of zero to one so we have to Define like the farthest point and the closest point to the center so for my closest point I'm going to do something like that and then I want this to reach to a value of about 10 away and if I plug this into the value and plug this into the strength and then alter my float curve you can see we've got the start of like our disk and so yeah if you noticed this weird kind of like volumes being projected on the surface effect uh just restart your file really quick that always fixes the issue for me not sure why that happens but yeah so I'm going to adjust my fall off to be something kind of like this maybe because I want more like the intense ring and then a very nice sort of fall off there and so something like that looks pretty good to me and then you can always add in a power node and increase this to make the fall off like even sharper and again if you adjust this from max value that's going to adjust effectively the radius of your emission might even increase this just a tiny bit but now that we have our donut mask we have to create a height mask and so this is going to basically affect like the thickness of our accretion disk so by grabbing a separate x y z and then a math node plug the Z into there set this to multiply and I'm just going to set this to one for now and you'll see why we added this in just a sec so duplicate this again set this to absolute value so this would we just have the distance from the X Y axis then we're going to grab a map range node again and we're going to grab another float curve plug this value into here then I'm going to set my minimum value to something like -1 and leave my Max at one for right now plug this into the value slot again we're going to have this mapped like this and now if we multiply these two masks together and I may need to set these to something lower let's do minus 0.1 and 0.1 you can see there we go now we have control over the thickness of our accretion disk and so I'm going to create a value node just for ease of access later and I'm going to group this into a node group and I'm going to rename this to thickness drag this on up here grab a math node plug this into a multiply multiply by minus one plug this into here and then just plug the value directly into the from Max come in here and adjust this and this way we can adjust the thickness of all of our layers just from one single node group because we're going to create two we're going to create an emission and an absorption like accretion disk basically and so I'm also adjust my endpoints here to make this a bit smoother and now I'm actually going to set my thickness over here I'm going to set this to something much larger then I'm going to come back here to this multiply node and I'm going to increase this and so you can see this has the same effect as altering our thickness but the reason we've added this in here is I'm going to grab a Musgrave texture and I'm going to use this to actually control the thickness to an extent so if I grab a map range node again and set my minimum value to 0.2 set my maximum to four then make my minimum like 5 Max 100 and plug this on in then if I set this to multi-fractal and adjust these values here and so I'll actually grab my texture coordinate node and there you go now you can really see the actual effect but now we're gonna have to bring in our spherical coordinates and our Cartesian coordinates nodes just plug these in one for one slide this on over slide this over again grab a vector math node and I'm going to make one alteration of this before I do anything more and that is set this to multiply set all these values to one except the Z I'm going to make this two this sort of just flattens it which makes sense if you think about it it's a spinning disc and so things are going to flatten out now if you hit control right click you can cut that and it'll go back there we go and now I'm going to start doing some math in between these two nodes and so what I'm going to do is I'm going to grab a math node plug this into the Theta and set this to power now if we set this to something like a minus 1.2 and then I plug this into my Surface again you can see as we adjust this value it starts to sort of stretch radially to give that like moving around sort of feel and so that's exactly what we want and again I'm going to use a value node group this and I'm going to name this to twist then plug this into my exponent value set this to minus 1.2 looks pretty good and yeah and so this is one place that you could stop but in real life you get more of a spiraling effect too it's not just this circling around so if we duplicate our math node and we set this to add we can then duplicate our texture coordinate setup and once again we're going to set this to length and I'm going to group this drag this over set a math node to power exponent of 0.5 grab a map range node plug this into here this into the output then I'll plug my output into this add slot and now I'll have it affect anywhere from zero to five values and go a little further if you want and as you can see if I increase this I get like this nice sort of spiraling effect and so I'm going to lower this a little bit something like that looks pretty good then I'm going to duplicate this math node set it to add and grab a group input node and you can see if I adjust this value now it just Alters its rotation about the z-axis and we're just going to use this to randomize all our noise textures we create in a second and so cut this again zoom on in and now you can see where our volumetrics are starting to come about and one more thing we actually have to do we have to adjust in our render settings is if you come down to volumes we're going to need to adjust this step rate and so I'm going to set this to 0.1 and that's going to tell blender to pay way more attention to our volumes basically give them more Fidelity and more detail then I'm going to lower my Max steps to like 64. so that way it will keep our renders at a reasonable speed and so with that done maybe alter this a little bit more and so with this done I'm going to class this as my Omission mask but first i'm going to duplicate this noise setup then I'm going to highlight all this Ctrl J to join and I'm just going to control shift d on those noise textures so that way we keep them connected then I'm going to grab a math node set this to multiply and we're going to use these noise textures to add even more detail plug this in there we go and you can see that already adds like a whole bunch of detail but we need to alter this a lot to make it look about better so first thing I'm going to adjust the add values on these node groups to randomize them then I'm going to take this bottom noise texture and I'm going to make this like the larger scale noise and so set this to something like that there we go lower this Dimension even more and I'm going to make this top noise a very high detail texture and so set the scale pretty high and lower my Dimension again not quite to zero but just about and now one more thing you can do is if you use a power node and increase your value here that acts like increasing contrast for these noise textures and so this can be useful then I'm going to add just a little bit to both of these so this way we don't have any areas where there is no emission at least not really aside from of course our mask and yeah there we go now I'll just multiply this by something like laughably huge maybe do something more like 25. because and remember we're going to add in some absorption now so we're gonna actually reduce the amount of light you see so I've just made it extremely bright for now but we're going to shift d to slide this on up and this is going to become our absorption mask and so if we grab a volume absorption node there we go plug this into the density and grab ourselves and add Shader node adjust this color I'm going to do something like a dark brown and then first thing I'm going to do is just adjust my ADD values here to make this like way more random then I'm going to adjust my fall off and so the first thing I'm going to do is make a set of extends further away but then I'm also going to adjust the fall off here and the nice part about this is that since we're using absorption this is going to render a lot faster than if we were using scattering like literally twice as fast also adjust my z-axis mask adjust my noise texture for this and then I think I'm going to alter the thickness value for this compared to the emission and so I'm going to set this to something less than the value I used for my emission and yeah that's looking pretty gorgeous to me I'll adjust the light of my mission something kind of gold and red and then one more thing I'm going to do is just like how we compressed our noise texture for the vertical mask I'm going to compress the noise textures that we're using here even more so I'm going to set this to to a six for both of these I'm also going to rename my node group we used to cause the spiral to spiraling there we go and yeah I mean that's pretty much it actually everything else we're gonna do now is just in the compositor and so of course like do go through here and alter these I've just made tons of tiny tiny little adjustments over the course of several days and it has improved dramatically so as you go through consider working with your noise textures you can adjust your scale and whatnot to give a different effect than I may have created you can adjust things like the fall off you can add in more noise textures if you like instead of just doing a small and large maybe you want to add in a medium as well you can adjust this step rate but yeah that is it pretty much for the actual 3D side so what I'm going to do is I'm going to render out a quick pass in HD and then I'm going to show you a few compositing tips that really are going to elevate this okay so with that rendered out I'm going to hop over to my compositor check use nodes slide this over shift right click to create a junction and that'll give us a viewer node also by the way if you want to speed up your renders one thing I recommend is upping this noise threshold I usually set it to around a 0.1 but if you're doing like an animation or something you need a lot of frames you can even get away with like a 0.5 and that will help you a lot you can also set your Mac samples to as low as 64 and you'll still get pretty good results but also make sure you're using the denoising effect check here rather than just the denoising node as I've noticed this tends to have better results so we're gonna have a pretty simple compositing setup I'm going to set in a glare node set this to streaks and I'm going to set this to a high then I'm going to set my color modulation to like a zero and set my mix pretty low as well lower my threshold though to something like that and I'm going to lower my fade a tiny bit also if you come down here over options and check opencl that lets you use your GPU if you have it to speed up some of the compositing nodes now I like that just giving us a little bit of that Halo glow there and if you press alt V you can zoom in and if you press V you can zoom out a little bit unintuitive but you get used to it now I'm going to grab myself a blur node so if I slide this on up and I'm going to create another Junction I'm going to plug this into the blur node here make sure this is set to gaussian then I'm going to grab a mix node I'll set this to add and then I'm going to blur my image by something like around 50. and plug this into the bottom slot slide down my factor a little bit and you can see this gives us a really nice like bloom or glowing effect probably reduce this even more something around a 0.1 because you don't want to over composite otherwise it gives it that really edited looking sort of feel but you do want to make sure that your image looks as good as it can so I'm going to duplicate this again and now for this gaussian I'm going to create a very blurred image like something like 750 pixels of blur plug this into here and then grab a hue saturation value node you can see this gives us like a volumetric glowing Bloom effect which I think is like super pretty but to make this look even cooler I'm gonna add in a hue saturation value lower this to make this more of a blue rather than the reddest orange we have and I mean that looks like pretty darn beautiful if you're asking me you can pull up your compositor viewer and yeah this is this is pretty incredible again I highly recommend you go through and tweak the little values like your color values your noise values a little bit just to get something that you're really really happy with and then you can also adjust maybe say like your exposure if you wanted to something like that play with your gamma touch either way yeah this is this is a really nice looking final result I think and yeah that's the tutorial guys thank you all so much for watching if you like this video then consider doing all the YouTube jazz liking subscribing all that stuff if you want to get the project file for all the shots at the start of the video then that'll be on my gumroad link in the description below also a cool way to support the channel if you want to but yeah thank you guys so much for watching hope you enjoyed it hope you learned something and I hope to see you all next time foreign
Info
Channel: Alaskan FX
Views: 183,591
Rating: undefined out of 5
Keywords: Blender, Tutorial, Black hole, space, Blender 3.5, animation, melodysheep
Id: XWv1Ajc3tfU
Channel Id: undefined
Length: 36min 37sec (2197 seconds)
Published: Fri Apr 21 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.