Unity VFX Graph - Black Hole Effect Tutorial
17:42

Unity VFX Graph - Black Hole Effect Tutorial

Gabriel Aguiar Prod. 13.05.2026 3 311 просмотров 238 лайков

Machine-readable: Markdown · JSON API · Site index

Поделиться Telegram VK Бот
Транскрипт Скачать .md
Анализ с AI
Описание видео
Let's build an epic Black Hole effect with Unity Visual Effect Graph and Shader Graph. From modeling in Blender to creating textures in Material Maker and putting it all together in Unity! 📢 Wanna polish this Black Hole even further? Become a VFX Pro? Check out the advanced breakdown on Patreon: https://www.patreon.com/posts/158164169 🐰 Rabbit's Tale - Go Wishlist it: https://store.steampowered.com/app/1763860/Rabbits_Tale/ 00:00 Intro 00:32 Scene Overview 01:07 VFX Graph 02:35 Fresnel Shader 04:06 Ring 04:20 Ring01 Mesh - Blender 07:48 Scroll Shader 09:33 Noise01 Texture - Material Maker 11:29 Scroll Shader - Continuation 11:55 Gradient01 Texture - Material Maker 12:36 Scroll Shader - Continuation 13:00 Ring - Continuation 13:18 Gradient02 Texture - Material Maker 13:50 Ring - Continuation 15:41 Noise02 Texture - Material Maker 16:19 Ring - Conclusion 16:37 End Results 16:56 Top Tier Patrons ------------------------- BLACK HOLE PROJECT Patreon: https://www.patreon.com/posts/unity-vfx-graph-158162174 OR GAP Website: https://www.gabrielaguiarprod.com/product-page/unity-vfx-graph-black-hole-effect ------------------------- *Courses* ✦VFX GRAPH - BEGINNER: https://www.udemy.com/course/unity-visual-effect-graph-beginner-to-intermediate/?couponCode=17.99_UNTIL_20-09 ✦VFX GRAPH - INTERMEDIATE: https://www.udemy.com/course/unity-vfx-graph-thunderlord-magic-effects/?couponCode=29.99_UNTIL_20-09 ✦VFX FOR GAMES - BEGINNER: https://www.udemy.com/course/vfx-for-games-in-unity-beginner-to-intermediate/?couponCode=18.99_UNTIL_20-09 ✦VFX STYLIZED EXPLOSION: https://www.udemy.com/course/visual-effects-for-games-in-unity-stylized-explosion/?couponCode=17.99_UNTIL_20-09 *VFX Assets Packages* Unique VFX Ultra Pack: https://assetstore.unity.com/packages/vfx/unique-vfx-ultra-pack-318234?aid=1100l3Jhu Unique Projectiles Vol 1: https://assetstore.unity.com/packages/vfx/particles/unique-projectiles-volume-1-124214?aid=1100l3Jhu Unique Projectiles Vol 2: https://assetstore.unity.com/packages/vfx/particles/unique-projectiles-vol-2-156067?aid=1100l3Jhu Unique Projectiles Vol 3: https://assetstore.unity.com/packages/vfx/particles/unique-projectiles-vol-3-212619?aid=1100l3Jhu VFX Graph - Mega Pack - Vol 1: https://assetstore.unity.com/packages/vfx/vfx-graph-mega-pack-vol-1-207846?aid=1100l3Jhu VFX Graph - Mega Pack - Vol 2: https://assetstore.unity.com/packages/vfx/vfx-graph-mega-pack-vol-2-207847?aid=1100l3Jhu VFX Graph - Mega Pack - Vol 3: https://assetstore.unity.com/packages/vfx/vfx-graph-mega-pack-vol-3-223284?aid=1100l3Jhu VFX Graph - Mega Pack - Vol 4: https://assetstore.unity.com/packages/vfx/vfx-graph-mega-pack-vol-4-250950?aid=1100l3Jhu VFX Graph - Ultra Mega Pack -Vol.1: https://assetstore.unity.com/packages/vfx/vfx-graph-ultra-mega-pack-vol-1-251038?aid=1100l3Jhu ✦ Follow on X: https://twitter.com/GabrielAguiarFX ✦ Subscribe On YOUTUBE: https://www.youtube.com/c/gabrielaguiarprod?sub_confirmation=1 #unity #particles #gamedev #tutorial #vfx #madewithunity #visualeffects #specialeffects #unity #unity3d

Оглавление (18 сегментов)

Intro

Welcome back, guys. Today, let's build an epic black hole in Unity. — I've previously done a similar black hole effect a long time ago, but now let's see an updated version of this with new tricks in a newer Unity version with VFX graph and shader graph. As usual, all of these effects, along with many other assets, are available on my Patreon page, so you can use them in your own games and support the channel. Links in the description. All right, so let's jump right into it. So, let's begin with

Scene Overview

a very quick overview of the scene because I know some of you want to know how this was made. Basically, if you go to window in rendering, you get lighting, and in here you have environment, and on the skybox material, we have added this galaxy material, which is basically a cube map. And by that, I mean on the shader drop-down menu, you can select skybox {slash} cube map. And then you can download any galaxy texture or create one yourself, but what's important is that you set it to cube map. Texture shape, cube. And there you have it, you get this very cool environment. All right, so let's

VFX Graph

begin by creating a VFX graph, which I have previously installed on the package manager, visual effect graph. We have all of these templates, but we can start with the minimal system. Rename it to VFX graph {underscore} black hole, and double-click to open it up. This VFX graph in particular is going to be used to create the illusion of a black hole at the center. We are going to use a sphere. So, let's call it exactly that. To make sure this VFX graph is visible, even if the camera is not pointing at the black hole, we want to set the bounds is set to manual, and increase the volume to 100 in X, Y, and Z. To begin emitting a particle, we go up here on the spawn and use a single burst in this case of one particle. And it's going to live forever since we don't set the lifetime. We have the update particle, and then the output, which is what's going to be visible. This is where the particles are rendered. And in our case, we need to replace this output because we want to use shader graph. Want to create a specific shader. We can use output particle shader graph mesh. And the mesh we are going to use here is the sphere. If you don't see one, you can download Blender, create a sphere, and export it as an FBX. But usually, Unity comes with a default one, and it should do it. Now, I'm going to dock this window right here so we can see what's happening. And let's drag and drop the VFX graph to the scene. Reset transform. And this is what we should have so far. Now, if you really want that black hole with bright edges

Fresnel Shader

we need a shader. So, with a right click, I'm going to go ahead and create shader graph URP unlit shader graph, which means it isn't affected by the lights of the scene. Let's call it Fresnel shader. And then, the idea is to create a Fresnel effect, this node right here. We can expose some of these parameters. As a matter of fact, we can create the color parameter. So, we can control the color of the Fresnel. Let's open the graph inspector. We want to make sure the mode is HDR, so we can control the intensity. Set the color as white, and then drag and drop it more or less around here because now we want to multiply it with the Fresnel effect. Here we go, and connect the base color. As you can see, we have this power node, which is quite useful to control. So, let's create a float for that. Call it the Fresnel power with a default value of one. And connect it right here. Lastly, very important, on the graph settings, let's make sure we enable support VFX graph so it works with VFX graph. Don't forget to save the shader, and then let's go back to VFX graph. And once we click here, it should show up. Here we go, Fresnel shader. Now, it's a little bit up to you, but in our case, we want to increase the size. So, I'm going to use the set size with a value of one. And in this case, we're going to go with a different aesthetic. So, this is the color we're going to use. But, with the I Fresnel power of around 10, so we can get that bright ring around the black hole, right? Fantastic.

Ring

Fantastic. Now, let's move on to the rings around the black hole. With control C and control V, copy this sphere VFX graph and call it the ring VFX graph. Now, we need a very specific mesh to put around the black hole. And

Ring01 Mesh - Blender

if you don't have Blender, go ahead and download. It's very easy to pick up and I will guide you through. Basically, we're going to create a ring mesh, kind of a donut, not really, but kind of. And we can start by deleting everything on your scene. Make sure it's clean. And then with shift A, you can add a circle. We can scale it up to seven. Press S and then seven and then enter. Here we go. And let's enter in edit mode so we can edit this mesh with tab. And we can extrude with E and press S to immediately scale it a value of 0. 15. And then press enter and this is what you should get. Now, we need to add a few edge loops. It's going to increase the poly count, so be careful there. You can press control R and scroll up to add three edge loops and that's it. If we press seven on the num pad to go to the top orthographic view, we can select this ring right here while holding alt and shrink them down a little bit towards the center. We are doing this because now, if we press one on the num pad to go to the side orthographic view, we want to proportionally edit this. And by that, I mean that if you go up here and click on this icon, we're going to turn on proportional editing. This way, if you push this up and scroll up or down with the mouse wheel, we can control the influence, how much it influence nearby vertices. We want to push this a little bit up, not too much, just so it has some volume. Like this. Next step is the UV mapping. If we enter the edit mode, select everything, we can press U to access the UV mapping menu and select light map pack. And this is the trick we are going to show you. You get a bunch of squares, no worries about that. Just select one of these in face mode, select everything again. As you can see that quad has become active and now we can do something called follow active quads. We can press okay and you get this stripe, which is very useful because this means it's unwrapped properly now. And we can fit this properly on the square by making sure that we enable constraint to image bounds. Push it to the center and scale these to the size and up until it fills everything properly. And that's it. Since we are trying to achieve a very specific effect with this black hole, where the motion of the ripples all go through the same side, which is counter-clockwise, we are going to go to object mode by pressing tab and then pressing shift D to duplicate this and then press escape so it stays right there. But with R, rotate it only on the X axis 180°. This way we have this disc, this kind of very extremely flat donut. And now let's enter the edit mode so we can go to UVs because we need to flip them if we want to make sure the ripples go all in the same direction. So we can mirror this on the X axis and that's it. And if we show again the other circle, this is what we get. We just need to join them with control J or search for join. Here we go. It's one mesh now. And I know this is weird, but we need to flip this again and mirror this on the X again so it's properly mapped. Feel free to test it without all of these steps and you will understand the result easily. Now we can rename this to ring 01 and export as an FBX. Make sure you turn on selected objects and export to your project. Now back in VFX graph, we can assign the ring mesh right here. We are currently using the same shader, the Fresnel shader, but for this

Scroll Shader

specific case, we need a new one. So, let's go ahead and create the shader graph, URP unlit once again, and call it the scroll shader. We are going to pan a texture and add a couple of effects. And right from the start, we want to say that the surface type is transparent and the blending mode to additive, or you can turn on allow material override to edit these values as you go. And very importantly, turn on support VFX Graph. This shader begins by sampling a texture, an external texture, which means we can create a texture 2D parameter for the noise texture. For now, I'm going to assign the one that I have here, but we will show you in a moment how to create one, and then drag and drop the noise texture parameter right here and connect to the sample texture 2D. This is what we get. You can assign a default texture for now. In this shader, what's important is the ability to control its offset. So, let's create a tiling and offset node, and then let's create two parameters, one for the tiling and then another for the offset, a vector two called noise tiling with a default value of one by one. Connect to the tiling. And then another vector two for the noise speed. We can use a default value of one on the X only. If we want to automatically animate this, we are going to multiply this noise speed with a time node. Otherwise, you can pan this manually without the time node. Connect to the offsets, and that's pretty much it. As you can see, the texture itself is already panning, which was the main objective. Now, as for the texture itself, we can show you how to create one. If you go ahead and search for Material Maker, which is a tool based on nodes to create textures, it's very useful. You can download it for free or contribute to the project. Once

Noise01 Texture - Material Maker

you open it up, this is what you get, and we want to begin by searching for a shape because with a shape we can say it's a circle. As you can see on the preview to the window, we get a preview of the node you are selecting. First parameter is for the sides count and the second one is to control the size. We want to begin with something small like 0. 2 and last parameter is control the fade. Let's set it to one. We get this tiny circle, this tiny blob of light and there's a cool trick if we connect these two a tile or node, it will tile these in whatever way we want. We have tested a couple of values and these are the ones that are best for the texture we are going to create. Feel free to test different values, but essentially the tile X and the tile Y, we can set it 10 by 10 so we can increase the intensity. Overlap is how much they can overlap with each other. Let's set it to four and now let's scale them up with 0. 7 on the X and on the Y. Fixed offset to one so they move horizontally, but most importantly random offset. So they go all crazy and we break that grid pattern. Random rotation since they are circles, we don't notice it, but random scale of 0. 8 and we get some circles that are bigger, others that are smaller and that's great because this will allow us to invert this gray scale and we get a pretty cool texture. It looks like skin under microscope or some kind of weird component under microscope. But we can go even further and use a blur, a Gaussian blur for example. Increase the grid size first so it has a better resolution and that will fix it or you can play with the sigma value. And to finish off, a colorize node will do the trick just fine if we push the black key to the right. As you can see, we get even more darker values and that creates a pretty interesting contrast which is super useful for our texture. And to export this, we can click on this icon right here. You can rename it, choose the resolution and click export as an image, typically as a PNG.

Scroll Shader - Continuation

Now back to Unity. We need to mask that out to soften those edges. It's very simple to create a mask. Basically, we create another sample texture and another text 2D parameter. Call it mask texture. Drag and drop it. Connect to the sample text 2D. And then multiply these two sample textures. Depending on the gradient that we feed to the mask texture, we can fade some edges, which is extremely useful. So

Gradient01 Texture - Material Maker

let's see how to create that gradient. Fortunately, it's a very easy texture. Back to Material Maker, we can begin by searching for gradient, literally. And we can rotate it minus 90°, so it fades from the bottom to the top because the UVs were made in that way. And the cool thing is that we can edit our gradient. For example, we can add a key more or less around here and make sure it's not that dark and then play with it. As you can see, we can leave it more or less around here because we want bigger range for the darker values. And that's it. We can go ahead, click that button to export it, choose the resolution, and where to export it, rename it as well, and then go back to Unity. Now, once you

Scroll Shader - Continuation

have added the gradient to the mask texture, all we need now is a way to control the color of this shader. So, let's create a color parameter. Make sure it's in HDR mode with white color by default and then multiply these two together and connect only to the base color because for the alpha, for the transparency, we want to split this and connect only the alpha. Back to VFX Graph, we can assign the

Ring - Continuation

scroll shader. Here we go. That's much better. As you can see, we already have a mini black hole. Awesome. And we can, for example, play with the noise tiling, so we can have more rings around it or use a different gradient texture, depending on how much you want to dissolve. Basically, if you go back to

Gradient02 Texture - Material Maker

Material Maker, you can use the same technique, create a gradient node, rotate it minus 90°, and in this case, we want to clip the dark values even more, which means we can place a key more or less around here. Say it's a dark gray. And the last key it's going to be very light gray. Then you can go ahead and export it once again. Call it gradient 02.

Ring - Continuation

And then you can adjust the color obviously. And adjust the intensity so it's less or more bright. The speed in this case, yeah, we're going to use these values so it rotates on the opposite direction and slower because it's a black hole. We don't want it to be super fast even though this is a stylized black hole and not a super realistic one, but it looks awesome. And it looks even better if we increase these rings with the set size. We can also set the angle here or on the initialized particle. So we can rotate this horizontally. It was vertical even though we are in space there's no orientation, but it looks better. And in case you wanted to know, that's how you do it. 90° on the X and then you can adjust the size of the sphere for example so it's a little bit more proportional with the rings. And basically you can also use a set scale on the rings to control only a certain axis. For example, this ring it's a little bit thicker so we are going to flat it out on the Z axis a little bit. 0. 7 for example. Now the cool thing with VFX graph is that we can use this system and output different things. So let's copy this output for example, connect the plate right here and in this case we are going to use a different noise. This noise texture right here that we can see right now how to create because it creates a very different feeling as you can see. Basically back to material maker, we want to begin with a noise, a shard noise. We can increase its sharpness, its definition to 0. 8 more or less and scale it up on the X and on the Y to a value of 10. And now, how many times we want this to fold? Let's increase it to one. As you can see, we get a very distinct noise texture already. We can leave iterations at four, play with the persistence, maybe 0. 7, and that should get us really close to what we need. With the colorize node, now we can control those dark

Noise02 Texture - Material Maker

values. We can increase them. And if we want to add even more noise to these, we can use a dirt node, which is literally dirt. We just need to increase its scale to three, and we can put these two together literally with a math node, but we want to divide A with B. And we get this very bright texture. Try to imagine the opposite of this. As a matter of fact, you don't need to imagine, because if you use a invert node, you will get exactly that, and it looks like tin foil, basically. That's what we were aiming for, kind of. You can export up there, rename it.

Ring - Conclusion

Now, you can even switch between two gradients if you want this to be less or more visible. We can decrease the intensity of the color, as well as the speed. And we didn't even touch the size, only the gradient and the noise texture, and we get a totally different feeling in terms of the rings, which is pretty cool.

End Results

So, that's it, folks. For those who want to take this even further, we actually made a second part of this tutorial, where we polish all of these, exclusive for our patrons. If you are interested, it's available on my Patreon page. You can also get this project, as well as many, many other assets from there.

Top Tier Patrons

there. — I want to say a big thank you to each patron, and as usual, a quick shout out to the top tier patrons, which are Albert Ambersheer, Angel Mata, Anna Trontsi, Ashkan Galkali, Berke Kumova, Boris Bradev, Chaos Games, Diego Marks, Entroversal, Eric Horner, Frosty 40, Gabriel De Chichi, Ignasi Garrido, Jade, Dinuga 4, Joseph Balasciu, Kilian Silvest, Leandro Dericio, Link Dimension, Matt Mohan, Madrik Cambi, Oitsk, Pradip Sen, Rain Master Sage, Ryan Lassard, Spock the Grey, Stephen B Junko, Volkan S, Very Suta, Whatever Martha, Rock, Pinching Pan, and Me Jay Kim. Thank you all very much for your support. It's really appreciated. I hope everyone enjoyed this tutorial, and I hope to see you on the next one. Bye.

Другие видео автора — Gabriel Aguiar Prod.

Ctrl+V

Экстракт Знаний в Telegram

Экстракты и дистилляты из лучших YouTube-каналов — сразу после публикации.

Подписаться

Дайджест Экстрактов

Лучшие методички за неделю — каждый понедельник